정의 예외

4186 단어 이상
SQL>  set serveroutput on;
SQL>  declare
  2   num int;
  3   begin
  4   num := 'ssddfasf';
  5   exception
  6   when value_error
  7   then dbms_output.put_line('---- ------');
  8   end;
  9   /
---- ------                                                              

PL/SQL procedure successfully completed.

SQL> declare
  2  sumsal emp.sal%type;
  3  begin
  4  select sum(sal) into sumsal from scott.emp group by deptno having deptno=30;
  5  if sumsal>5000 then
  6  dbms_output.put_line(' 30 , :'||sumsal);
  7  end if;
  8  end;
  9  /
sumsal emp.sal%type;
       *
ERROR at line 2:
ORA-06550: line 2, column 8:
PLS-00201: identifier 'EMP.SAL' must be declared
ORA-06550: line 2, column 8:
PL/SQL: Item ignored
ORA-06550: line 4, column 22:
PLS-00320: the declaration of the type of this expression is incomplete or
malformed
ORA-06550: line 4, column 29:
PL/SQL: ORA-00904: : invalid identifier
ORA-06550: line 4, column 1:
PL/SQL: SQL Statement ignored
ORA-06550: line 5, column 4:
PLS-00320: the declaration of the type of this expression is incomplete or
malformed
ORA-06550: line 5, column 1:
PL/SQL: Statement ignored 


SQL> conn scott.emp
SP2-0306: Invalid option.
Usage: CONN[ECT] [logon] [AS {SYSDBA|SYSOPER}]
where <logon>  ::= <username>[/<password>][@<connect_identifier>] | /
SQL> conn scott/tiger
Connected.
SQL>  declare
  2   sumsal emp.sal%type;
  3   begin
  4   select sum(sal) into sumsal from emp group by deptno having deptno=30;
  5   if sumsal>5000 then
  6   dbms_output.put_line(' 30 , :'||sumsal);
  7   end if;
  8   end;
  9   /

PL/SQL procedure successfully completed.

SQL> conn system/manager
Connected.
SQL>  declare
  2   sumsal scott.emp.sal%type;
  3   begin
  4   select sum(sal) into sumsal from scott.emp group by deptno having deptno=30;
  5   if sumsal>5000 then
  6   dbms_output.put_line(' 30 , :'||sumsal);
  7   end if;
  8   end;
  9   /

PL/SQL procedure successfully completed.

SQL> set serveroutput on;
SQL>  declare
  2   sumsal scott.emp.sal%type;
  3   begin
  4   select sum(sal) into sumsal from scott.emp group by deptno having deptno=30;
  5  if sumsal>5000 then
  6  dbms_output.put_line(' 30 , :'||sumsal);
  7  end if;
  8  end;
  9  /
 30 , :9400                                          

PL/SQL procedure successfully completed.

SQL> declare
  2  dempno int :=7902;
  3  /
dempno int :=7902;
                 *
ERROR at line 2:
ORA-06550: line 2, column 18:
PLS-00103: Encountered the symbol "end-of-file" when expecting one of the
following: 
begin function package pragma procedure subtype type use 
<an identifier> <a double-quoted delimited-identifier> form 
current cursor 

SQL>   declare
  2   enames emp.ename%type;
  3   jobs emp.job%type;
  4   hiredates emp.hiredate%type;
  5     begin
  6     select ename into enames from emp where empno=7902;
  7  select job into jobs from emp where empno=7902;
  8  select hiredate into hiredates from emp where empno=7902;
  9  dbms_output.put_line(enames);
 10  dbms_output.put_line(jobs);
 11  dbms_output.put_line(hiredates);
 12  end;
 13  /
FORD                                                                            
ANALYST                                                                         
03-12 -81                                                                      

PL/SQL procedure successfully completed.

SQL> spool off;

좋은 웹페이지 즐겨찾기