Results 1 to 3 of 3
  1. #1
    Join Date
    May 2004

    Unanswered: PREPARE statement

    I'm writing a stored procedure with query via the PREPARE statement. I've read several pieces of documentation, but I'm missing something as I cannot get it to work. Below is a shortened version of my procedure. It is generating the errror
    PLS-00103: Encountered the symbol "SQL_STATEMENT" when expecting one of the following
    for the PREPARE line of code.

                   sqlExclCriteria varchar(6000) := 
                   'select id, courseCode || ''-'' || title as courseInfo,
                         ''Course Code/Title combination doesn''''t match any existing courses'' as reason
                               from tmpSessions tmp
                               where not exists (select * from drLearningActivity la
                                     where upper(la.code)=upper(tmp.courseCode)
                                     and upper (la.title)=upper(title))
                        union all   
                     PREPARE sql_statement FROM 'select id,domaincode,vendor, ...
                             from tmpSessions tmp2
                            where not exists (select id from (' || sqlExclCriteria || ') tmp where';
                     DECLARE recs CURSOR FOR sql_statement;
                     open recs;
                     FETCH recs INTO v_recid, v_domainCode, ...;
                     END LOOP;
                     CLOSE RECS;
    Can someone please point me to what I'm doing incorrect?

    Thank you.


  2. #2
    Join Date
    Aug 2003
    Where the Surf Meets the Turf @Del Mar, CA
    Provided Answers: 1
    After RTFM below,

    I could find no reference to any PREPARE statement.

    SQL <> PL/SQL
    Last edited by anacedent; 12-18-08 at 18:31.
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Jun 2003
    West Palm Beach, FL

    Thumbs down Mix and match not allowed.

    As anacedent mentioned, there is no PREPARE statement in Oracle.

    You may be "mixing" T-SQL syntax with Oracle SQL and PL/SQL syntax, as you have other incorrect syntax as this:.

                     DECLARE recs CURSOR FOR sql_statement;

    PS: Read the Oracle® manuals!
    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts