Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Package Problem

Re: Package Problem

From: Sybrand Bakker <sybrandb_at_hccnet.nl>
Date: Fri, 02 Jul 2004 07:02:37 +0200
Message-ID: <81r9e0d2l14pvfk6beoafejbgach70ftmd@4ax.com>


On Fri, 2 Jul 2004 09:50:26 +0500, "Oracle Newbie" <f93c0532_at_yahoo.com> wrote:

>I'm using Toad 7.6 to practise some PL/SQL in office. I've written a Package
>with the following spec and body
>
>
>CREATE OR REPLACE PACKAGE Emp_Grade AS
>
> TYPE rfc IS REF CURSOR;
>
>
> PROCEDURE GetEGrade( empno IN NUMBER, rs1 OUT rfc );
>
> PROCEDURE SetEGrade( rs1 IN rfc );
>
>
>
>END Emp_Grade;
>/
>
>
>CREATE OR REPLACE PACKAGE BODY Emp_Grade AS
>
>
> PROCEDURE GetEGrade(empno IN NUMBER, rs1 OUT rfc ) IS
> rs2 rfc;
>
> BEGIN
>
> OPEN rs2 FOR 'SELECT empno, 1 From emp' ;
>
> rs1 := rs2;
>
> END;
>
>
> PROCEDURE SetEGrade(rs1 IN rfc ) IS
> eno NUMBER;
> grd NUMBER;
> BEGIN
>
> FETCH rs1 INTO eno, grd;
>
> INSERT INTO EMPGRADE VALUES ( eno, grd );
>
> -- INSERT INTO EMPGRADE
>
> END;
>
>
>END Emp_Grade;
>/
>
>
>However in the SQL editor when I test the Package by calling one of its
>procedure like this
>
>DECLARE
> rsg rfc;
>
>BEGIN
> execute emp_grade.GetEGrade(10,rsg);
>
>
>END;
>
>I get the error
>
>ORA-06550: line 5, column 12:
>PLS-00103: Encountered the symbol "EMP_GRADE" when expecting one of the
>following:
>
> := . ( @ % ; immediate
>The symbol ":=" was substituted for "EMP_GRADE" to continue.
>
>
>Can any one help?
>
>Also is there a way to insert a row like
>
> INSERT INTO TBLNAME VALUES ( variable_cursor );
>
>
>???
>thx
>

execute is a sql*PLUS command, not SQL. Just remove it from your code. The answer to your second question is version dependent.

--
Sybrand Bakker, Senior Oracle DBA
Received on Fri Jul 02 2004 - 00:02:37 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US