Oracle stored procedure with Sys_refcursor output, Lightswitch, Devart Entity Framework, Toad

I am calling an insert procedure through Microsoft Lightswitch app, and I get this error:

ORA-06550: line 29, column 8:
PLS-00103: Encountered the symbol "SP_MUSIC_INS" when expecting the following:

The procedure is an oracle procedure returning a sys_refcursor.  It has been mapped through DEVART entity framework 4 to work with Lightswitch app as a RIA service.

To test the oracle procedure works, I am trying to run it from oracle.  When I walk through Debug everything is good and the refcursor parameter indicates 1iteration. (Can't see vaule due to it being a refcursor.)

What did I do wrong?   How do I get it to run correctly in Toad?  How do you test a sys_refcursor in SQLPLUS?  Did I miss something in a refcursor setup step in TOAD and in Entity Framework causing this error?

Here is the script I am executing in Toad for the refcursor but I get an the error an not the ability to define the ref_CURSOR AS A CURSOR.
DECLARE
p_Music_GENRE_DESC                  Music.GENRE_DESC%TYPE;
p_SERIES_IND                        Music.SERIES_IND%TYPE;
p_Music_GENRE_CODE_RC                sys_refcursor;

BEGIN
  p_Music_GENRE_DESC := 'Test\Proc Test';
  p_SERIES_IND := 'N';
--  p_Music_GENRE_CODE_RC := null;

  exec SP_MUSIC_INS (p_Music_GENRE_DESC,p_SERIES_IND,:p_Music_GENRE_CODE_RC);
  COMMIT;
END;


Here is how I am calling and assigning the sys_refcursor output.
   )
     RETURNING Music_CODE into p_Music_GENRE_SEQ;
     
     COMMIT;

open p_Music_GENRE_CODE_RC for select p_Music_GENRE_SEQ as p_Music_GENRE_SEQ from dual;

Thank you,

Carol
wpeterbAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

johnsoneSenior Oracle DBACommented:
Not sure I can help with your other issues, but your question of how do I see the information in a ref cursor in SQL*Plus, I think I can help you with.

This way should work with the way you have your code written.  There are other easier ways if you are using a function that returns a sys_refcursor, rather than having it be an out parameter.

var v_rc sys_refcursor
exec sp_music_ins('Test\Proc Test','N',v_rc);
print v_rc;

Open in new window

0
slightwv (䄆 Netminder) Commented:
>>PLS-00103: Encountered the symbol "SP_MUSIC_INS" when expecting the following:

The reason for this error is the EXEC inside a pl/sql block.  The EXEC is a sqlplus command not a pl/sql command.

As soon as the issue the begin...end; you are inside pl/sql.  Just remove the EXEC.
0
Mark GeerlingsDatabase AdministratorCommented:
I agree that the word "exec" in a PL\SQL procedure is not needed or allowed there.  I also wonder about the "commit;" on the next line.  That will not cause an error, but is it needed?  It will add at least a small performance impact, and it could cause unexpected problems if the application has made any changes prior to this call and if the user does not expect those changes to be committed automatically, or if the user (or the application) assumes that earlier changes could still be rolled back.

On the concept of using "ref-cursors": this is one of the fundamental design differences between Oracle and SQL Server.  In SQL Server (and in Microsoft tools) it is expected that a database stored procedure will handle the database cursor and will return a record set to the application.  Historically in Oracle, it was assumed that the application would submit SQL queries directly and that the application would manage the resulting record set  (without depending on a database stored procedure for this functionality).  Oracle has added support for "ref cursors" in PL\SQL (probably because programmers familiar with Microsoft tools asked for that functionality) but that doesn't mean that "ref cursors" are easy to work with in the various Oracle tools.
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

DavidSenior Oracle Database AdministratorCommented:
One side comment, there MAY be a known bug for refcursors in Toad, using Windows 64 bit OS.  Check with Toad tech support if that's your scenario.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
wpeterbAuthor Commented:
Thank you.  I removed the Execute immediate from within procedure.
0
wpeterbAuthor Commented:
Quick response and the answer solved the problem.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.