你以前的代码
测验
它不等于你最初发布的内容——这实际上是一个错误
PL/SQL
块,然后需要
INTO
条款:
SQL> BEGIN
2 select pkg_developers.lookup_developer_studio('some name') from dual;
3 END;
4 /
select pkg_developers.lookup_developer_studio('some name') from dual;
*
ERROR at line 2:
ORA-06550: line 2, column 5:
PLS-00428: an INTO clause is expected in this SELECT statement
要是
SELECT
(在SQL级别)那么是的-您不需要
进入
:
SQL> select * from developerstudios;
STU DEVELOPERSTUDIOID
--- -----------------
MGM 100
SQL> select pkg_developers.lookup_developer_studio('MGM') from dual;
PKG_DEVELOPERS.LOOKUP_DEVELOPER_STUDIO('MGM')
---------------------------------------------
100
SQL>
如果需要PL/SQL,则声明一个将存储该值的变量:
SQL> SET SERVEROUTPUT ON
SQL>
SQL> DECLARE
2 l_id developerstudios.developerstudioid%type;
3 BEGIN
4 select pkg_developers.lookup_developer_studio('MGM') INTO l_id from dual;
5 dbms_output.put_line('Result = ' || l_id);
6 END;
7 /
Result = 100
PL/SQL procedure successfully completed.
SQL>