set serveroutput on;
begin
declare dnamet varchar(20):='ACCOUNTING';
loc varchar(20):='ACCOUNTING';
idtag number:=0;
dbms_output.put_line('dnamet:'||dnamet);
select DEPTNO,deptno into loc,idtag from dept where dname=dnamet;
dbms_output.put_line('loc:'||loc);
dbms_output.put_line(''||idtag);
end;
/我是按照书上打的,报如下错误:The symbol "begin
ORA-06550: line 12, column 0:
PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following: begin case declare end exception exit for goto if loop mod
null pragma raise return select update while with
<an identifier> <a double-quoted d怎么解决啊?
刚学plsql,不知道从何入手啊?
begin
declare dnamet varchar(20):='ACCOUNTING';
loc varchar(20):='ACCOUNTING';
idtag number:=0;
dbms_output.put_line('dnamet:'||dnamet);
select DEPTNO,deptno into loc,idtag from dept where dname=dnamet;
dbms_output.put_line('loc:'||loc);
dbms_output.put_line(''||idtag);
end;
/我是按照书上打的,报如下错误:The symbol "begin
ORA-06550: line 12, column 0:
PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following: begin case declare end exception exit for goto if loop mod
null pragma raise return select update while with
<an identifier> <a double-quoted d怎么解决啊?
刚学plsql,不知道从何入手啊?
declare dnamet varchar(20):='ACCOUNTING';
loc varchar(20):='ACCOUNTING';
idtag number:=0;
begin
dbms_output.put_line('dnamet:'||dnamet);
select DEPTNO,deptno into loc,idtag from dept where dname=dnamet;
dbms_output.put_line('loc:'||loc);
dbms_output.put_line(''||idtag);
end;
/--result
dnamet:ACCOUNTING
loc:10
10PL/SQL procedure successfully completed
loc varchar(20):='ACCOUNTING';
idtag number:=0;
begin
dbms_output.put_line('dnamet:'||dnamet);
select DEPTNO,deptno into loc,idtag from dept where dname=dnamet;
dbms_output.put_line('loc:'||loc);
dbms_output.put_line(''||idtag);
exception
when others
dbms_output.put_line(sqlcode);
dbms_output.put_line(sqlmsg);
end;
语法好像是这样写的,先定义,在执行业务块,通过异常捕捉sqlcode,sqlmsg是系统的消息,你可以试试
...
beginexceptionend;