PLS-00201 error when declaring ROWTYPE variable

Hi,
I want to declare the rec_ variable like this:
PROCEDURE Insert___ (
objid_ OUT VARCHAR2,
objversion_ OUT VARCHAR2,
new_ IN OUT VARCHAR2,
attr_ IN OUT VARCHAR2 )
IS
rec_ OBUS.ORDER_TAB%ROWTYPE;
where ORDER_TAB belongs to the OBUS schema, a different schema from where the present procedure is being created.
When compiling, I get the following error:
"PLS-00201: identifier 'OBUS.ORDER_TAB' must be declared"
Why do I get this? Can't I refer to a different schema in the declaration area of the procedure?
Thanks.
Leandro.

Thank you both. It compiled ok after granting the select privilege.
However, I was able to execute a "select * from obus.order_tab" from a SQLPlus session, no matter if I had granted or not the SELECT privilege for that table.
It seems the behaviour is different in a SQL session from a declaration in a procedure. Am I right? What could be the reason for this?
Thanks.
Leandro.

Similar Messages

  • PLS-00201 error when trying to pass an OUT parameter

    Hi,
    Please help me to resolve the below error:
    I am trying to pass an OUT parameter in a package.
    I have declared it in package specs as
    ProcABC(p_val IN varchar2, p_val2 IN varchar2, p_val3 OUT varchar2)
    In package body
    I have created the procedure as
    Create or Replace procedure ProcABC(p_val IN varchar2, p_val2 IN varchar2, p_val3 OUT varchar2) AS
    v_LogDir varchar2(40);
    v_message varchar2(200);
    BEGIN
    SELECT directory_path into v_LogDir FROM ALL_DIRECTORIES WHERE directory_name = 'ABC';
    v_message := v_LogDir ;
    some sql statements..
    p_val3 := v_message;
    Return p_val3;
    End procABC;
    SQL> exec pkg_A.procABC('Stage2', NULL, p_val3);
    Package compiles successfully but while execution it returns error as:
    ORA-06550: line 1, column 74:
    PLS-00201: identifier 'p_val3 ' must be declared
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    Please advise.

    Hi Suresh,
    Thanks for the information and help. I was able to run the package with this usage.
    Now, the issue is
    I need to return a v long string by the OUT parameter so I defined the datatype of OUT parameter as CLOB.
    But, when I declare local variable to run the package with this OUT paramater I get the error :
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    ORA-06512: at line 1
    When I pass a shorter string it works.
    Kindly advise me how to resolve this issue while using CLOB as datatype of OUT parameter.

  • PLS-00428 Error when creating a new trigger

    Hi,
    I'm encountering the PLS-00428 error when I run the script below.
    CREATE OR REPLACE TRIGGER TIBCOUSER.po_response_trigger
    BEFORE INSERT ON po_response FOR EACH ROW
    BEGIN
    IF:NEW.ariba_processsequence is null then
    SELECT pttransid AS pttransid, 'Product Test Pass 1' AS pttransname, aribaorderid AS aribaorderid, '0' AS errorcode, '' AS MESSAGE, SYSDATE AS ariba_insertdate
    FROM po_request
    WHERE adb_l_delivery_status = 'N';
    UPDATE po_request
    SET adb_l_delivery_status = 'C'
    WHERE adb_l_delivery_status = 'N';
    END IF;
    END;
    Can someone point out what is missing or what is wrong with the script? Any help would be much appreciated.
    Regards,
    Jigger

    Hi Jigger,
    I was able to create the trigger using the script below.That's nice, you got the trigger created. Below is your trigger, I have added some comments.
    create or replace trigger tibcouser.po_response_trigger
       before insert or update
       on po_response
       for each row
    declare
      -- 1. These variables should really be anchored to po_response
      -- 2. They should be named differently than columns in po_response
      -- 3. It seems that you don't need them (See 7.)
       pttransid               integer := null;
       pttransname             varchar2(255) := null;
       aribaorderid            varchar2(255) := null;
       errorcode               integer := null;
       message                 varchar2(255) := null;
       ariba_insertdate        date := null;
       adb_l_delivery_status   char(1) := null;
    begin
      -- 4. This is never true, since adb_l_delivery_status is null, here
          -- So, I guess your trigger never does anything, so in a sense it works
       if (adb_l_delivery_status = 'N')
       then
        -- 5. This select  will raise too_many_rows, when there is more than one record in po_response.
        -- 6. It seems you will have a problem with mutating table
        -- 7. The select doesn't do anything, you never use any of the values selected
        -- 8. The select is confusing, since variables are named equally to columns
        -- 9. You select constants, why not just assign them right away
        select pttransid
                ,pttransname
                ,aribaorderid
                ,'0'
                ,sysdate
            into pttransid
                ,pttransname
                ,aribaorderid
                ,errorcode
                ,message
                ,ariba_insertdate
            from po_response;
          -- 10. This update will update ALL records in po_request, probably not what you want.
          update po_request
             set adb_l_delivery_status = 'C';
       end if;
    -- 11. Good practise dictates end po_response_trigger;
    end;
    /In general, when you think your post has been answered, then kindly mark it as such.
    Regards
    Peter

  • Error when defining a variable  other than CHAR

    I am getting a syntax error when I define variables :
    data: l_arbei  type p.
    constants:  l_delim  type x  value '09'.
    Message L_ARBEI must be a character-type field (data type C, N, D or T). an open control structure introduced by "INTERFACE"
    Has anyone else experienced this problem.  Why can I not define these variables.

    data: l_arbei  type p decimals 1,
          l_ismnw  type p decimals 1.
      write w_ops-work_activity to l_arbei. 
      l_arbei = l_arbei - l_ismnw.          
      if l_arbei gt 0.                      
        write l_arbei to w_ops-work_activity.
      endif.
    As mentioned same error message when defining the following:
    constants:  c_delim  type x value '09'.
         split i_input1-line at c_delim into 
               w_hdr-orderid                 
               w_hdr-order_type.              
    I agree that there should be no problem with the definitions. However cannot understand why it does not like it.  Thought there might be an additional requirement for Unicode systems.

  • Error when declaring IDOC segments in program

    I am getting error when declaring IDOC segments in my program.
    Below is how I declared.
    data: wa_e1vfkonk      like e1vfkonk.
    For the same syntax few segments are showing as properly declared and few are showing error that 'eqvfkonk' does not exist.
    How ever this structure does exist when i check it.
    Help appreciated.

    Hi Prasad,
    I think the segment that you are declaring in the program doesn't exist in SAP system as standard.
    Maybe you mean E1VFKONX, finishing with "X" instead "K"?
    Reward points if useful.
    Roger

  • PLS-00201 error calling function in package member

    Hello,
    I'm trying to call a function defined in a PL/SQL package, but receiving a PLS-00201 error.

    Sorry, a finger-controller error caused me to submit before I was ready. I'm having the module replaced today. :)
    After rethinking my decision to post here, I decided not to. I've never received a helpful answer, probably because the issues are not simple... Too bad.

  • PLS-00201 error occurs when batching a stored procedure in SQL*Plus

    I have a batch file to run a stored procedure and spool the results to file. When I enter the commands manually in sql*plus the output works fine and my results are spooled to the output file. But when I run the same commands in the batched script I get an error.
    Any ideas?
    Stored Procedure:
    create or replace procedure MMP( p_cursor in out SYS_REFCURSOR)
    as
    begin
    open p_cursorfor select name, id from table;
    end;
    batch file 1:
    sqlplus -S user/pw@REPORTDV @sp_output_spooled.sql
    script file sp_output_spooled.sql
    Pasting these commands directly to the SQL*Plus command prompt spools the result set to file as expected.
    set colsep '|'
    set echo off
    set feedback off
    set termout off
    set heading off
    set linesize 9000
    set pagesize 0
    set trimspool on
    set headsep off
    spool output.TXT
    var rc refcursor
    execute MMP(:rc)
    print rc
    spool off
    exit
    The errors printed to output.TXT file after the batch is run and error occurs:
    BEGIN MMP(:rc); END;
    ERROR at line 1:
    ORA-06550: line 1, column 8:
    PLS-00201: identifier 'MMP' must be declared
    ORA-06550: line 1, column 8:
    PL/SQL: Statement ignored
    ERROR:
    ORA-24338: statement handle not executed
    SP2-0625: Error printing variable "rc"

    Hi,
    Your code worked fine for me.
    Is MMP procedure owned by the same user that is running the batch file or does it have proper privileges and synonym?
    vr,
    Sudhakar

  • ORA-06550/PLS-00201 error while configuring data source

    Hi,
    My development platform is Visual Studio 2005, ODAC11g Release 1 (11.1.0.6.20), and Oracle 10g Release 2 database.
    I tried to setup a sqlDatasource in my web page using drag and drop features
    When I configure the sqlDatasource to use a stored procedure inside a package,
    I notice that odp.net uses #0# as separator (instead of .) between package name and procedure name in Configure Data Source dialog box. Then when I clcik the Test Query button, I got following error.
    There was an error executing the query. Please check the syntax of the command and if present, the types and values of the parameters and ensure they are correct.
    ORA-06550: line 1, column 7:
    PLS-00201: identifier 'PK_LOOKUP_TABLE#0#P_LIST' must be declared
    ORA-06550: line 1, column 7
    PL/SQL: Statement ignored
    It looks like odp.net cannot locate PK_LOOKUP_TABLE#0#P_LIST.
    Is there any workaround ?
    Below is the stored procedure code. It compiles and runs without problem.
    PACKAGE BODY pk_lookup_table
    AS
    /* Get a list of lookup table name */
    PROCEDURE P_LIST (
    O_CURSOR OUT sys_refcursor )
    IS
    l_cur sys_refcursor;
    BEGIN -- executable part starts here
    OPEN l_cur FOR
    SELECT table_name
    FROM all_tab_comments u
    WHERE u.comments LIKE '%Lookup Table%'
    ORDER BY 1;
    o_cursor := l_cur;
    END P_LIST;
    END "PK_LOOKUP_TABLE";
    On the sqlDataSource property sheet, if I click the Select Query property, the Command and Parameter Editor will open, then I can change the select command name to PK_LOOKUP_TABLE.P_LIST. Then if I run the application, I get another error.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
    Exception Details: Oracle.DataAccess.Client.OracleException: ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'P_LIST'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    Seems that it can locate the procedure.
    In the Command and Parameter Editor dialog, I can add output parameter, but data type is restricted. There is no REF CURSOR datatype in the dropdown list.
    How can I add output parameter with REF CURSOR type via IDE ?
    Thanks for the time looking into this issue.
    Mansion

    Hi
    Even I faced this problem while connecting to RMAN . But I feel your problem is different .
    My issue was like this
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-00554: initialization of internal recovery manager package failed
    RMAN-04005: error from target database:
    ORA-06550: line 1, column 7:
    PLS-00201: identifier 'DBMS_BACKUP_RESTORE.SET_CHARSET' must be declared
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    RMAN-04015: error setting target database character set to WE8MSWIN1252
    Solution :
    execute catproc.sql;

  • PLS-00201 ERROR - XML. and XPATH. Calls

    I'm getting the below errors. I've loaded javavm and inixml.
    Does anyone have any suggestion on compiling the vendor code.
    Thanks. Corey
    SQL> show errors
    Errors for PACKAGE BODY INTR_ITIN_PKG:
    LINE/COL ERROR
    334/3 PL/SQL: Statement ignored
    334/13 PLS-00201: identifier 'XML.PARSE' must be declared
    341/3 PL/SQL: Statement ignored
    341/21 PLS-00201: identifier 'XPATH.SELECTNODES' must be declared
    353/5 PL/SQL: Statement ignored
    353/22 PLS-00201: identifier 'XPATH.SELECTNODES' must be declared
    363/5 PL/SQL: Statement ignored
    363/21 PLS-00201: identifier 'XPATH.SELECTNODES' must be declared
    480/3 PLS-00201: identifier 'XML.FREEDOCUMENT' must be declared
    480/3 PL/SQL: Statement ignored
    498/11 PL/SQL: Statement ignored
    LINE/COL ERROR
    498/29 PLS-00201: identifier 'XPATH.SELECTNODES' must be declared
    509/11 PLS-00201: identifier 'XML.FREEDOCUMENT' must be declared
    509/11 PL/SQL: Statement ignored
    685/3 PL/SQL: Statement ignored
    685/17 PLS-00201: identifier 'XPATH.SELECTNODES' must be declared
    707/3 PL/SQL: Statement ignored
    707/17 PLS-00201: identifier 'XPATH.SELECTNODES' must be declared
    753/3 PL/SQL: Statement ignored
    753/17 PLS-00201: identifier 'XPATH.SELECTNODES' must be declared
    SQL>

    I had a package which worked under 8i, part of the package body like
    Create or Replace Package Body AbleTool as
    Function Transform(xml Clob,xsl Clob) Return Clob is
    p xmlparser.Parser;
    xmldoc xmldom.DOMDocument;
    xsldoc xmldom.DOMDocument;
    proc xslprocessor.Processor;
    ss xslprocessor.Stylesheet;
    cl Clob;
    begin
    p := xmlparser.newParser;
    xmlparser.setValidationMode(p, FALSE);
    xmlparser.setPreserveWhiteSpace(p, TRUE);
    xmlparser.parseClob(p, xml); -- parse xml
    xmldoc := xmlparser.getDocument(p);
    xmlparser.parseClob(p, xsl); -- parse xsl
    xsldoc := xmlparser.getDocument(p);
    proc := xslprocessor.newProcessor;
    ss := xslprocessor.newStylesheet(xsldoc, '');
    dbms_lob.createtemporary(cl, TRUE);
    xslprocessor.processXSL(proc, ss, xmldoc,cl);
    xslprocessor.freeStyleSheet(ss);
    xslprocessor.freeProcessor(proc);
    return cl;
    when I installed 9i db, and run the package on it. I get errors
    like
    PLS-00201: identifier 'XMLPARSER' must be declared
    PL/SQL: Item ignored
    PLS-00201: identifier 'XMLDOM' must be declared
    PL/SQL: Item ignored
    PLS-00201: identifier 'XMLDOM' must be declared
    PL/SQL: Item ignored
    PLS-00201: identifier 'XSLPROCESSOR.PROCESSOR' must be declared
    PL/SQL: Item ignored
    PLS-00201: identifier 'XSLPROCESSOR.STYLESHEET' must be declared
    PL/SQL: Item ignored
    PLS-00320: the declaration of the type of this expression is incomplete or malformed
    PL/SQL: Statement ignored
    PLS-00320: the declaration of the type of this expression is incomplete or malformed
    PL/SQL: Statement ignored
    PLS-00320: the declaration of the type of this expression is incomplete or malformed
    PL/SQL: Statement ignored
    PLS-00320: the declaration of the type of this expression is incomplete or malformed
    PL/SQL: Statement ignored
    PLS-00320: the declaration of the type of this expression is incomplete or malformed
    PL/SQL: Statement ignored
    I searched on the Forum, someone suggests that the following privileges should grant to the user.
    execute of xmldom
    execute of xmlparser
    execute of xslprocessor
    so I did as he said, the first two errors about xmldoc and xmlparser gone, the third error is still there, the error message is
    PLS-00201: identifier 'XSLPROCESSOR.PROCESSOR' must be declared
    PL/SQL: Item ignored
    PLS-00201: identifier 'XSLPROCESSOR.STYLESHEET' must be declared
    PL/SQL: Item ignored
    PLS-00320: the declaration of the type of this expression is incomplete or malformed
    PL/SQL: Statement ignored
    PLS-00320: the declaration of the type of this expression is incomplete or malformed
    PL/SQL: Statement ignored
    PLS-00320: the declaration of the type of this expression is incomplete or malformed
    PL/SQL: Statement ignored
    PLS-00320: the declaration of the type of this expression is incomplete or malformed
    PL/SQL: Statement ignored
    PLS-00320: the declaration of the type of this expression is incomplete or malformed
    PL/SQL: Statement ignored
    What else there I should do?
    Please help.

  • PLS-00201 ERROR

    Hi to all,
    I have tried to create this procedure:
    CREATE OR REPLACE PROCEDURE VERIFY_CREDENTIALS
      pUSERNAME IN VARCHAR2,
      pPASSWORD in VARCHAR2
    IS
       lCounter number;
       lPassword varchar(255) DEFAULT GET_HASHED_PW( pPASSWORD);
    BEGIN
       SELECT COUNT(*) INTO lCounter
         FROM WEBUSERS
              WHERE USERNAME = pUSERNAME
              AND   ENCRYPTEDPWD = lPassword;
       IF ( lCounter = 0 ) THEN
            RAISE_APPLICATION_ERROR( -20001, 'invalid USERNAME/password' );
       END IF;
    END;When I compile, the error
    PLS-00201 - The identifier GET_HASHED_PW must be declared
    is displayed.
    How can resolve this problem ? Can You help me ?
    The DB Version is 10.2.0.1.0 under Windows 2003 Server
    Thank You and Best Regards
    Gaetano

    Solved,
    The GET_HASHED_PW is declared in a Package.
    I have added the name of package to the function and all work.
    Thank You.
    Gaetano

  • PLS-801 internal error when returnig rowtype in select clause

    Hi,
    looks like the following case is not handled in version 11.1.0.6.
    I created a function which returns a ROWTYPE
    and when calling this function from a simple sql statement an internal error occurs.
    create table testing as select 1 id, 'A' val from dual;
    create or replace function ret_row return testing%rowtype is
    cursor cur_t is
    select * from testing;
    r testing%rowtype;
    begin
    open cur_t;
    fetch cur_t into r;
    close cur_t;
    return r;
    end;
    select ret_row from dual; when executing this select statement the following error occurs:
    SQL> select ret_row from dual
    ERROR at line 1:
    ORA-06553: PLS-801: internal error [55018]Didn't find any notes from the metalink about this error.
    Ants

    Perhaps in this specific case you can view your output as ->
    satyaki>
    satyaki>select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
    PL/SQL Release 10.2.0.3.0 - Production
    CORE    10.2.0.3.0      Production
    TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
    NLSRTL Version 10.2.0.3.0 - Production
    5 rows selected.
    Elapsed: 00:00:01.48
    satyaki>
    satyaki>
    satyaki>create table testing as select 1 id, 'A' val from dual;
    Table created.
    Elapsed: 00:00:03.16
    satyaki>
    satyaki>set lin 80
    satyaki>
    satyaki>desc testing;
    Name                                      Null?    Type
    ID                                                 NUMBER
    VAL                                                CHAR(1)
    satyaki>
    satyaki>
    satyaki>set lin 310
    satyaki>
    satyaki>create or replace function ret_row return testing%rowtype is
      2  cursor cur_t is
      3   select * from testing;
      4   r testing%rowtype;
      5  begin
      6   open cur_t;
      7   fetch cur_t into r;
      8   close cur_t;
      9   return r;
    10  end;
    11  /
    Function created.
    Elapsed: 00:00:03.06
    satyaki>
    satyaki>
    satyaki>select ret_row from dual;
    select ret_row from dual
    ERROR at line 1:
    ORA-00902: invalid datatype
    Elapsed: 00:00:00.25
    satyaki>
    satyaki>declare
      2       y testing%rowtype;
      3  begin
      4       y := ret_row;
      5       for i in 1..y.ID
      6       loop
      7         dbms_output.put_line(y.ID);
      8         dbms_output.put_line(y.VAL);
      9       end loop;
    10  end;
    11  /
    1
    A
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.16
    satyaki>
    satyaki>Regards.
    Satyaki De.

  • Error when using the variable System::ErrorDescription

    HI All,
    When I try to use the variable System::ErrorDescription I get the following error:
    The element cannot be found in a collection. This error happens when you try to retrieve an element from a collection on a container during execution of the package and the element is not there.
    Do I need to declare it or it's a variable that always is available to get exceptions from the execution states?

    if this is in a Script Task then:
    - add the variable in the Script task property ReadOnlyVariables list
    - in the Script Code refer to it as
    string ErrorDesc = (string) Dts.Variables["System::ErrorDescription"].Value;
    Jan D'Hondt - SQL server BI development

  • Error when defining a variable from a class

    Hi,
    I'm getting this error message when trying to define a
    variable from a class:
    '1086: Syntax error: expecting semicolon before left paren.'
    I can't see where the error is.
    The scripts Question.as and Codeframe.as is located int the
    folder Mycomponents under the project.
    Regards
    /Acke
    **** Main app *****
    <mx:Script>
    <![CDATA[
    import mx.controls.Alert;
    import mx.events.CloseEvent;
    import myComponents.*;
    var Question():myComponents.Question=new Question(); // !!
    This line causes the error !!
    other code goes here....
    ]]>
    </mx:Script>
    **** The class definition ******
    package myComponents
    //import other classes needed
    import Mycomponents.Codeframe
    public class Question {
    // Define properties and methods.
    // Define public vars.
    public var Qtype:string;
    public var Condition:string;
    public var Qnumber:string;
    public var Qheading:string;
    public var Pretext:string;
    public var Qtext:string;
    public var Posttext:string;
    public var Codeframe():string;
    public var Reserved:string;
    public var EditableFrom:string;
    public var EditableTo:string;
    public var Decimal:string;
    public var SetQfactor:string;
    public var Logic_if():string;
    public var Logic_then():string;
    // Public constructor.
    //public function Question(){
    // do stuff to set initial values for properties
    public function Question(Type:string,
    Condition:string,
    Qnumber:string,
    Qheading:string,
    Pretext:string,
    Qtext:string,
    Posttext:string,
    Codeframe():string,
    Reserved:string,
    EditableFrom:string,
    EditableTo:string,
    Decimal:string,
    SetQfactor:string,
    Logic_if():string,
    Logic_then():string,
    ):Void
    this.Type=Type;
    this.Condition=Condition;
    this.Qnumber=Qnumber;
    this.Qheading=Qheading;
    this.Pretext=Pretext;
    this.Qtext=Qtext;
    this.Posttext=Posttext;
    this.Codeframe()=Codeframe();
    this.Reserved=Reserved;
    this.EditableFrom=EditableFrom;
    this.EditableTo=EditableTo;
    this.Decimal=Decimal;
    this.SetQfactor=SetQfactor;
    this.Logic_if()=Logic_if();
    this.Logic_then()=Logic_then();
    }

    1.
    It should be
    var theQuestion:Question = new
    Question(sType,sCondition:string,sQnumber,sQheading,sPretext,sQtext,sPosttext,
    sCodeframe,sReserved,sEditableFrom,sEditableTo,sDecimal,sSetQfactor,sLogic_if,sLogic_then )
    As you don't have default values in the constructor - you
    should specify the parameters.
    2. why do use type "string" ? It should be "String" if you
    refer to a standard type
    3. What are you trying to say by this:
    public var Codeframe():string;
    public var Logic_if():string;
    public var Logic_then():string;
    There should not be any parenthesis in the variable
    declaration.
    4.
    this is wrong
    var Question():Question=new Question();
    this even wronger
    var Question():Array=new Question(); // I'm trying to create
    an array here anyway...could this be the problem??
    no parenthesis!
    var Qs():Question=new Question();
    hmmmm....
    .var Qs()=new Question();
    I think you should start reading from the following link to
    get more understanding of the variables, types & declarations:
    http://livedocs.adobe.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDo cs_Parts&file=00001863.html
    Cheers,
    Dmitri.

  • ODI "Session Stopped" Error when refresh a variable

    Hi ,
    I have a error using ODI when I refresh a global variable and odi report this error information as "Seesion Stopped"!!!
    Does anyone come across it? Do you have any suggestion to me?
    Thank you in advance!
    Jack

    Have you got any constraints defined on your datastore at all ?
    Static control is set to what on your interface?

  • Errors when using query variables.

    Recently in about half the queries I write with variables the variables will not work. For example:
    SELECT O.DocNum
              ,O.CardCode
              ,O.CardName
              ,P.PrioDesc AS 'Priority'
              ,O.DocDueDate
              ,O.DocTotal
              ,O.U_Engineering_Appvd     
              ,O.Confirmed AS 'Approved'
              ,O.U_Purchase_Reviewed
    FROM ORDR AS O
         JOIN OCRD AS BP ON O.CardCode = BP.CardCode
         LEFT JOIN OBPP AS P ON BP.Priority = P.PrioCode
    WHERE O.SlpCode =  18 AND
    O.DocStatus = 'O'
    Works perfectly, but when I make the change from "O.SlpCode = 18" to "O.SlpCode = [%0]" it complete fails with a red bar of death. The error I receive is: Incorrect syntax near '0'  Statement 'Service Contracts' (OCTR) (s) could not be prepared.
    Like I said, this isn't for every query, just about half of them. Any help would be appreciated as this is rather important.
    Thanks!!
    Monica

    Hi.
    Try this:
    SELECT * 
    FROM ORDR T0 
      INNER JOIN OCRD T1 ON T0.CardCode = T1.CardCode
      LEFT JOIN OBPP T2 ON T1.Priority = T2.PrioCode
    WHERE T0.[DocStatus] = 'O' AND T0.[SlpCode] LIKE [%0]
    Or this one:
    SELECT O.DocNum,
      O.CardCode,
      O.CardName,
      P.PrioDesc AS 'Priority',
      O.DocDueDate,
      O.DocTotal,
      O.U_Engineering_Appvd,
      O.Confirmed AS 'Approved',
      O.U_Purchase_Reviewed
    FROM ORDR AS O
      INNER JOIN OCRD AS BP ON O.CardCode = BP.CardCode
      LEFT JOIN OBPP AS P ON BP.Priority = P.PrioCode
    WHERE O.DocStatus = 'O' AND O.SlpCode LIKE [%0]
    Also, check the name of User Fields are right.
    Regards.

Maybe you are looking for