ORA-06550 PLS-00103错误:遇到符号

时间:2017-10-31 13:08:15

标签: sql oracle plsql ora-06550 pls-00103

create or replace PROCEDURE empl_info(ename VARCHAR2,empid OUT 
NUMBER,empcount OUT NUMBER,empname OUT VARCHAR2)
IS
BEGIN
SELECT COUNT(emp_name) INTO empcount FROM employees WHERE emp_name=ename;
SELECT emp_name, emp_id INTO empname,empid FROM employees WHERE 
emp_name=ename;
END;


DECLARE en INT,ei INTEGER,ec INT;
EXECUTE empl_info('balu',ei OUTPUT,ec OUTPUT,en OUT);
 SELECT en,ec;

错误: ORA-06550:第1行,第15栏 PLS-00103:遇到符号";"期待下列之一。

你能解决这个问题吗?

2 个答案:

答案 0 :(得分:0)

请使用ANONYMOUS BLOCK

的正确语法
DECLARE 
    en NUMBER;
    ei NUMBER;
    ec NUMBER;
BEGIN
    empl_info('balu',ei,ec,en);
    DBMS_OUTPUT.PUT_LINE('EN :'||en);
    DBMS_OUTPUT.PUT_LINE('EC :'||ec);
END;

答案 1 :(得分:0)

SQL> CREATE or REPLACE PROCEDURE empl_info(ename VARCHAR2,empid OUT NUMBER,empcount OUT NUMBER,empname OUT VARCHAR2) IS
BEGIN
  SELECT COUNT(emp_name) INTO empcount FROM employees WHERE emp_name=ename;
  SELECT emp_name, emp_id INTO empname,empid FROM employees WHERE emp_name=ename;
  dbms_output.put_line(' employee name : '||empname||'  |  employee count : '||empcount);
END;

只调用没有OUT或OUTPUT的变量

SQL> set serveroutput on;
SQL> var ei number;
SQL> var ec number;
SQL> var en varchar2(100);
SQL> exec empl_info('balu',:ei,:ec,:en);