Oracle Apex创建存储过程

时间:2017-12-03 00:43:55

标签: oracle plsql

我是apex和存储过程的新手。这是我创建的一个简单示例程序。但它保持输出“成功与编译错误”。希望有人能提前帮助,谢谢。

CREATE OR REPLACE PROCEDURE get_client_info AS
BEGIN
   select CLIENTID from client
END get_client_info

1 个答案:

答案 0 :(得分:0)

分号;,缺少变量声明和into子句返回。请尝试以下方法:

SQL>set serveroutput on;
SQL>CREATE OR REPLACE PROCEDURE get_client_info AS
   v_CLIENTID client.CLIENTID%type;
BEGIN
   select CLIENTID into v_CLIENTID from client;
   dbms_output.put_line(v_CLIENTID);
END get_client_info; -- no need to use "get_client_info" part here, i mean using "END;" is enough, if you'd like.
/
SQL>exec get_client_info;

或返回结果值:

SQL>CREATE OR REPLACE PROCEDURE get_client_info( o_CLIENTID out client.CLIENTID%type ) AS
    BEGIN
       select CLIENTID into o_CLIENTID from client;
    END; 
    /
    SQL>var clinfo varchar2;
    SQL>exec get_client_info(:clinfo);
    SQL>print clinfo;