Invalid cursor error in procedure

i am writing a procedure in which i have make use of cursor........it is giving me error INVALID CURSOR
on running
i have used this cursor with WITH CLAUSE....
when i am executing or running this procedure this giving me invalid cursor error
create or replace
procedure USP_UPDATEDRUGORDERDTL
v_pServiceid IN NUMBER DEFAULT NULL ,
v_pServRendered IN NUMBER DEFAULT NULL ,
v_pSchDateTime IN DATE DEFAULT NULL ,
v_pOrdQty IN FLOAT DEFAULT NULL ,
v_billingclassid IN NUMBER DEFAULT NULL ,
v_pOrdID IN NUMBER DEFAULT NULL ,
v_UpdatedBy IN NUMBER DEFAULT NULL ,
v_prender IN NUMBER DEFAULT 0 ,
v_pInsertedByUserID IN VARCHAR2 DEFAULT NULL ,
v_pInsertedON IN DATE DEFAULT NULL ,
v_pDrugID IN NUMBER DEFAULT 0 ,
v_pRate IN FLOAT DEFAULT 0 ,
v_pBatchId IN NUMBER DEFAULT 0 ,
v_OrderSource IN VARCHAR2 DEFAULT NULL ,
v_pInsertedMacID IN VARCHAR2 DEFAULT NULL ,
v_pInsertedIPAddress IN VARCHAR2 DEFAULT NULL ,
v_pOldOrdID IN NUMBER DEFAULT NULL,
v_plocid in char DEFAULT NULL
AS
vr_pConsumptionID NUMBER(10,0);
vr_pSavedQty NUMBER(10,3);
vr_pReturnQty NUMBER(10,3);
vr_Qty NUMBER(10,3);
begin
vr_pSavedQty := 0;
vr_pReturnQty := v_pOrdQty;
declare
cursor ordDtl_cur is -----cursor declaration
with --- with clause used with cursor
Q1 AS
Select NVL(ConsumptionID,0) As ConsumptionID,Sum(OrdQty) As OrdQty,
OrdID,DrugID,BatchID, locid from Orderdtl
Where OrdID = v_pOldOrdID and DrugID = v_pDrugID And BatchID = v_pBatchID and NVL(Cancelled,0) = 0
Group By OrdID,DrugID,BatchID,ConsumptionID
Order By ConsumptionID asc
Q2 AS
SELECT NVL(OrderDtl.ConsumptionID,0) As ConsumptionID,(SUM(OrderDtl.OrdQty)) As OrdQty,
IvPatientIssueReturnDtl.OrderID as OrdID,OrderDtl.DrugID,OrderDtl.BatchID,OrderDtl.locid
FROM OrderDtl INNER JOIN
IvPatientIssueReturnDtl ON OrderDtl.OrdID = IvPatientIssueReturnDtl.NewOrderId AND
OrderDtl.DrugId = IvPatientIssueReturnDtl.ItemId AND OrderDtl.BatchId = IvPatientIssueReturnDtl.BatchId
WHERE (OrderDtl.BatchId = v_pBatchID) AND (IvPatientIssueReturnDtl.OrderId = v_pOldOrdID)
AND (OrderDtl.DrugID = v_pDrugID) and NVL(OrderDtl.Cancelled,0) = 0
Group By IvPatientIssueReturnDtl.OrderID,OrderDtl.DrugID,OrderDtl.BatchID,OrderDtl.ConsumptionID
Order By OrderDtl.ConsumptionID asc
Select
Q1.ConsumptionID,(Sum(NVL(Q1.OrdQty,0)) + Sum(NVL(Q2.OrdQty,0))) As OrdQty,
Q1.OrdID,Q1.DrugID,Q1.BatchID,Q1.locid
from
Q1 ,Q2
where
Q1.OrdID =Q2.OrdID(+)
and
Q1.BatchID =Q2.BatchID(+)
and
Q1.DrugID =Q2.DrugID(+)
and
Q1.ConsumptionID =Q2.ConsumptionID(+)
Group By Q1.OrdID,Q1.BatchID,Q1.DrugID,Q1.ConsumptionID;
TYPE ordDtl_trec is TABLE of ordDtl_cur%ROWTYPE index by PLS_INTEGER;
l_ordDtl ordDtl_trec; ---- cursor syntax
begin
if ordDtl_cur%ISOPEN then
open ordDtl_cur; --------------opening cursor
end if;
loop
-- fetch data into cursor---
fetch ordDtl_cur
bulk collect into
l_ordDtl;
-----perform logic--------------------
for indx IN 1..l_ordDtl.COUNT loop
if vr_pSavedQty <> vr_pReturnQty then
If v_pOrdQty <= (vr_pReturnQty - vr_pSavedQty) then
vr_pSavedQty := vr_pSavedQty + v_pOrdQty;
vr_Qty := v_pOrdQty;
else
vr_Qty := (vr_pReturnQty - vr_pSavedQty);
vr_pSavedQty := vr_pSavedQty + (vr_pReturnQty - vr_pSavedQty);
end if;
end if;
end loop;
exit when ordDtl_cur%NOTFOUND;
end loop;
CLOSE ordDtl_cur; ---- closing cursor
end;
end;

Hello.
Very simple.
You are using cursor name before opening it.
Here is the problem.
  if ordDtl_cur%ISOPEN then
   open ordDtl_cur; --------------opening cursor
  end if;
end if;Please change your code like this
comment IF statement use only OPEN  ordDtl_cur;
  ---- if ordDtl_cur%ISOPEN then
     open ordDtl_cur; --------------opening cursor
  --- end if;Thanks,
Suri

Similar Messages

  • Getting Invalid Cursor error in a procedure

    Hi,
    I have a procedure(1) which inturn calls another procedure(2) which does some task.
    Procedure(1) accepts response from Procedure(2).
    The error code of procedure(2) is *0* which is the success response.
    Iam getting 0 from Procedure(2).
    But still Procedure(1) gives me a Invalid cursor error ( eventhough all the cursors are closed and opened ).
    Any suggestion on this????

    procedure p_create_conn -- Procedure(1) which is the calling proc
    is
    begin
    connectivity_api.p_create_connection -- Procedure(2) called proc
    in_scheme_number => in_scheme_number
    ,in_a_lp_sysid => in_a_lp_sysid
    ,in_z_lp_sysid => in_z_lp_sysid
    ,in_interconnect_name => in_interconnect_name
    ,in_mux_usage => in_mux_usage
    ,in_mux_type => in_mux_type
    ,out_a_end_sne => v_out_a_sne_id
    ,out_z_end_sne => v_out_z_sne_id
    ,out_sss_id => v_out_sss_id
    ,out_error_code => out_error_code
    ,out_error_message => out_error_message
    ,in_a_port_name => in_a_port_name
    ,in_a_port_signal => in_a_port_signal
    ,in_z_port_name => in_z_port_name
    ,in_z_port_signal => in_z_port_signal
    ,in_trs_area => in_trs_area
    ,in_alternate_id => in_alternate_id
    ,in_dcn_equipment_name => in_dcn_equipment_name
    ,in_dcn_equipment_id => in_dcn_equipment_id
    ,in_dcn_equipment_notes => in_dcn_equipment_notes
    ,in_tcode => in_tcode
    if out_error_code != 0 --- Error code from Procedure(2) is 0 in my case
    then
    raise ex_p_create_connection;
    end if;
    -- Faliing after success response here
    workflow_utils.create_link
    in_link_type => 'A'
    ,in_source_workflow_name => con_wf_scheme_type
    ,in_source_record_id => in_scheme_number
    ,in_trigger_state => 'initial'
    ,in_dest_workflow_name => con_wf_connectivity
    ,in_dest_record_id => v_out_sss_id
    ,in_dest_from_state => null
    ,in_dest_to_state => null
    ,in_terminate_source => 'N'
    ,in_terminate_dest => 'N'
    ,in_user_account_name => v_user
    -- in this proc all the cursors have been closed properly.
    exception
    when ex_p_create_connection
    then
    null;
    when others
    then
    out_error_code := sqlcode;
    out_error_message := sqlerrm;
    end p_create_connection;
    Is that fine with you????

  • "Invalid Cursor" Error in Form

    Hi,
    I wrote a procedure that take a REF CURSOR as an IN OUT argument. This procedure does an "OPEN cursor FOR qry" with a dynamic query:
    OPEN l_cursor FOR
           'SELECT A '||
             'FROM B '||
            'WHERE C = :l_var'
         USING myVar;After calling the procedure, I do a LOOP with FETCH.
    It works well when I use it in SQL*Plus with DBMS_OUTPUT but it returns a "ORA-01001 invalid cursor" error in Forms.
    Any help is welcome!
    Regards,
    Olivier.

    I found a solution on Metalink:
    Note:170881.1
    Note: 1007395.6
    Olivier.

  • Invalid Cursor error when modifying Assignment details - Transfer workflow

    Hi,
    We're trying to submit a Transfer transaction but if we try to modify any field in the Assignment details screen, we're getting a system error, and sometimes we see ORA-01001: invalid cursor error. We have already checked the database objects (procedures, packages, triggers) and we don't see any code which has an invalid use of a cursor. Does anyone have a clue on the cause of this error?

    This is just a guess,
    all you cursors are being opened regardless of any condition, for example;
    OPEN CUT(:NEW.LAYOUT_NO);
    OPEN DET(:NEW.LAYOUT_NO);
    OPEN ITM(:NEW.LAYOUT_NO);
    OPEN LOT(:NEW.LAYOUT_NO);
    OPEN DTN(:NEW.LAYOUT_NO, :NEW.CUT_NO, :NEW.NOTE);UNA however is opened after a condition;
    IF DTN%NOTFOUND THEN
      /** start --added for cha 2011-3172 6/14/2011 **/
          OPEN UNA(:NEW.LAYOUT_NO, :NEW.ACCOUNT_NO);All cursors arel however closed regardless, i.e. they are all assumes to be open;
      CLOSE CUT;
      CLOSE DET;
      CLOSE DTN;
      CLOSE ITM;
      CLOSE LOT;
      CLOSE STAT;
      CLOSE UNA;So I think you are closing the UNA cursors wen it is in fact not open.
    So, move the "CLOSE UNA;" line of code to before the END IF; on line 278, since that is when it will definitely be open.

  • Invalid Cursor Error

    I have a table called cdd_merge_children where the comments field contains the following SQL.
    SELECT EVENT_ID FROM EVENT WHERE ACCOUNT_ID = :ACCOUNT_NO
    In my procedure I am doing the following:
    --get the comments from the cdd_merge_children table where CDD_MERGE_CHILDREN_TYPE
    --is of type 3. type 3 are a replica of type 2's for audit/history purposes 
    SELECT DISTINCT COMMENTS
    INTO ls_comments
    FROM CDD_MERGE_CHILDREN
    where table_name = ps_tablename
    and CDD_MERGE_CHILDREN_TYPE = 3 ;
    --get the comments from the table and execute the dynamic sql using the looser.
    OPEN col_cv FOR ls_comments USING gvloosingaccount ;
    --dump the curosr values in the table
    FETCH col_cv BULK COLLECT INTO loosingvals ;
    For some reason or the other when I try doing the fetch I am getting invalid cursor or ORA-01001: invalid cursor error. WHY WHY
    Please help !

    You cannot bulk-fetch from a cursor into a collection of records, you can only bulk-fetch from a cursor into one or
    more collections:
    DECLARE
    TYPE NameList IS TABLE OF emp.ename%TYPE;
    TYPE SalList IS TABLE OF emp.sal%TYPE;
    CURSOR c1 IS SELECT ename, sal FROM emp WHERE sal > 1000;
    names NameList;
    sals SalList;
    BEGIN
    OPEN c1;
    FETCH c1 BULK COLLECT INTO names, sals;
    END;
    You cannot however,
    DECLARE
    TYPE NameList IS TABLE OF emp.ename%TYPE;
    names NameList;
    salary emp.sal%TYPE;
    TYPE DeptRecTab IS TABLE OF dept%ROWTYPE;
    dept_recs DeptRecTab;
    CURSOR c1 IS
    SELECT deptno, dname, loc FROM dept WHERE deptno > 10;
    BEGIN
    SELECT ename, sal BULK COLLECT INTO names, salary; -- illegal target
    BEGIN
    OPEN c1;
    FETCH c1 BULK COLLECT INTO dept_recs; -- illegal
    END;
    Ok I have a table called cdd_merge_children which has a column called comments. In this column I am storing dynamic SQL such as
    SELECT EVENT_ID FROM EVENT WHERE ACCOUNT_ID = :ACCOUNT_NO
    Now in my code I retrieve this SQL statement and use it as follows:
    --get the comments from the table and execute the dynamic sql using the looser.
    OPEN col_cv FOR ls_comments USING gvloosingaccount ;
    --col_cv is a reference cursor BTW
    --dump the curosr values in the table
    FETCH col_cv BULK COLLECT INTO loosingvals ;
    Ok at this fetch is where I am getting the following error
    ORA-01001: invalid cursor
    Why ? Anyhelp would be great
    Thank's
    Sameer Handa

  • "ORA-01001 Invalid Cursor" error

    Platform: oracle 8.X on ibm aix and java client code from
    windows NT.
    JDBC DRIVER: JDBC Oracle thin driver version 1.2.
    when i execute a Sql satement with Cursor expression from the
    java client code with XSU it returns an XML DOM But if the
    CURSOR EXPRESSION IN THE SQL QUERY RETURNS EMPTY ROWS i get
    back an error node with "ORA-01001 Invalid Cursor" error
    message.i had aslo set the setNullAttributes(true) property
    on oraclexmlquery.
    Interestingly, if i exceute the same query in the SQL plus
    it returns the column names with no rows.
    is there any way where i can get xml document with table
    structure, when there are no rows instead of ORA error message.
         

    This is just a guess,
    all you cursors are being opened regardless of any condition, for example;
    OPEN CUT(:NEW.LAYOUT_NO);
    OPEN DET(:NEW.LAYOUT_NO);
    OPEN ITM(:NEW.LAYOUT_NO);
    OPEN LOT(:NEW.LAYOUT_NO);
    OPEN DTN(:NEW.LAYOUT_NO, :NEW.CUT_NO, :NEW.NOTE);UNA however is opened after a condition;
    IF DTN%NOTFOUND THEN
      /** start --added for cha 2011-3172 6/14/2011 **/
          OPEN UNA(:NEW.LAYOUT_NO, :NEW.ACCOUNT_NO);All cursors arel however closed regardless, i.e. they are all assumes to be open;
      CLOSE CUT;
      CLOSE DET;
      CLOSE DTN;
      CLOSE ITM;
      CLOSE LOT;
      CLOSE STAT;
      CLOSE UNA;So I think you are closing the UNA cursors wen it is in fact not open.
    So, move the "CLOSE UNA;" line of code to before the END IF; on line 278, since that is when it will definitely be open.

  • Invalid Cursor Error when executing a form

    I am getting the following error
    "Error Executing Cursor
    ORA-01001: invalid cursor"
    when I try to "Submit" information in a form based on the procedure below. What's the problem?! The procedure compiles fine.
    create or replace procedure MARKETING_FORM_2_7
    (ToAdd in Varchar2,
    FromAdd in Varchar2,
    Subject in Varchar2,
    SenderName in Varchar2,
    Branch in Varchar2,
    Phone in Varchar2,
    Address in Varchar2,
    Suggestion in Varchar2,
    SalesPromo in Varchar2,
    TradeshowPrep in Varchar2,
    SalesMaterials in Varchar2,
    DirectMail in Varchar2,
    CounterDays in Varchar2,
    BranchCustData in Varchar2,
    Other in Varchar2,
    ProjectName in Varchar2,
    Purpose in Varchar2,
    Audience in Varchar2,
    WhoPay in Varchar2,
    Deadline in Varchar2,
    Progress in Varchar2,
    EmployeeUpdate in Varchar2,
    WESCOWin in Varchar2,
    DescribeWin in Varchar2,
    PotentialValue in Varchar2,
    PartBranches in Varchar2,
    SignifPeople in Varchar2,
    SpecialFactors in Varchar2)
    is
    mailhost Varchar2(15) :='CLAPTON';
    mail_conn utl_smtp.connection;
    crlf varchar2(2):=chr( 13 )||chr( 10 );
    mesg varchar2(5000);
    begin
    mail_conn := utl_smtp.open_connection(mailhost,25);
    mesg:= 'From: <'||FromAdd||'>' ||crlf ||
    'To: '||ToAdd || crlf ||
    'Subject: '||Subject || crlf ||
    '' ||crlf||
    'Name: '||SenderName || crlf ||
    'Branch: '||Branch || crlf ||
    'Phone: '||Phone || crlf ||
    'Address: '||Address || crlf ||
    'Comment or Suggestion: ' || Suggestion || crlf ||
    'Sales Promotion Assistance: '|| SalesPromo || crlf ||
    'Tradeshow Assistance: '|| TradeshowPrep || crlf ||
    'Sales Materials or Presentations Assistance: '|| SalesMaterials || crlf ||
    'Direct Mail Assistance: '|| DirectMail || crlf ||
    'Counter Days Assistance: '|| CounterDays || crlf ||
    'Customer Database Assistance: '|| BranchCustData || crlf ||
    'Other: '|| Other || crlf ||
    'Project Name: '|| ProjectName|| crlf ||
    'Purpose: '|| Purpose || crlf ||
    'Indended Audience: '|| Audience || crlf ||
    'Who Will Pay?: ' || WhoPay || crlf ||
    'Deadline: '|| Deadline || crlf ||
    'Progress Made: ' || Progress || crlf ||
    'Mailing List Update: ' || EmployeeUpdate || crlf ||
    'WESCO Win: '|| WESCOWin || crlf ||
    'Win Description: ' || DescribeWin || crlf ||
    'Contract Value/Potential Sales: '|| PotentialValue || crlf ||
    'Participating Branches: '|| PartBranches || crlf ||
    'Significant Contributors: '|| SignifPeople || crlf ||
    'Special Factors: '|| SpecialFactors;
    utl_smtp.helo(mail_conn, mailhost);
    utl_smtp.mail(mail_conn, FromAdd);
    utl_smtp.rcpt(mail_conn, ToAdd);
    utl_smtp.data(mail_conn, mesg);
    utl_smtp.quit(mail_conn);
    end;

    Try executing the procedure independently (say from sqlplus) to see whether the procedure works fine.
    Alternatively, try commenting out the calls to the utl_smtp packages to see whether the procedure works.

  • Database selection with Invalid Cursor error in RSDRI_INFOPROV_READ

    Hi Everyone.
    I am using RSDRI_INFOPROV_READ Function module for reading data from a multiprovider.
    Logic of the code is as following
    while <more data>
    CALL RSDRI_INFOPROV_READ reading data in E_T_DATA
    Append lines of E_T_DATA to EO_T_DATA.
    If total lines of data in EO_T_DATA > 200000
    <save EO_T_DATA in a file using GUI_DOWNLOAD>
    <clear EO_T_DATA>
    EndIF
    EndWhile.
    As soon as number of record exceed 200000 first file is saved, but after that next data call results in error.
    Error says "Database selection with invalid cursor".
    I suspect that this because of call to FM GUI_DOWNLOAD. While calling this FM after RSDRI_INFOPROV_READ causes system to commit and again the cursor is tried to open in next call casuing it to fail.
    But it is imperative for me to save data in file at regular intervals as data volume is huge.
    Any pointers in this direction will be helpful.

    Hi Everyone.
    I am using RSDRI_INFOPROV_READ Function module for reading data from a multiprovider.
    Logic of the code is as following
    while <more data>
    CALL RSDRI_INFOPROV_READ reading data in E_T_DATA
    Append lines of E_T_DATA to EO_T_DATA.
    If total lines of data in EO_T_DATA > 200000
    <save EO_T_DATA in a file using GUI_DOWNLOAD>
    <clear EO_T_DATA>
    EndIF
    EndWhile.
    As soon as number of record exceed 200000 first file is saved, but after that next data call results in error.
    Error says "Database selection with invalid cursor".
    I suspect that this because of call to FM GUI_DOWNLOAD. While calling this FM after RSDRI_INFOPROV_READ causes system to commit and again the cursor is tried to open in next call casuing it to fail.
    But it is imperative for me to save data in file at regular intervals as data volume is huge.
    Any pointers in this direction will be helpful.

  • Oracle 10g EE Export Results in ORA-01001: invalid cursor Error

    Hi,
    I'm quite new to Oracle 10g and OCS10g. We have a crippled/corrupt SYSAUX tablespace (data file 3) which cannot be recovered using recover
    command anymore. So metalink support instructed us to do a export of the metadata of the working tablespace which contains our system data (we are in configuration stage for OCS 10g 10.1.2) via transportable tablespaces so that I can just recreate the database in DBCA and import the metadata. So after I made a cold backup, set the "transportable" tablespaces to "READ ONLY" mode, I proceeded w/ the export command which resulted in an error, please see below:
    $exp \'sys/********@ocs10gSID as sysdba\' parfile=transport.par
    Connected to: Oracle Database 10g Enterprise Edition Release 10.1.0.4.2 -
    Production
    With the Partitioning, Real Application Clusters, OLAP and Data Mining options
    Export done in US7ASCII character set and AL16UTF16 NCHAR character set
    server uses AL32UTF8 character set (possible charset conversion)
    Note: table data (rows) will not be exported
    About to export transportable tablespace metadata...
    EXP-00008: ORACLE error 1001 encountered
    ORA-01001: invalid cursor
    ORA-06512: at "SYS.DBMS_SYS_SQL", line 899
    ORA-06512: at "SYS.DBMS_SQL", line 19
    ORA-06512: at "SYS.DBMS_TTS", line 811
    ORA-00376: file 3 cannot be read at this time
    ORA-01110: data file 3: '/ocfs/oradata/OCS/datafile/o1_mf_sysaux_2mgzbr51_.dbf'
    ORA-06512: at "SYS.DBMS_PLUGTS", line 1444
    ORA-06512: at line 1
    Anyone encountered this problem before? Any recommendations or tips to get this working?
    I checked this url:"http://luhartma.blogspot.com/2006/05/how-to-check-if-tablespace-is.html"
    And when I try to follow the instructions and check on of the tablespace I set to and verified to be in "READ ONLY" mode, I get the same error.
    SQL> connect / as sysdba
    Connected.
    SQL> exec dbms_tts.TRANSPORT_SET_CHECK('PORTAL',TRUE)
    BEGIN dbms_tts.TRANSPORT_SET_CHECK('PORTAL',TRUE); END;
    ERROR at line 1:
    ORA-01001: invalid cursor
    ORA-06512: at "SYS.DBMS_SYS_SQL", line 899
    ORA-06512: at "SYS.DBMS_SQL", line 19
    ORA-06512: at "SYS.DBMS_TTS", line 811
    ORA-00376: file 3 cannot be read at this time
    ORA-01110: data file 3: '/ocfs/oradata/OCS/datafile/o1_mf_sysaux_2mgzbr51_.dbf'
    ORA-06512: at "SYS.DBMS_TTS", line 840
    ORA-06512: at line 1
    Hope someone can help on this or at least provide a suggestion. Data file 3 above is the reason we are doing a transportable tablespace export & db recreation.
    BTW what we have is:
    OCS 10g 10.1.2 w/ Oracle RDBMS 10g Enterprise Edition 10.1.0.4.2
    RHEL4 Update2
    Thanks in advance.
    Regards,
    -Kenth

    Hi,
    The status is "RECOVER" we have actually tried to recover but unfortunately the archive logs that were needed were on disks and were lost during one of the server hardware failures. Actually that is the reason why metalink support recommended this route for getting everything in order since we don't have any application data in SYSAUX yet.
    Thanks.

  • Getting Invalid Cursor Error

    Hi, I am having trouble with my code and it is generating an error in the alert logs and trace files. Can i ask for help?
    Fri Sep 02 19:20:33 2011
    Errors in file D:\oracle\dumps\prod_ora_5312.trc:
    ORA-00600: internal error code, arguments: [17281], [1001], [0x680CAB34], [], [], [], [], []
    ORA-01001: invalid cursor
    The trace file says:
    TraceFiles:
    Oracle process number: 20
    Windows thread id: 5312, image: ORACLE.EXE (SHAD)
    *** SERVICE NAME:(PROD) 2011-09-02 10:43:22.592
    *** SESSION ID:(133.14370) 2011-09-02 10:43:22.592
    *** 2011-09-02 10:43:22.592
    ksedmp: internal or fatal error
    ORA-00600: internal error code, arguments: [17281], [1001], [0x680CAB34], [], [], [], [], []
    ORA-01001: invalid cursor
    Current SQL statement for this session:
    declare  cursor NlsParamsCursor is    SELECT FROM nls_session_parameters;begin SELECT Nvl(Lengthb(Chr(65536)), Nvl(Lengthb(Chr(256)), 1)) INTO :CharLength FROM dual; for NlsRecord in NlsParamsCursor loop if NlsRecord.parameter = 'NLS_DATE_LANGUAGE' then :NlsDateLanguage := NlsRecord.value; elsif NlsRecord.parameter = 'NLS_DATE_FORMAT' then :NlsDateFormat := NlsRecord.value; elsif NlsRecord.parameter = 'NLS_NUMERIC_CHARACTERS' then :NlsNumericCharacters := NlsRecord.value; elsif NlsRecord.parameter = 'NLS_TIMESTAMP_FORMAT' then :NlsTimeStampFormat := NlsRecord.value; elsif NlsRecord.parameter = 'NLS_TIMESTAMP_TZ_FORMAT' then :NlsTimeStampTZFormat := NlsRecord.value; end if; end loop;end;*
    What is wrong with this code and how can i resolve this? Thanks!
    Edited by: gab-gab on Sep 2, 2011 7:36 PM

    maybe (bind variables :CharLength etc. belong to SQL not PL/SQL)
    declare
      cursor NlsParamsCursor is SELECT * FROM nls_session_parameters;
      CharLength number;
      NlsDateLanguage varchar2(40);
      NlsDateFormat varchar2(40);
      NlsNumericCharacters varchar2(40);
      NlsTimeStampFormat varchar2(40);
      NlsTimeStampTZFormat varchar2(40);
    begin
      SELECT Nvl(Lengthb(Chr(65536)), Nvl(Lengthb(Chr(256)), 1))
        INTO CharLength
        FROM dual;
      for NlsRecord in NlsParamsCursor
      loop
        if NlsRecord.parameter = 'NLS_DATE_LANGUAGE' then
          NlsDateLanguage := NlsRecord.value;
        elsif NlsRecord.parameter = 'NLS_DATE_FORMAT' then
          NlsDateFormat := NlsRecord.value;
        elsif NlsRecord.parameter = 'NLS_NUMERIC_CHARACTERS' then
          NlsNumericCharacters := NlsRecord.value;
        elsif NlsRecord.parameter = 'NLS_TIMESTAMP_FORMAT' then
          NlsTimeStampFormat := NlsRecord.value;
        elsif NlsRecord.parameter = 'NLS_TIMESTAMP_TZ_FORMAT' then
          NlsTimeStampTZFormat := NlsRecord.value;
        end if;
      end loop;
    end;Regards
    Etbin
    Edited by: Etbin on 3.9.2011 8:48
    comment about probable reason of the exception raised
    Edited by: Etbin on 4.9.2011 11:58
    or you had in mind this http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/expressions012.htm#i1033659

  • Invalid identified error in procedure

    hi
    I have a package that has a declare variable ,vfilename. I set the value of the variable vfilename to a file name for eg 'abc.txt' when the package scenario is callled. Now this file is the source for an interface that loads from this file to a target table. The interface has source datastore resource defined as a variable.
    After running this interface a procedure is called that will update a metadata table where the record has file_name col value=vfilename.
    to do this in the ODI procedure I am calling a plsql procedure as below
    Begin
    update_load_status(#vfilename)
    end;
    When this procedure runs I get an error as below
    904 : 42000 : java.sql.SQLException: ORA-00904: "abc"."TXT": invalid identifier
    If I call the procedure by hard coding the value i.e update_load_status('abc.txt'). It works fine.
    I have tried concat etc but still the value is not getting passed correctly and I am getting the invalid identified error. Is there a way to get around this?

    If you are saying this code -update_load_status('abc.txt'). work
    then call the variable this way
    Begin
    update_load_status('#vfilename');
    end;

  • Unexpected "ORA-01001: invalid cursor" error

    I have a Pro*C application that basically fetches from a cursor, does a bunch of work with that row, does a "delete from <table> where current of <cursor name>", then loops back, fetches, the next row, etc., and finally closes the cursor once all the rows have been processed.
    One of our clients is getting an 'ORA-01001' error on the "DELETE FROM <table> WHERE CURRENT OF <cursor>" statement. This is long-standing, frequently executed code at 100+ clients and I've never had a problem with this statement before. The client is consistently getting this error on a particular row from this cursor, but other rows processed with the same cursor are processing successfully.
    Unfortunately, I do not have direct access to the client's database, so I cannot debug directly, but I've placed print statements around the only place in my application's code that explicitly closes the cursor. A log generated on a run that threw the 1001 error confirmed that the cursor is NOT being explicitly closed by my application by an "EXEC SQL CLOSE <cursor>" statement.
    Likewise, I put print statements around all the COMMITs and ROLLBACKs in my application, and none of these showed in the logs either.
    My application does make a call to a client-customized PL/SQL function that they recently changed. However, I have a copy of the clients function and there are not any explicit COMMIT, ROLLBACK, ANALYZE, ALTER, DROP, REPLACE, TRUNCATE or CREATE statements that would implicitly commit and close the cursor.
    Here are potential problems that I have ruled out:
    -Oracle OPEN_CURSORS parameter - It appears that if this were the problem, the error would be an ORA-1000, not 1001. Please correct me if I am wrong here.
    -Pro*C MAXOPENCURSORS parameter - I compiled a version with a MAXOPENCURSORS value that is higher than the client's OPEN_CURSORS setting. If this were the problem, the error should have switched to the ORA-1000 error when I increased the parameter. It remained as an ORA-1001.
    Next steps:
    -What could cause a cursor to close other than explicit COMMIT, ROLLBACK, ANALYZE, ALTER, DROP, REPLACE, TRUNCATE or CREATE statements?
    -Is there anything I can run, such as a database trace, that will show me exactly when the cursor is being closed? I admittedly don't know a lot about DB traces.
    -Anything else I should check? Any other information I should provide?
    Thanks ahead of time for any help!

    Chandrakaanth Ramamurthy wrote:
    Does the client customized PL/SQL block contain EXIT
    Exit will end up issuing a commit and hence this could be an issue.Exit is not used in the customized function.
    Chandrakaanth Ramamurthy wrote:
    Also please check that commit and roll back are placed at the end of the loop.The only commit/rollback is after the loop is over is finished.
    I actually just figured out the issue. Turns out the cursor just hadn't been opened due to a very unique data condition... facepalm You know what happens when you assume things, right? :)
    Thanks for the help anyway!

  • Payables Open Interface Purge completes with error "Invalid Cursor"

    Hello,
    I'm trying to run Payables Open Interface Purge (version 115.8) and get an invalid cursor error in the beforereport trigger. Does anyone know the cause and remedy of this? A portion of the log is below. I've looked at the cursor and everything looks fine to me.
    MSG-00001: (Import_purge 1) Check control table for the purge process
    MSG-00001: (Check_control_table 1) Lock the control table
    MSG-00003: (Check_control_table 2) Fetch import_requests
    MSG-00004: (Check_control_table 3) Check concurrent program status
    MSG-00999: FUNCTION GET_REQUEST_STATUS ERROR, Reason:
    MSG-00999: FND_CONCURRENT.GET_REQUEST_STATUS<-Check_control_table<-Import_purge<- Before report trigger <- APXIIPRG
    MSG-00999: check_control_table<-Import_purge<- Before report trigger <- APXIIPRG
    MSG-00999: (Import_purge 1) Check control table for the purge process
    MSG-00999: Delete record in control table..
    MSG-00999: ORA-01001: invalid cursor
    REP-1419: 'beforereport': PL/SQL program aborted.
    Thank you.

    I'm trying to run Payables Open Interface Purge (version 115.8) and get an invalid cursor error in the beforereport trigger. Does anyone know the cause and remedy of this? A portion of the log is below. I've looked at the cursor and everything looks fine to me.
    MSG-00001: (Import_purge 1) Check control table for the purge process
    MSG-00001: (Check_control_table 1) Lock the control table
    MSG-00003: (Check_control_table 2) Fetch import_requests
    MSG-00004: (Check_control_table 3) Check concurrent program status
    MSG-00999: FUNCTION GET_REQUEST_STATUS ERROR, Reason:
    MSG-00999: FND_CONCURRENT.GET_REQUEST_STATUS<-Check_control_table<-Import_purge<- Before report trigger <- APXIIPRG
    MSG-00999: check_control_table<-Import_purge<- Before report trigger <- APXIIPRG
    MSG-00999: (Import_purge 1) Check control table for the purge process
    MSG-00999: Delete record in control table..
    MSG-00999: ORA-01001: invalid cursor
    REP-1419: 'beforereport': PL/SQL program aborted.11i: Payables Open Interface Invoice Import Troubleshooting Guide (APXIIMPT) [ID 107628.1] -- 3. Open Interface Import Purge Fails with ORA-01001: Invalid Cursor
    Thanks,
    Hussein

  • Invalid cursor problem

    Steve,
    Were you ever able to look at this item? In the meantime, my work around was to do a separate xsql query for each sub-query(cursor) and then append nodes in my DOM as I went along. But, I would like to help this tool be better. I think I have determined that if one of the sub-select/sub-cursor queries doesn't return anything, I get the "invalid cursor" error. Does that make sense to you? I think that if a the result should still be a blank node
    ( </NODE> ). What do you think?
    thanks,
    chad.
    -----Original Message-----
    From: Chad Small
    Sent: Friday, September 22, 2000 9:31 AM
    To: 'Steve Muench'
    Subject: RE: LONG data type and subsequent CURSOR's question/problem
    I attached two files:
    1. file with sql script - you'll have to change the schema.
    2. file with code. Two sections
    a. 1st with jdbc result set code
    b. 2nd with OracleXMLQuery
    I comment out one or the other code section to run one or the other.
    If you need any other information, please let me know.
    thanks,
    chad.
    -----Original Message-----
    From: Steve Muench [mailto:[email protected]]
    Sent: Thursday, September 21, 2000 4:14 PM
    To: Chad Small
    Subject: Re: LONG data type and subsequent CURSOR's question/problem
    Is it possible to send me CREATE TABLE script with one row
    of sample data inserted that reproduces the problem?
    Thanks.
    Steve Muench, Lead XML Evangelist & Consulting Product Manager
    BC4J & XSQL Servlet Development Teams, Oracle Rep to XSL WG
    Author "Building Oracle XML Applications", O'Reilly http://www.oreilly.com/catalog/orxmlapp/
    ----- Original Message -----
    From: "Chad Small" <[email protected]>
    To: "'Steve Muench'" <[email protected]>
    Sent: Thursday, September 21, 2000 3:56 PM
    Subject: RE: LONG data type and subsequent CURSOR's question/problem
    |
    | Using the same query string on both programs:
    |
    | String xsqlString =
    | "SELECT hwp.publish_document_id, hwp.topic_id, hwp.section_id,
    | hwp.body, " +
    | "CURSOR( SELECT hws.name as section_name " +
    | "FROM health.section hws " +
    | "WHERE hwp.section_id = hws.section_id) as section " +
    | "FROM health.publish_document hwp " +
    | "WHERE hwp.publish_document_id IN (13729, 1033, 11695)";
    | ____________________________________________________________________________
    | ______
    | This works - simple JDBC program :
    |
    | PreparedStatement stmt = conn.prepareStatement(xsqlString);
    | ResultSet rs = stmt.executeQuery();
    |
    | int n=1;
    | while( rs.next() ) {
    | System.out.println(n+": publish_document_id =
    | "+rs.getInt("publish_document_id"));
    | System.out.println(n+": topic_id = "+rs.getInt("topic_id"));
    | System.out.println(n+": section_id = "+rs.getInt("section_id"));
    | n++;
    | }
    | rs.close();
    | stmt.close();
    | conn.close();
    | ____________________________________________________________________________
    | ______
    | This does not work - simple OracleXMLQuery:
    |
    | OracleXMLQuery qry = new OracleXMLQuery(conn, xsqlString);
    | System.out.println("after\n");
    | // structure the generated XML document
    | qry.setMaxRows(1); // set the maximum number of rows to be returned
    | qry.setStyleSheet("file:D:\\xsql\\bin\\healthwise.xsl"); // sets the
    | stylesheet
    |
    | // get the XML document in string format
    | String xmlString = qry.getXMLString();
    |
    | // print out the XML document
    | System.out.println(" OUTPUT IS:\n"+xmlString);
    | conn.close();
    | ____________________________________________________________________________
    | _______
    | -> get this:
    |
    | OUTPUT IS:
    | <?xml version = '1.0'?>
    | <ERROR>oracle.xml.sql.OracleXMLSQLException: Stream has already been
    | closed</ERROR>
    |
    |
    | java.sql.SQLException: ORA-01001: invalid cursor
    |
    | at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:114)
    | at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
    | at oracle.jdbc.ttc7.Oclose.receive(Oclose.java:126)
    | at oracle.jdbc.ttc7.TTC7Pr otocol.close(TTC7Protocol.java:493)
    | at oracle.jdbc.driver.OracleStatement.close(OracleStatement.java:467)
    | at
    | oracle.jdbc.driver.OracleConnection.close_statements(OracleConnection.java:1
    | 141)
    | at oracle.jdbc.driver.OracleConnection.close(OracleConnection.java:537)
    | at com.healthecare.search.apelon.xmlquerydb.main(xmlquerydb.java:116)
    | at symantec.tools.debug.Agent.runMain(Native Method)
    | at symantec.tools.debug.MainThread.run(Agent.java:48)
    |
    |
    | Please advise.
    |
    | thanks,
    | chad.
    | -----Original Message-----
    | From: Steve Muench [mailto:[email protected]]
    | Sent: Thursday, September 21, 2000 1:46 PM
    | To: Chad Small
    | Subject: Re: LONG data type and subsequent CURSOR's question/problem
    |
    |
    | Are you able to test the query that does cause the
    | problem with:
    |
    | -> The command-line XSU utility
    | -> A simple JDBC program that creates a prepared statement
    | with this query and executes it to produce a result set
    |
    | I want to know if the problem is in JDBC or XSU.
    |
    | ______________________________________________________________
    | Steve Muench, Lead XML Evangelist & Consulting Product Manager
    | BC4J & XSQL Servlet Development Teams, Oracle Rep to XSL WG
    | Author "Building Oracle XML Applications", O'Reilly
    | http://www.oreilly.com/catalog/orxmlapp/
    |
    | ----- Original Message -----
    | From: "Chad Small" <[email protected]>
    | To: "'Steve Muench'" <[email protected]>
    | Sent: Thursday, September 21, 2000 1:09 PM
    | Subject: RE: LONG data type and subsequent CURSOR's question/problem
    |
    |
    | | The problem does NOT occur in (1) -simple query.
    | | And yes, the problem does occur in (2) - in combination with CURSOR.
    | |
    | | thanks,
    | | chad.
    | |
    | | -----Original Message-----
    | | From: Steve Muench [mailto:[email protected]]
    | | Sent: Thursday, September 21, 2000 11:44 AM
    | | To: Chad Small
    | | Subject: Re: LONG data type and subsequent CURSOR's question/problem
    | |
    | |
    | | Trying to isolate the problem a little...
    | |
    | | (1) Does the problem occur if you do a simple query like:
    | |
    | | SELECT body FROM table
    | |
    | | with just the LONG column?
    | |
    | | (2) Or does it only happen in combination with CURSOR() ?
    | |
    | | ______________________________________________________________
    | | Steve Muench, Lead XML Evangelist & Consulting Product Manager
    | | BC4J & XSQL Servlet Development Teams, Oracle Rep to XSL WG
    | | Author "Building Oracle XML Applications", O'Reilly
    | | http://www.oreilly.com/catalog/orxmlapp/
    | |
    | | ----- Original Message -----
    | | From: "Chad Small" <[email protected]>
    | | To: <[email protected]>
    | | Sent: Thursday, September 21, 2000 10:24 AM
    | | Subject: LONG data type and subsequent CURSOR's question/problem
    | |
    | |
    | | | Hello Steve,
    | | |
    | | | First I want to thank-you for all of the support you put into Oracle's
    | XML
    | | | board. I just ordered your book from Fatbrain and it's on back order!
    | I
    | | | tried asking my question on the board and didn't have any luck getting
    | any
    | | | responses - maybe people didn't understand my question. I'm desperate
    | for
    | | | this to work and really need some guidance.
    | | |
    | | | I'm using the command line to extract data from tables to XML
    | | | (.bin\xsql\bin\xsql healthwise.xsql chad.xml). Everything works
    | | wonderfully
    | | | until I add a LONG data type to the mix. Here is my xsql before the
    | LONG:
    | | |
    | | | <?xml version="1.0"?>
    | | | <!-- healthwise_xslt.xsql -->
    | | | <xsql:query
    | | | xmlns:xsql="urn:oracle-xsql"
    | | | connection="healthwise_dev2"
    | | | max-rows="22050" >
    | | |
    | | | SELECT hwp.publish_document_id, hwp.topic_id, hwp.section_id,
    | | | CURSOR( SELECT hws.name as section_name
    | | | FROM health.section hws
    | | | WHERE hwp.section_id = hws.section_id) as section,
    | | | CURSOR( SELECT hwk.name as keyword_name
    | | | FRO M health.keyword hwk, health.map_keyword_object
    | | | hwmko, health.object hwo
    | | | WHERE (hwp.publish_document_id =
    | | | hwo.publish_document_id) and
    | | | (hwo.object_id = hwmko.object_id) and
    | | | (hwmko.keyword_id = hwk.keyword_id) ) as keywords,
    | | | CURSOR( SELECT hwt.name as topic_name,
    | | | CURSOR( SELECT hwts.name as topic_synonym_name
    | | | FROM health.topic_synonym hwts
    | | | WHERE hwt.topic_id = hwts.topic_id) as
    | | | topic_synonyms,
    | | | CURSOR( SELECT hwc.name as catagory_name
    | | | FROM health.category hwc,
    | | health.map_category_topic
    | | | hwmct
    | | | WHERE (hwt.topic_id = hwmct.topic_id) and
    | | | (hwmct.category_id = hwc.category_id) ) as catagories
    | | | FROM health.topic hwt
    | | | WHERE hwp.topic_id = hwt.topic_id) as topic
    | | | FROM health.publish_document hwp
    | | | WHERE hwp.publish_document_id IN (13729, 1033, 11695)
    | | | </xsql:query>
    | | |
    | | |
    | | | I'm using this in combination with a XSLT and get this output -
    | Beautiful!
    | | -
    | | | just what I want, less my LONG body field :
    | | |
    | | | <?xml version="1.0" encoding="UTF-8"?>
    | | | <CONTENT>
    | | |
    | | |
    | |
    | <URL>http://healthecare140:7601/medical/medicalDocument.jsp?page=medical&#38
    | | | ;topic=10744&#38;item=7</URL>
    | | | <TITLE>Graft versus Host Disease</TITLE>
    | | | <RANK1>
    | | | <RANK1_DSCR>GVHD</RANK1_DSCR>
    | | | </RANK1>
    | | | <RANK2/>
    | | | <RANK3>
    | | | <RANK3_DSCR>Rare Disorders</RANK3_DSCR>
    | | | </RANK3>
    | | |
    | | |
    | |
    | <URL>http://healthecare140:7601/medical/medicalDocument.jsp?page=medical&#38
    | | | ;topic=910&#38;item=4</URL>
    | | | <TITLE>Hypnosis</TITLE>
    | | | <RANK1/>
    | | | <RANK2>
    | | | <RANK2_DSCR>Hypnotherapy</RANK2_DSCR>
    | | | </RANK2>
    | | | <RANK3/>
    | | |
    | | |
    | |
    | <URL>http://healthecare140:7601/medical/medicalDocument.jsp?page=medical&#38
    | | | ;topic=12344&#38;item=9</URL>
    | | | <TITLE>Low Back Problems -- Computerized axial tomography (CAT scan,
    | | | CT scan)</TITLE>
    | | | <RANK1>
    | | | <RANK1_DSCR>CT scan (computerized tomography),
    | | | back</RANK1_DSCR>
    | | | <RANK1_DSCR>CT scan, back</RANK1_DSCR>
    | | | <RANK1_DSCR>Back, CT scan of</RANK1_DSCR>
    | | | <RANK1_DSCR>Computed axial tomography (CAT) scan,
    | | | back</RANK1_DSCR>
    | | | </RANK1>
    | | | <RANK2/>
    | | | <RANK3/>
    | | | </CONTENT>
    | | |
    | | |
    | | | BUT, as soon as I add the LONG body field into the query (in BOLD):
    | | |
    | | | <?xml version="1.0"?>
    | | | <!-- healthwise_xslt.xsql -->
    | | | <xsql:query
    | | | xmlns:xsql="urn:oracle-xsql"
    | | | connection="healthwise_dev2"
    | | | max-rows="22050" >
    | | |
    | | | SELECT hwp.publish_document_id, hwp.topic_id, hwp.section_id,
    | hwp.body,
    | | | <--------- hwp.body is the LONG
    | | | CURSOR( SELECT hws.name as section_name
    | | | FROM health.section hws
    | | | WHERE hwp.section_id = hws.section_id) as section,
    | | | CURSOR( SELECT hwk.name as keyword_name
    | | | FROM health.keyword hwk, health.map_keyword_object
    | | | hwmko, health.object hwo
    | | | WHERE (hwp.publish_document_id =
    | | | hwo.publish_document_id) and
    | | | (hwo.object_id = hwmko.object_id) and
    | | | (hwmko.keyword_id = hwk.keyword_id) ) as keywords,
    | | | CURSOR( SELECT hwt.name as topic_name,
    | | | CURSOR( SELECT hwts.name as topic_synonym_name
    | | | FROM health.topic_synonym hwts
    | | | WHERE hwt.topic_id = hwts.topic_id) as
    | | | topic_synonyms,
    | | | CURSOR( SELECT hwc.name as catagory_name
    | | | FROM health.category hwc,
    | | health.map_category_topic
    | | | hwmct
    | | | WHERE (hwt.topic_id = hwmct.topic_id) and
    | | | (hwmct.category_id = hwc.category_id) ) as catagories
    | | | FROM health.topic hwt
    | | | WHERE hwp.topic_id = hwt.topic_id) as topic, hwp.body
    | | | <---------------- I tried it here too
    | | | FROM health.publish_document hwp
    | | | WHERE hwp.pu blish_document_id IN (13729, 1033, 11695)
    | | | </xsql:query>
    | | |
    | | |
    | | | I get this error:
    | | | oracle.xml.sql.OracleXMLSQLException: Stream has already been closed
    | | |
    | | |
    | | | However, this works:
    | | |
    | | | <?xml version="1.0"?>
    | | | <!-- healthwise_xslt.xsql -->
    | | | <xsql:query
    | | | xmlns:xsql="urn:oracle-xsql"
    | | | connection="healthwise_dev2"
    | | | max-rows="22050" >
    | | |
    | | | SELECT hwp.publish_document_id, hwp.topic_id, hwp.section_id, hwp.body
    | | | <--------- hwp.body is the LONG
    | | | FROM health.publish_document hwp
    | | | WHERE hwp.publish_document_id IN (13729, 1033, 11695)
    | | | </xsql:query>
    | | |
    | | |
    | | | Do I have to pull this out into code and stream the long into a string
    | and
    | | | build a DOM and then go to XML from that? Or something along those
    | lines?
    | | | And if this is the case, can you point me to some sample code.
    | | | I don't have the option of changing the LONG to something that doesn't
    | | have
    | | | to be streamed as suggested in this
    | | |
    | |
    | doc(http://technet.oracle.com/doc/oracle8i_816/java.816/a81354/basic4.htm).
    | | |
    | | |
    | | | If we can come to a conclusion on this, I will be the xsql-long
    | evangelist
    | | | on the board!
    | | |
    | | | Thank-you for you time,
    | | | chad. <[email protected]>
    | | |
    | | |
    | |
    |
    null

    Just wanted to post Steve's response to this question, in case others have problems with LONG data types and CURSORS in their .xsql queries (thanks Steve!):
    I can reproduce the problem with your testcase.
    I've filed Bug Number 1472008.
    You can workaround the problem by using CLOB
    instead of LONG in your table.
    You can use to TO_LOB() function in a CREATE TABLE...AS SELECT...
    or in an INSERT INTO TABLE...SELECT... to easily
    convert existing LONG content into CLOBs.
    null

  • In Ref cursor, user defined functions give "invalid column" error in EJB.

    Hello,
    I have written PL/SQL stored procedures/functions in Oracle 8i. They return the result set as a ref cursor.
    These procedures are accessed by EJB (weblogic) using Type 4 (100% Java) JDBC Driver.
    My problem is - if I use a user defined function to fetch a value in the select statement of the reference cursor, the EJB gives an error msg - invalid column name.
    If instead of using the function I get the value directly from the table, it works fine. Refer the code below :
    //In the PL/SQL function -
    //instead of writing :
    Open rc for
    Select empcode, empname
    from emp ;
    //If I write :
    Open rc for
    Select empcode, mypack.getempname(empcode)
    from emp ;
    //getempname(empcode) is a function in
    //in a package named 'mypack'
    //and returns name for empcode.
    //The java code gives error
    //error : invalid column name
    //While both are working fine and
    //returning currect result in SQL Navigator.
    Help me solve this mystery ?
    Thanks in advance.
    Swati.
    null

    Hi:
    When use inline Function to simplify the SQL statements, there is one thing that one should conside--Purity Level.
    if you create standalone stored pl/sql function. Oracle implicitly determines the PURITY level during compilation of the stored objects or at execution of an anonymous pl/sql block.
    if you implement Package inline Function( in your case),unlike standalone stored pl/sql functions, the PL?SQL Engine does not determine the purity level of package functions. Therefore, you must explicity assign the correct purity levels for the function to be called inline.
    the code like:
    create or replace package mypack is
    function getempname(empcode emp%empid%type)
    return varchar2;
    PRAGMA RESTRICT_REFERENCES(getempname,WNDS,WNPS,RNPS);
    end mypack;
    I think it can solve your problem if you use enough "pure"to be called inline function. Or you can create the standalone function to do it.
    good luck!
    Yali
    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Swati Agrawal ([email protected]):
    Hello,
    I have written PL/SQL stored procedures/functions in Oracle 8i. They return the result set as a ref cursor.
    These procedures are accessed by EJB (weblogic) using Type 4 (100% Java) JDBC Driver.
    My problem is - if I use a user defined function to fetch a value in the select statement of the reference cursor, the EJB gives an error msg - invalid column name.
    If instead of using the function I get the value directly from the table, it works fine. Refer the code below :
    //In the PL/SQL function -
    //instead of writing :
    Open rc for
    Select empcode, empname
    from emp ;
    //If I write :
    Open rc for
    Select empcode, mypack.getempname(empcode)
    from emp ;
    //getempname(empcode) is a function in
    //in a package named 'mypack'
    //and returns name for empcode.
    //The java code gives error
    //error : invalid column name
    //While both are working fine and
    //returning currect result in SQL Navigator.
    Help me solve this mystery ?
    Thanks in advance.
    Swati.
    <HR></BLOCKQUOTE>
    null

Maybe you are looking for

  • Wierd lines on my display and frequent lock-ups w/ and w/o display problems

    When booting I sometimes get weird lines and blocks on my display (the GRAY Apple screen) and then it hangs, other times the computer will boot and run fine for 20-30 minutes and then the display goes wonkers with blocks and lines and the computer do

  • Activate text for Cost Center for ME51N, ME52N, ME53N

    Hi, experts As a requirement on T/C ME51N, ME52N, ME53N is needed to activate on "Account assignment" tab, the text for Cost Center field, how can I do this? Thanks in advance. Is there any path or exit could help with it?

  • Printer help please

    Hi all I have two macs on a airport network and a printer connected to an Airport Express base station. Both macs can see the printer but the older iMac won't print to it. It says it has, but nothing comes out of the printer! Any ideas. Sorry if this

  • What can i do if my gift card has been cancelled but the bank take the money

    im from venezuela and i bought a gift card. the bank has cancelled my gift card and they has been taken with my money... what can i do in this case?

  • Release strategy in credit management

    Dear All, My client, wants to configure credit management in such way as For some say Rs 20000/- debit, some X shd release the blocked delivery document and for say rs Rs 50000/- debit, some X and Y shd release the blocked delivery document I hope I