Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8639551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:02:11+00:00 2026-06-12T11:02:11+00:00

I have a stored procedure which executes some dynamic sql, shown below. I’ve tried

  • 0

I have a stored procedure which executes some dynamic sql, shown below. I’ve tried to cut it down as much as possible so ignore any little errors.

In the office it works, everytime, on 11.2, 10.2, 10.1. At the customers it fails with a message:

Unexpected Error

Error Message = "Msg:
MyProc
ORA-06550: line 1, column 1:
PLS-00103: Encountered the symbol "" when expecting one of the following:

   begin case declare exit for function goto if loop mod null

If I capture the dynamic sql that the customer is generating and place it in a variable like below, running on work machines, it works, so it’s not that dodgy sql is getting generated. Normally the sql comes from the client so here I’ve doubled the to_date quotes.

mySQL := '
declare 
                pADMINDATE DATE := :1; 
                pEMPLOYEEIDLIKE VARCHAR2(40) := :2; 
                pINCLUDEEMPLOYEE number := :3; 

begin 
BEGIN OTHERPROC.OTHERPROC (1,TO_DATE(''2012-10-03'', ''YYYY-MM-DD''),TO_DATE(''2012-10-03'', ''YYYY-MM-DD''),0); 
END; 
INSERT INTO TP_EMPLOYEES ( 
        ID, 
            EMPLOYEECODE
) 


SELECT ROWNUM, 
       EMPLOYEECODE
FROM ( 

SELECT EMPLOYEECODE
   FROM (SELECT DISTINCT EMPLOYEECODE FROM TP_EEF_TEMP) DISTINCTEMPCODES) A; 
end; ';

EXECUTE IMMEDIATE
    mySQL
    using 
    pADMINDATE,
    pEMPLOYEEIDLIKE,
    pINCLUDEEMPLOYEE;

It’s not the database version that causes the problem, could it be permissions? It calls another stored procedure within itself which we do regularly in non dynamic sql, could it be that?

At a loss here

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T11:02:13+00:00Added an answer on June 12, 2026 at 11:02 am

    It was carriage returns! Adding this line fixed the problem

    pQUERY2 := REPLACE(pQUERY, chr(13));
    

    A similar problem was highlighted here

    https://forums.oracle.com/forums/thread.jspa?threadID=1117462

    Thanks for the answers anyway, if anyone knows I would be interested in knowing what setting/patch/whatever makes Oracle sensitive to this, i.e. I tried this on 3 different versions of oracle including the one the customer was on, -but- I didn’t patch my 10.2.1 version.
    Is it something that is fixed in a patch? Is it a setting?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Stored Procedure which executes some dynamic SQL. I want to use
I have a stored procedure which generates and executes a piece of dynamic T-SQL
I have a stored procedure (let's say sp1 ) which executes some code to
I have a stored procedure which executes another procedure inside it. The second one
I have a stored procedure, PROC , which receives some parameters. If one of
I have a stored procedure on a SQL Server 2005 database which has a
I have stored procedure which executes another stored procedure several times. I need union
I require is to have a single stored procedure which can execute and show
I have a stored procedure which update a table based on such calculation and
I have a stored procedure which returns sys_refcursor and I am trying to fetch

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.