Like SQL Server, you can use the SELECT statement to send all the records from the field to SELECT. The same statement is used in Oracle to lack the INTO statement, and one or two variables are defined to give it Into. Can I realize it? Is there a boss that experienced this experience, give a solution !!! Thank you !!! -----------------------
- Baotou CREATE OR REPLACE PACKAGE DINYA_PKG_TESTAS? TYPE mycursor is ref curd ;? function get (p_id number) Return mycursor; end dinya_pkg_test;
- Body Create or Replace Package Body Dinya_PKG_TEST AS
? - ******************************************************** **********************************? - Enter ID Returns the function of the record set? Function Get (p_id number RETURN MYCURSOR IS ???? rc mycursor; ???? strsql varcha2 (200) ;? begin ???? IF p_id = 0 THEN ?????? Open rc for select a.user_name from fnd_user A; ?????? ???? ELSE ??????? strsql: = 'select a.user_name from fnd_user a where a.user_id =: p_id'; ??????? Open rc for strsql; ???? end if; ???? RETURN RC;? ???? End GET; END DINYA_PKG_TEST;
- Call: SET SERVEROUT ON DECLARE? W_RC DINYA_PKG_TEST.MYCURSOR ;? W_NAME VARCHAR2 (100); begin? W_rc: = dinya_pkg_test.get (0) ;? - This input you want? LOOP? Fetch W_RC INTO W_NAME;? ?????? EXIT WHEN WHEN W_RC% NotFound; ??????? dbms_output.put_line (w_name); end loop; end; / ----------------- ---
Generally in anonymous block or package (function, stored procedure) must be added to INTOEG: CONN Scott / Tiger @ Your instance name set serveroutput onDeclare ??? v_emp Emp% rowType; begin ??? SELECT * INTO V_EMP from Empno = 7499; ??? DBMS_OUTPUT.PUT_LINE ('Salary ?? Commision'); ??? dbms_output.put_line (v_emp.sal || '???????' || v_emp.comm); end; /
?