Procedure Error (oracle 10.2.0.3.0)

Hi All,
I have created a procedure. but it's giving error while executin .please look into this.
create or replace PROCEDURE PR_LOAD_SMS
  IS
  BEGIN
     EXECUTE IMMEDIATE 'TRUNCATE TABLE DSS.FORT_HZM';
     EXECUTE IMMEDIATE '
     INSERT INTO DSS.FORT_HZM (CO_ID,FU_CODE,FU_DESC,SCODE,S_DES,AT_DT,SDN,CODELANG)
     SELECT
       CONTR_SERVICES.CO_ID                                         CO_ID,
       FU_PROFILE.FUCODE                                            FU_CODE,
       FU_PROFILE.FU_DESC                                           FU_DESC,
       CONTR_SERVICES.SCODE                                        SCODE,
       MPUSNTAB.DES                                                 S_DES,
       TO_DATE(SUBSTR(CONTR_SERVICES.CS_STAT_CHNG,-7,6),'YYMMDD') ACT_DT,
       CONTRACT_PHONENR.NUM                                         SDN,
       CCONTACT_ALL.CCLANGUAGE                                      CODELANG
     FROM
       SCS.CONTR_SERVICES        CONTR_SERVICES,
       SCS.FU_PROFILE            FU_PROFILE,
       SCS.MPUSNTAB              MPUSNTAB,
       DSS.CONTRACT_PHONENR       CONTRACT_PHONENR,
       SCS.CONTRACT_ALL          CONTRACT_ALL,
       SCS.CCONTACT_ALL          CCONTACT_ALL,
       SCS.FULKSN                FULKSN
     WHERE
       FULKSN.FUCODE = FU_PROFILE.FUCODE
       AND FULKSN.SCODE = CONTR_SERVICES.SCODE
       AND MPUSNTAB.SCODE = CONTR_SERVICES.SCODE
       AND CCONTACT_ALL.customer_id = CONTRACT_ALL.customer_id
       AND CONTRACT_ALL.co_id = CONTRACT_PHONENR.co_id
       AND CONTRACT_ALL.co_id = CONTR_SERVICES.co_id
       AND CONTRACT_PHONENR.co_id = CONTR_SERVICES.co_id
       AND CCONTACT_ALL.CCBILL = 'X'
       AND CONTR_SERVICES.CS_STAT_CHNG LIKE ('%a')
       AND FU_PROFILE.HZ_FLAG IS NOT NULL;
       AND SUBSTR (NVL (CONTR_SERVICES.CS_STAT_CHNG, 'a'), -1, 1) != 'd'
       AND CONTR_SERVICES.SCODE <> 4520 ;
     COMMIT;
  END PR_LOAD_SMS;Error:
LINE/COL ERROR
13/58    PLS-00103: Encountered the symbol "YYMMDD" when expecting one of
         the following:
         * & = - + ; < / > at in is mod remainder not rem return
         returning <an exponent (**)> <> or != or ~= >= <= <> and or
         like LIKE2_ LIKE4_ LIKEC_ between into using || multiset bulk
         member SUBMULTISET_Thank you

Hello,
Seems like lot of syntax error and why you want to execute as dynamic sql and not just simple straight forward insert statement. I tried to modified but verify see if it helps you anyway or just post exact insert stmt that you want to execute as dynamic sql.
CREATE OR REPLACE PROCEDURE PR_LOAD_SMS
IS
BEGIN
   EXECUTE IMMEDIATE 'TRUNCATE TABLE DSS.FORT_HZM';
   INSERT INTO DSS.FORT_HZM (CO_ID,
                             FU_CODE,
                             FU_DESC,
                             SCODE,
                             S_DES,
                             AT_DT,
                             SDN,
                             CODELANG)
      SELECT   CONTR_SERVICES.CO_ID CO_ID,
               FU_PROFILE.FUCODE FU_CODE,
               FU_PROFILE.FU_DESC FU_DESC,
               CONTR_SERVICES.SCODE SCODE,
               MPUSNTAB.DES S_DES,
               TO_DATE (
                  SUBSTR (CONTR_SERVICES.CS_STAT_CHNG, -7, 6),
                  '                                                         YYMMDD
                  ACT_DT,
               CONTRACT_PHONENR.NUM SDN,
               CCONTACT_ALL.CCLANGUAGE CODELANG
        FROM   SCS.CONTR_SERVICES CONTR_SERVICES,
               SCS.FU_PROFILE FU_PROFILE,
               SCS.MPUSNTAB MPUSNTAB,
               DSS.CONTRACT_PHONENR CONTRACT_PHONENR,
               SCS.CONTRACT_ALL CONTRACT_ALL,
               SCS.CCONTACT_ALL CCONTACT_ALL,
               SCS.FULKSN FULKSN
       WHERE       FULKSN.FUCODE = FU_PROFILE.FUCODE
               AND FULKSN.SCODE = CONTR_SERVICES.SCODE
               AND MPUSNTAB.SCODE = CONTR_SERVICES.SCODE
               AND CCONTACT_ALL.customer_id = CONTRACT_ALL.customer_id
               AND CONTRACT_ALL.co_id = CONTRACT_PHONENR.co_id
               AND CONTRACT_ALL.co_id = CONTR_SERVICES.co_id
               AND CONTRACT_PHONENR.co_id = CONTR_SERVICES.co_id
               AND CCONTACT_ALL.CCBILL =
                     '                                  X'
               AND CONTR_SERVICES.CS_STAT_CHNG LIKE ('%a')
               AND FU_PROFILE.HZ_FLAG IS NOT NULL
               AND SUBSTR (NVL (CONTR_SERVICES.CS_STAT_CHNG, 'a'), -1, 1) !=
                     'd'
               AND CONTR_SERVICES.SCODE = 4520;
   COMMIT;
END PR_LOAD_SMS;Regards
Edited by: OrionNet on Apr 17, 2009 12:39 AM

Similar Messages

  • External Procedure, Error Oracle-03113

    I have configured the database for external procedure: w/ the following:
    # TNSNAMES.ORA
    EXTPROC_CONNECTION_DATA =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = IPC)(Key = epsid))
    (CONNECT_DATA =
    (SID = extproc0)
    # LISTENER.ORA
    EXTERNAL_PROCEDURE_LISTENER =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = IPC)(KEY = epsid))
    SID_LIST_EXTERNAL_PROCEDURE_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (PROGRAM = extproc)
    (SID_NAME = extproc0)
    (ORACLE_HOME = c:\oracle\ora90)
    using the net manager, now when i try to test the extproc_connection_data(service naming) i am getting :
    Attempting to connect using userid: xxxxxxx
    The test did not succeed.
    ORA-03113: end-of-file on communication channel
    There may be an error in the fields entered,
    or the server may not be ready for a connection.
    any help would greatly be appreciated.
    rmp.

    Is your database up? I can get an ORA-3113 when I try to connect to an idle instance.

  • Stored procedure in oracle plsql giving Error

    Hi all,
    I want to create stored procedure in oracle.
    In that,I want to update if record is present in the table else want to insert that record in that table.
    Here is my stored proc which I write.
    I have very little knowledge about oracle(to be honest no knowledge).
    Below is my code and the purpose of this code is to insert/update the data based on the entry what ever the user makes in cognos report studio report view.
    Collapse | Copy Code
    create or replace
    PROCEDURE INSERTCOMMENTS
    N_HATID NUMBER
    , N_IN_NUMBER NUMBER
    , N_POINTS VARCHAR2 DEFAULT 255
    , N_QETYPE VARCHAR2 DEFAULT 255
    ) AS
    BEGIN
    IF((SELECT COUNT(*) FROM CCM_REPORT_USER.POINTS_QETYPE_COMMENTS
    WHERE CCM_REPORT_USER.POINTS_QETYPE_COMMENTS.HATID = N_HATID)=0)
    THEN (INSERT INTO "CCM_REPORT_USER"."POINTS_QETYPE_COMMENTS" (HATID, IN_NUMBER, POINTS, QETYPE)
    VALUES (N_HATID , N_IN_NUMBER , N_POINTS , N_QETYPE,));
    ELSE
    (UPDATE "CCM_REPORT_USER"."POINTS_QETYPE_COMMENTS" SET CCM_REPORT_USER.POINTS_QETYPE_COMMENTS.POINTS = N_POINTS
    AND CCM_REPORT_USER.POINTS_QETYPE_COMMENTS.QETYPE = N_QETYPE
    WHERE CCM_REPORT_USER.POINTS_QETYPE_COMMENTS.HATID = N_HATID)
    AND WHERE CCM_REPORT_USER.POINTS_QETYPE_COMMENTS.IN_NUMBER = N_IN_NUMBER)
    END IF;
    END INSERTCOMMENTS;

    948677 wrote:
    I want to create stored procedure in oracle.
    I have very little knowledge about oracle(to be honest no knowledge).If you are new to Oracle you should first be familiar with the manuals before writing code
    http://tahiti.oracle.com/
    For the latest version
    http://www.oracle.com/pls/db112/homepage
    And then start with *2 Day Developer's Guide*
    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10766/toc.htm
    SQL Language Reference
    http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/toc.htm
    Concepts
    http://download.oracle.com/docs/cd/E11882_01/server.112/e16508/toc.htm
    PL/SQL Language Reference
    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e17126/toc.htm
    And the Error Messages references for looking up the errors you will encounter when starting out
    http://download.oracle.com/docs/cd/E11882_01/server.112/e17766/toc.htm
    >
    In that,I want to update if record is present in the table else want to insert that record in that table.
    Here is my stored proc which I write.Once you know where the manuals are you would see that you would not write a stored procedure, you would use the MERGE command to do this
    http://docs.oracle.com/cd/E11882_01/server.112/e26088/statements_9016.htm#i2081218
    Which you can of course put in a stored procedure if you like.

  • How to call statement's execute function to execute procedure in Oracle?

    I made a very simple procedure in oracle logged as internal user.
    the procedure as the following:
    create or replace procedure temptest
    as
    begin
    insert into indextab(idx) values(100);
    commit;
    end temptest;
    in Java program,I use Oracle's jdbc driver to connect database, still connect as internal user.
    I can call statement.executeUpdate("insert into indextab(idx) values(100)"). and 100 row was added in database.
    then,I delete this row, try to run procedure in java,
    but the call of statement.execute("temptest") throw a exception
    the error message is:"java.sql.SQLException: ORA-00900: invalid SQL statement"
    then, I write the same procedure in sql server.
    all things work right.( I use jdbc-odbc bridge connect to sql server database)
    who can tell me what's the reason?
    I'm so urgent, please help me as soon as fast, thank you very much

    Instead of a Statement object, use a CallableStatement. CallableStatement is the JDBC wrapper for a stored proc. JDBC requires that the vendor specific call be wrapped in a {CALL ....}.
    So, your code would look like the following:
    Connection con = some connection;
    CallableStatement cs = con.prepareCall("{CALL temptest}");
    cs.execute();
    Take a look at the Javadoc. You can set both IN and OUT parameters using a CallableStatement.

  • ERROR: ORACLE prepare error: ORA-00936: missing expression

    Hello,
    I am required to run "pass-through" Oracle SQL, to extract data from tables into SAS for processing and manipulation. My code (attached) reads and writes (executes) but with zero records to test first. I cannot get past the Prepare Error.
    The query is very much like other queries that seem to work, but I cannot get past this prepare error. I have no other access to individauls with adequate knowledge of PL SQL, and as a last stop hoped others in the forum could quickly spot the source of errror.
    Thanks very much in advance for any assistance.
    Jeff
    1 ;*';*";*/;quit;run;
    2 OPTIONS PAGENO=MIN;
    3 %LET _CLIENTTASKLABEL=%NRBQUOTE(rx_biplr_v3_2);
    4 %LET _EGTASKLABEL=%NRBQUOTE(rx_biplr_v3_2);
    5 %LET _CLIENTPROJECTNAME=%NRBQUOTE();
    6 %LET _SASPROGRAMFILE=;
    7
    8 ODS _ALL_ CLOSE;
    NOTE: Some of your options or statements may not be supported with the Activex or Java series of devices. Graph defaults for these
    drivers may be different from other SAS/GRAPH device drivers. For further information, please contact Technical Support.
    9 OPTIONS DEV=ACTIVEX;
    10 FILENAME EGHTML TEMP;
    NOTE: Writing HTML(EGHTML) Body file: EGHTML
    11 ODS HTML(ID=EGHTML) FILE=EGHTML ENCODING='utf-8' STYLE=EGDefault
    11 ! STYLESHEET=(URL="file:///C:/Program%20Files/SAS/Shared%20Files/BIClientStyles/EGDefault.css")
    11 ! ATTRIBUTES=("CODEBASE"="http://www2.sas.com/codebase/graph/v91/sasgraph.exe") NOGTITLE NOGFOOTNOTE GPATH=&sasworklocation
    11 ! ;
    12
    13 %gaccessible;
    14 /********************************************************/
    15 * RX_BIPLR_V3.SAS ;
    16 /********************************************************/
    17
    18 dm 'log;clear;out;clear';
    19 options linesize =120;
    20 Option obs=0 NoReplace;
    21
    22 ****************************************************************************************;
    23 *Date Programmer Reviewed By WHAT WAS DONE;
    24 *----- -------------- ------------ -----------------------------------------;
    25 *2005 David Boyd Program creation for test population;
    26 *;
    27 *02/06/2006 Ivon Jones Modified to include total population;
    28 *;
    29 *07/20/2006 Ivon Jones Identified data elements for exclusion;
    30 * or inclusion for consolidation with ;
    31 * Robin's report;
    32 *;
    33 *08/18/2006 Ivon Jones Updated the Specific Therapeutic Classes;
    34 * 10-2009 J Shaf - modified to extract actual or potential Bipolar Dx from UBH and Medical Claims;
    35 ****************************************************************************************;
    36
    37
    38
    39 *%let allclmorgn = ('M','A') ; /* all claims origin code */
    40 %let begdate='01SEP2009'd;
    41 %let enddate='30SEP2009'd;
    42 %let q = %str(%') ;
    43
    44
    45 data _null_ ;
    46 call symput('fdos',put(intnx('month',"&begdate"d,-27,'beginning'), date9.) ) ;
    47 call symput('ldos',put(intnx('month',"&enddate"d,-0,'ending'), date9.) ) ;
    48 run ;
    NOTE: DATA statement used (Total process time):
    real time 0.00 seconds
    2 The SAS System 11:44 Friday, October 30, 2009
    cpu time 0.01 seconds
    49
    50
    51
    52 **************************************************************;
    53 * ??Use the data _null_ step to create a macro variable for the ;
    54 * year and month based on the ldos macro variable in the data ;
    55 * step above?? ;
    56 **************************************************************;
    57
    58
    59 data _null_ ;
    60 if month("&ldos"d) < 10
    61 then call symput('yr_mo',compress(year("&ldos"d) || '0' || month("&ldos"d) ) ) ;
    62 else call symput('yr_mo',compress(year("&ldos"d) || month("&ldos"d) ) ) ;
    63 run ;
    NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column).
    61:39 61:64 62:39 62:57
    NOTE: DATA statement used (Total process time):
    real time 0.00 seconds
    cpu time 0.00 seconds
    64
    65 *%put &biplr_dx;
    66 %put &begdate ;
    '01SEP2009'd
    67 %put &enddate ;
    '30SEP2009'd
    68 %put &fdos ;
    01JUN2007
    69 %put &ldos ;
    30SEP2009
    70 %put &q ;
    71
    72
    73 libname biplr'/home/jshafi01/projects/adhoc/biplr_dprsn/data';
    NOTE: Libref BIPLR was successfully assigned as follows:
    Engine: V9
    Physical Name: /home/jshafi01/projects/adhoc/biplr_dprsn/data
    74 libname rosdwp oracle user="&oracle_user." pass="&oracle_pass." buffsize=32767 path='rosdwp';
    NOTE: Libref ROSDWP was successfully assigned as follows:
    Engine: ORACLE
    Physical Name: rosdwp
    75
    76 data work.biplr_up_v1;
    77 attrib mbr_id length=$26;
    78 set biplr.biplr_ubh_med_v1;
    79 run;
    NOTE: There were 0 observations read from the data set BIPLR.BIPLR_UBH_MED_V1.
    NOTE: The data set WORK.BIPLR_UP_V1 has 0 observations and 1 variables.
    NOTE: DATA statement used (Total process time):
    real time 0.01 seconds
    3 The SAS System 11:44 Friday, October 30, 2009
    cpu time 0.00 seconds
    80
    81 proc contents;
    82 run;
    NOTE: PROCEDURE CONTENTS used (Total process time):
    real time 0.03 seconds
    cpu time 0.03 seconds
    83
    84 proc datasets
    85      library = rosdwp nolist;
    86      delete biplr_up_v1;
    87 quit;
    NOTE: Deleting ROSDWP.BIPLR_UP_V1 (memtype=DATA).
    NOTE: PROCEDURE DATASETS used (Total process time):
    real time 3.74 seconds
    cpu time 0.03 seconds
    88
    89 proc datasets
    90      library=work nolist;
    91      copy out = rosdwp move;
    92      select biplr_up_v1 ;
    93 quit;
    NOTE: Moving WORK.BIPLR_UP_V1 to ROSDWP.BIPLR_UP_V1 (memtype=DATA).
    NOTE: SAS variable labels, formats, and lengths are not written to DBMS tables.
    NOTE: There were 0 observations read from the data set WORK.BIPLR_UP_V1.
    NOTE: The data set ROSDWP.BIPLR_UP_V1 has 0 observations and 1 variables.
    NOTE: PROCEDURE DATASETS used (Total process time):
    real time 0.32 seconds
    cpu time 0.04 seconds
    94
    95
    96
    97 *****************************************************************************;
    98
    99 *execute(commit) by rosdwp
    100 ******************************************************************************;
    101
    102
    103 proc SQL noprint ;
    104 connect to oracle as rosdwp (user="&oracle_user." password="&oracle_pass" buffsize=32767 path='rosdwp'
    104 ! preserve_comments);
    105      execute(alter session set nls_date_format = 'ddmonyyyy') by rosdwp;
    106 CREATE table biplr_rx as
    107 SELECT
    108 mrb_id,
    109 pcp_spc,
    110 rx_date,
    4 The SAS System 11:44 Friday, October 30, 2009
    111 brand,
    112 generic,
    113 ahfs_cd,
    114 ahfs_dsc,
    115 lbl,
    116 strngth,
    117 unt,
    118 spc_tx_cls_cd,
    119 spc_tx_cls_dsc,
    120 gcn,
    121 rx_num,
    122 rx_ingrd,
    123 rx_paid,
    124 rx_cnt,
    125 rx_qty,
    126 rx_day
    127 FROM connection to rosdwp
    128 (SELECT
    129 mid.UNIQ_MBR_ID as mrb_id,
    130 pd.PRVDR_SPCLTY_DESC as pcp_spc,
    131 pcf.LAST_SRVC_DT as rx_date,
    132 dd.BRAND_NAME as brand,
    133 dd.GNRC_NAME as generic,
    134 dd.AHFS_THRPTC_CLS_CD as ahfs_cd,
    135 dd.AHFS_THRPTC_CLS_DESC as ahfs_dsc,
    136 dd.LABEL_NAME as lbl,
    137 dd.STRNGTH_NUM as strngth,
    138 dd.STRNGTH_UNIT_DESC as unt,
    139 dd.SPECF_THRPTC_CLS_CD as spc_tx_cls_cd,
    140 dd.SPECF_THRPTC_CLS_DESC as spc_tx_cls_dsc,
    141 dd.GCN_NUM as gcn,
    142 pcf.PRSCRPTN_NUM as rx_num,
    143 SUM(pcf.INGRDNT_AMT) as rx_ingrd,
    144 SUM(pcf.PD_AMT) as rx_paid,
    145 SUM(pcf.UNIT_SRVC_CNT) as rx_cnt,
    146 SUM(pcf.DSPNSD_QTY) as rx_qty,
    147 SUM(pcf.DAY_SUPLY_CNT) as rx_day
    148 FROM
    149 PHRMCY_CLM_FACT pcf,
    150 MBR_ID_DMNSN mid,
    151 DRUG_DMNSN dd,
    152 PRVDR_DMNSN pd,
    153           biplr_up_v1
    154 WHERE
    155 (
    156 (biplr_up_v1.mbr_id = MBR_ID_DMNSN.UNIQ_MBR_ID) And
    157 (PHRMCY_CLM_FACT.FINL_CLM_KEY = PHRMCY_FINL_CLM_DMNSN.FINL_CLM_KEY) AND
    158 (PHRMCY_CLM_FACT.MBR_KEY = MBR_ID_DMNSN.MBR_KEY) And
    159 (PHRMCY_CLM_FACT.BNFT_KEY = MBR_BNFT_DMNSN.BNFT_KEY) And
    160 (PHRMCY_CLM_FACT.DRUG_KEY = DRUG_DMNSN.DRUG_KEY) And
    161 (PHRMCY_FINL_CLM_DMNSN.CLM_ORGN_CD IN ('M','A')) AND
    162 (PHRMCY_CLM_FACT.LAST_SRVC_DT BETWEEN between &q.&fdos.&q and &q.&ldos.&q)
    163      )
    164 Group By
    165 mid.UNIQ_MBR_ID ,
    166 pd.PRVDR_SPCLTY_DESC ,
    167 pcf.LAST_SRVC_DT ,
    168 dd.BRAND_NAME ,
    5 The SAS System 11:44 Friday, October 30, 2009
    169 dd.GNRC_NAME ,
    170 dd.AHFS_THRPTC_CLS_CD ,
    171 dd.AHFS_THRPTC_CLS_DESC ,
    172 dd.LABEL_NAME ,
    173 dd.STRNGTH_NUM ,
    174 dd.STRNGTH_UNIT_DESC ,
    175 dd.SPECF_THRPTC_CLS_CD ,
    176 dd.SPECF_THRPTC_CLS_DESC ,
    177 dd.GCN_NUM ,
    178 pcf.PRSCRPTN_NUM
    179 );
    ERROR: ORACLE prepare error: ORA-00936: missing expression. SQL statement: SELECT mid.UNIQ_MBR_ID as mrb_id,
    pd.PRVDR_SPCLTY_DESC as pcp_spc, pcf.LAST_SRVC_DT as rx_date, dd.BRAND_NAME as brand, dd.GNRC_NAME as generic,
    dd.AHFS_THRPTC_CLS_CD as ahfs_cd, dd.AHFS_THRPTC_CLS_DESC as ahfs_dsc, dd.LABEL_NAME as lbl, dd.STRNGTH_NUM as
    strngth, dd.STRNGTH_UNIT_DESC as unt, dd.SPECF_THRPTC_CLS_CD as spc_tx_cls_cd, dd.SPECF_THRPTC_CLS_DESC as
    spc_tx_cls_dsc, dd.GCN_NUM as gcn, pcf.PRSCRPTN_NUM as rx_num, SUM(pcf.INGRDNT_AMT) as rx_ingrd, SUM(pcf.PD_AMT)
    as rx_paid, SUM(pcf.UNIT_SRVC_CNT) as rx_cnt, SUM(pcf.DSPNSD_QTY) as rx_qty, SUM(pcf.DAY_SUPLY_CNT) as rx_day
    FROM PHRMCY_CLM_FACT pcf, MBR_ID_DMNSN mid, DRUG_DMNSN dd, PRVDR_DMNSN pd, biplr_up_v1 WHERE (
    (biplr_up_v1.mbr_id = MBR_ID_DMNSN.UNIQ_MBR_ID) And (PHRMCY_CLM_FACT.FINL_CLM_KEY =
    PHRMCY_FINL_CLM_DMNSN.FINL_CLM_KEY) AND (PHRMCY_CLM_FACT.MBR_KEY = MBR_ID_DMNSN.MBR_KEY) And
    (PHRMCY_CLM_FACT.BNFT_KEY = MBR_BNFT_DMNSN.BNFT_KEY) And (PHRMCY_CLM_FACT.DRUG_KEY = DRUG_DMNSN.DRUG_KEY) And
    (PHRMCY_FINL_CLM_DMNSN.CLM_ORGN_CD IN ('M','A')) AND (PHRMCY_CLM_FACT.LAST_SRVC_DT BETWEEN between '01JUN2007'
    and '30SEP2009') ) Group By mid.UNIQ_MBR_ID , pd.PRVDR_SPCLTY_DESC , pcf.LAST_SRVC_DT , dd.BRAND_NAME ,
    dd.GNRC_NAME , dd.AHFS_THRPTC_CLS_CD , dd.AHFS_THRPTC_CLS_DESC , dd.LABEL_NAME , dd.STRNGTH_NUM ,
    dd.STRNGTH_UNIT_DESC , dd.SPECF_THRPTC_CLS_CD , dd.SPECF_THRPTC_CLS_DESC , dd.GCN_NUM , pcf.PRSCRPTN_NUM.
    NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
    180 execute (drop table biplr_up_v1) by rosdwp;
    NOTE: Statement not executed due to NOEXEC option.
    181 disconnect from rosdwp;
    NOTE: Statement not executed due to NOEXEC option.
    182 quit;
    NOTE: The SAS System stopped processing this step because of errors.
    NOTE: PROCEDURE SQL used (Total process time):
    real time 0.14 seconds
    cpu time 0.03 seconds
    183
    184

    Hello Again ,
    Wish Oracle was a bit more informative. Am using a SAS Institute Product called Enterprise Guide. A "hot fix" was installed to address an issue that the product appears unable to save the latest version of edited code changes (hence " BETWEEN between" remaining even after a prior edit). In any case, with the change, am now receiving this error:
    " ERROR: ORACLE prepare error: ORA-00904: "PHRMCY_CLM_FACT"."LAST_SRVC_DT": invalid identifier". (Log file appears below)
    -The error remains, regardless of whether one uses "pass through" code to pass the date range to Oracle (which looks ok from the log output below I believe), or if I hard code the date range into the PL SQL query itself.
    -The Prepare error always appears at end of the inner SELECT.
    -The Prepare error remains, with or without the GROUP BY clause.
    Is there anything else here I am missing? Someone suggested a reserve word - but from other ANSI SQL versions, I do not see that is the case. I have consulted SAS Tech Support and SAS List Serve at University of GA. but nothing definitive from these sources. Have requested facility to be able to run Oracle directly, outside this SAS Institute product - in process.
    Any suggestions are greatly appreciated. Thanks to everyone very much.
    Jeff
    14 /********************************************************/
    15 * RX_BIPLR_V3.SAS ;
    16 /********************************************************/
    17
    18 dm 'log;clear;out;clear';
    19 options linesize =120;
    20 Option obs=0 NoReplace;
    21
    22 ****************************************************************************************;
    23 *Date       Programmer         Reviewed By     WHAT WAS DONE;
    24 *-----      --------------     ------------    -----------------------------------------;
    25 *2005 D. Boyd Program creation for test population;
    26 *;
    27 *02/06/2006 I. Jones Modified to include total population;
    28 *;
    29 *07/20/2006 I. Jones Identified data elements for exclusion;
    30 * or inclusion for consolidation with ;
    31 * Robin's report;
    32 *;
    33 *08/18/2006 I Jones Updated the Specific Therapeutic Classes;
    34 * 10-2009 J Shaf - modified to extract actual or potential Bipolar Dx from UBH and Medical Claims;
    35 ****************************************************************************************;
    36
    37
    38
    39 *%let allclmorgn = ('M','A') ; /* all claims origin code */
    40 %let begdate='01SEP2009'd;
    41 %let enddate='30SEP2009'd;
    42 %let q = %str(%') ;
    43
    44
    45 data null ;
    46 call symput('fdos',put(intnx('month',"&begdate"d,-27,'beginning'), date9.) ) ;
    47 call symput('ldos',put(intnx('month',"&enddate"d,-0,'ending'), date9.) ) ;
    48 run ;
    2 The SAS System 12:46 Monday, November 2, 2009
    NOTE: DATA statement used (Total process time):
    real time 0.00 seconds
    cpu time 0.00 seconds
    49
    50
    51
    52 **************************************************************;
    53 * ??Use the data null step to create a macro variable for the ;
    54 * year and month based on the ldos macro variable in the data ;
    55 * step above?? ;
    56 **************************************************************;
    57
    58
    59 data null ;
    60 if month("&ldos"d) < 10
    61 then call symput('yr_mo',compress(year("&ldos"d) || '0' || month("&ldos"d) ) ) ;
    62 else call symput('yr_mo',compress(year("&ldos"d) || month("&ldos"d) ) ) ;
    63 run ;
    NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column).
    61:39 61:64 62:39 62:57
    NOTE: DATA statement used (Total process time):
    real time 0.00 seconds
    cpu time 0.01 seconds
    64
    65 *%put &biplr_dx;
    66 %put &begdate ;
    '01SEP2009'd
    67 %put &enddate ;
    '30SEP2009'd
    68 %put &fdos ;
    01JUN2007
    69 %put &ldos ;
    30SEP2009
    70 %put &q ;
    71
    72
    73 libname biplr'/home/jshafi01/projects/adhoc/biplr_dprsn/data';
    NOTE: Libref BIPLR was successfully assigned as follows:
    Engine: V9
    Physical Name: /home/jshafi01/projects/adhoc/biplr_dprsn/data
    74 libname rosdwp oracle user="&oracle_user." pass="&oracle_pass." buffsize=32767 path='rosdwp';
    NOTE: Libref ROSDWP was successfully assigned as follows:
    Engine: ORACLE
    Physical Name: rosdwp
    75
    76 data work.biplr_up_v1;
    77 attrib mbr_id length=$26;
    78 set biplr.biplr_ubh_med_v1;
    79 run;
    NOTE: There were 0 observations read from the data set BIPLR.BIPLR_UBH_MED_V1.
    NOTE: The data set WORK.BIPLR_UP_V1 has 0 observations and 1 variables.
    NOTE: DATA statement used (Total process time):
    real time 0.00 seconds
    cpu time 0.01 seconds
    80
    81 proc contents;
    82 run;
    NOTE: PROCEDURE CONTENTS used (Total process time):
    real time 0.02 seconds
    cpu time 0.02 seconds
    83
    84 proc datasets
    85      library = rosdwp nolist;
    86      delete biplr_up_v1;
    87 quit;
    NOTE: Deleting ROSDWP.BIPLR_UP_V1 (memtype=DATA).
    NOTE: PROCEDURE DATASETS used (Total process time):
    real time 0.61 seconds
    cpu time 0.01 seconds
    88
    89 proc datasets
    90      library=work nolist;
    91      copy out = rosdwp move;
    92      select biplr_up_v1 ;
    93 quit;
    NOTE: Moving WORK.BIPLR_UP_V1 to ROSDWP.BIPLR_UP_V1 (memtype=DATA).
    NOTE: SAS variable labels, formats, and lengths are not written to DBMS tables.
    NOTE: There were 0 observations read from the data set WORK.BIPLR_UP_V1.
    NOTE: The data set ROSDWP.BIPLR_UP_V1 has 0 observations and 1 variables.
    NOTE: PROCEDURE DATASETS used (Total process time):
    real time 0.15 seconds
    cpu time 0.04 seconds
    94
    95
    96
    97 *****************************************************************************;
    98
    99 *execute(commit) by rosdwp
    100 ******************************************************************************;
    101
    102
    103 proc SQL noprint ;
    104 connect to oracle as rosdwp (user="&oracle_user." password="&oracle_pass" buffsize=32767 path='rosdwp'
    104 ! preserve_comments);
    105      execute(alter session set nls_date_format = 'ddmonyyyy') by rosdwp;
    106 CREATE table biplr_rx as
    107 SELECT
    108 mrb_id,
    109 uniq_mbr_id,
    110 pcp_spc,
    111 rx_date,
    112 brand,
    113 generic,
    114 ahfs_cd,
    115 ahfs_dsc,
    116 lbl,
    117 strngth,
    118 unt,
    119 spc_tx_cls_cd,
    120 spc_tx_cls_dsc,
    121 gcn,
    122 rx_num,
    123 rx_ingrd,
    124 rx_paid,
    125 rx_cnt,
    126 rx_qty,
    127 rx_day
    128 FROM connection to rosdwp
    129 (SELECT
    130 mid.UNIQ_MBR_ID as uniq_mrb_id,
    131 blpr.mrb_id.mbr_id,
    132 pd.PRVDR_SPCLTY_DESC as pcp_spc,
    133 pcf.LAST_SRVC_DT as rx_date,
    134 dd.BRAND_NAME as brand,
    135 dd.GNRC_NAME as generic,
    136 dd.AHFS_THRPTC_CLS_CD as ahfs_cd,
    137 dd.AHFS_THRPTC_CLS_DESC as ahfs_dsc,
    138 dd.LABEL_NAME as lbl,
    139 dd.STRNGTH_NUM as strngth,
    140 dd.STRNGTH_UNIT_DESC as unt,
    141 dd.SPECF_THRPTC_CLS_CD as spc_tx_cls_cd,
    142 dd.SPECF_THRPTC_CLS_DESC as spc_tx_cls_dsc,
    143 dd.GCN_NUM as gcn,
    144 pcf.PRSCRPTN_NUM as rx_num,
    145 SUM(pcf.INGRDNT_AMT) as rx_ingrd,
    146 SUM(pcf.PD_AMT) as rx_paid,
    147 SUM(pcf.UNIT_SRVC_CNT) as rx_cnt,
    148 SUM(pcf.DSPNSD_QTY) as rx_qty,
    149 SUM(pcf.DAY_SUPLY_CNT) as rx_day
    150 FROM
    151 PHRMCY_CLM_FACT pcf,
    152 MBR_ID_DMNSN mid,
    153 DRUG_DMNSN dd,
    154 PRVDR_DMNSN pd,
    155      BIPLR_UP_V1 blpr
    156 WHERE
    157 (BIPLR_UP_V1.mbr_id = MBR_ID_DMNSN.UNIQ_MBR_ID) And
    158 (PHRMCY_CLM_FACT.FINL_CLM_KEY = PHRMCY_FINL_CLM_DMNSN.FINL_CLM_KEY) AND
    159 (PHRMCY_CLM_FACT.MBR_KEY = MBR_ID_DMNSN.MBR_KEY) And
    160 (PHRMCY_CLM_FACT.BNFT_KEY = MBR_BNFT_DMNSN.BNFT_KEY) And
    161 (PHRMCY_CLM_FACT.DRUG_KEY = DRUG_DMNSN.DRUG_KEY) And
    162 (PHRMCY_FINL_CLM_DMNSN.CLM_ORGN_CD IN ('M','A')) AND
    163 (PHRMCY_CLM_FACT.LAST_SRVC_DT BETWEEN &q.&fdos.&q and &q.&ldos.&q)
    164 );
    ERROR: ORACLE prepare error: ORA-00904: "PHRMCY_CLM_FACT"."LAST_SRVC_DT": invalid identifier. SQL statement: SELECT
    mid.UNIQ_MBR_ID as uniq_mrb_id, blpr.mrb_id.mbr_id, pd.PRVDR_SPCLTY_DESC as pcp_spc, pcf.LAST_SRVC_DT as
    rx_date, dd.BRAND_NAME as brand, dd.GNRC_NAME as generic, dd.AHFS_THRPTC_CLS_CD as ahfs_cd,
    dd.AHFS_THRPTC_CLS_DESC as ahfs_dsc, dd.LABEL_NAME as lbl, dd.STRNGTH_NUM as strngth, dd.STRNGTH_UNIT_DESC as
    unt, dd.SPECF_THRPTC_CLS_CD as spc_tx_cls_cd, dd.SPECF_THRPTC_CLS_DESC as spc_tx_cls_dsc, dd.GCN_NUM as gcn,
    pcf.PRSCRPTN_NUM as rx_num, SUM(pcf.INGRDNT_AMT) as rx_ingrd, SUM(pcf.PD_AMT) as rx_paid, SUM(pcf.UNIT_SRVC_CNT)
    as rx_cnt, SUM(pcf.DSPNSD_QTY) as rx_qty, SUM(pcf.DAY_SUPLY_CNT) as rx_day FROM PHRMCY_CLM_FACT pcf,
    MBR_ID_DMNSN mid, DRUG_DMNSN dd, PRVDR_DMNSN pd, BIPLR_UP_V1 blpr WHERE (BIPLR_UP_V1.mbr_id =
    MBR_ID_DMNSN.UNIQ_MBR_ID) And (PHRMCY_CLM_FACT.FINL_CLM_KEY = PHRMCY_FINL_CLM_DMNSN.FINL_CLM_KEY) AND
    (PHRMCY_CLM_FACT.MBR_KEY = MBR_ID_DMNSN.MBR_KEY) And (PHRMCY_CLM_FACT.BNFT_KEY = MBR_BNFT_DMNSN.BNFT_KEY) And
    (PHRMCY_CLM_FACT.DRUG_KEY = DRUG_DMNSN.DRUG_KEY) And (PHRMCY_FINL_CLM_DMNSN.CLM_ORGN_CD IN ('M','A')) AND
    (PHRMCY_CLM_FACT.LAST_SRVC_DT BETWEEN '01JUN2007' and '30SEP2009').
    NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
    165 execute (drop table biplr_up_v1) by rosdwp;
    NOTE: Statement not executed due to NOEXEC option.
    166 disconnect from rosdwp;
    NOTE: Statement not executed due to NOEXEC option.
    167 quit;
    NOTE: The SAS System stopped processing this step because of errors.
    NOTE: PROCEDURE SQL used (Total process time):
    real time 0.24 seconds
    cpu time 0.02 seconds
    168
    Edited by: user12142482 on Nov 2, 2009 4:02 PM

  • SQLException while calling a Stored Procedure in Oracle

    Hi all,
    I am getting this error while calling a Stored Procedure in Oracle...
    java.sql.SQLException: ORA-00600: internal error code, arguments: [12259], [], [
    at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:207)
    at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:540)
    at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1273)
    at oracle.jdbc.ttc7.TTC7Protocol.fetch(TTC7Protocol.java:780)
    at oracle.jdbc.driver.OracleResultSet.next(OracleResultSet.java:135)
    at StoredProcedureDemo.main(StoredProcedureDemo.java:36)
    The Program is ...
    import java.sql.*;
    public class StoredProcedureDemo {
         public static void main(String[] args) throws Exception {
              Connection con = null;
              ResultSet rs = null;
              Statement st = null;
              CallableStatement cs = null;
              int i;
              try {
                   Class.forName("oracle.jdbc.driver.OracleDriver");
                   con = DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:SHYAM","scott","tiger");
                   System.out.println("Got Connection ");
                   st = con.createStatement();
                   String createProcedure = "create or replace PROCEDURE Get_emp_names (Dept_num IN NUMBER) IS"
                             +" Emp_name VARCHAR2(10);"
                             +" CURSOR c1 (Depno NUMBER) IS"
                             +" SELECT Ename FROM emp WHERE deptno = Depno;"
                             +" BEGIN"
                             +" OPEN c1(Dept_num);"
                             +" LOOP"
                             +" FETCH c1 INTO Emp_name;"
                             +" EXIT WHEN C1%NOTFOUND;"
                             +" END LOOP;"
                             +" CLOSE c1;"
                             +" END;";
                   System.out.println("Stored Procedure is \n"+createProcedure);
                   i = st.executeUpdate(createProcedure);
                   System.out.println("After creating the Stored Procedure "+i);
                   cs = con.prepareCall("{call Get_emp_names(?)}");
                   System.out.println("After calling the Stored Procedure ");
                   cs.setInt(1,20);
                   System.out.println("Before executing the Stored Procedure ");
                   rs = cs.executeQuery();
                   System.out.println("The Enames of the given Dept are ....");
                   while(rs.next()) {
                        System.out.println("In The while loop ");
                        System.out.println(rs.getString(1));
              catch (Exception e) {
                   e.printStackTrace();
    Stored Procedure is ...
    create or replace PROCEDURE Get_emp_names (Dept_num IN NUMBER) IS
    Emp_name VARCHAR2(10);
    CURSOR c1 (Depno NUMBER) IS
    SELECT Ename FROM emp WHERE deptno = Depno;
    BEGIN
    OPEN c1(Dept_num);
    LOOP
    FETCH c1 INTO Emp_name;
    EXIT WHEN C1%NOTFOUND;
    END LOOP;
    CLOSE c1;
    END;
    Stored procedure is working properly on sql*plus(Oracle 8.1.5)) editor. But it is not working from a standalone java application. Can anyone please give me a solution.
    thanks and regards
    Shyam Krishna

    The first solution is to not do that in java in the first place.
    DDL should be in script files which are applied to oracle outside of java.
    Other than I believe there are some existing stored procedures in Oracle that take DDL strings and process them. Your user has to have permission of course. You can track them down via the documentation.

  • Calling stored procedure in Oracle forms

    I have a stored procedure in Oracle which is declared as follows in the package
    SFCS1.Company_Selection(O_Cursor IN OUT T_Cursor, cls IN Varchar2);
    Where T_Cursor is defined as a Ref Cursor
    From the Oracle forms I'm using the following code
    SFCS1.Company_Selection(A,my_cls);
    go_block('Block50');
    Execute_Query;
    I get the error message "FRM40505:Oracle Error: Unable to Perform Query". If I hardcode the value of my_cls in the query it runs properly. Any solutions will be really helpful
    Further to this, I want to put the single quotes around a value (for eg. 'A') from a variable. For instance I'm getting a value from my_cls and for the output I want to surround it with the single quotes, can somebody tell me how to do it.
    Thanks in advance

    This is a bit of a roundabout way to do it? Try setting up the block data source as procedure and set the values in the property palette of the data block.
    e.g.
    Query Data Source Type = Procedure
    Query Data Source Name = SFCS1.Company_Selection
    Query Data Source Columns = (Whatever columns/items you have in your datablock)
    Query Data Source Arguments = Argument names are your ref cursor and your variable.
    Check out basing data blocks on Ref Cursors.
    HTHs
    L :-)

  • How to Create a Stored Procedure in Oracle

    I try to create a very simple Stored Procedure from Oracle SQL Developer, got the following error. Can someone give me some help on this? I am new on this. Thanks.
    Error(4,1): PLS-00103: Encountered the symbol "BEGIN" when expecting one of the following: := ( ; not null range default character The symbol ";" was substituted for "BEGIN" to continue.
    create or replace PROCEDURE Test
    AS ACCESSTYP_ID ACCESSTYP.ACCESSTYPCD%TYPE
    BEGIN
         SELECT ACCESSTYPCD
         INTO ACCESSTYP_ID
         FROM ACCESSTYP
         WHERE ACCESSTYPCD = 'WWW';
    END;

    I found out I forgot to put ";" after the declare.
    How do I test it call this stored procedure from
    Oracle SQL Developer.
    create or replace PROCEDURE Test_VL
    AS ACCESSTYP_ID
    ACCESSTYP.ACCESSTYPCD%TYPE;
         SELECT ACCESSTYPCD
         INTO ACCESSTYP_ID
         FROM ACCESSTYP
         WHERE ACCESSTYPCD = 'WWW';
    END;in your SQL Developer window just enclosed your procedure with a Begin ... End.
      Begin
        Test_VL;
      End;

  • Stored procedure in Oracle 8.1.7.0

    HI,
    my oracle version is 8.1.7.0
    I've created this stored procedure:
    CREATE OR REPLACE procedure CREATE_TAB1
    IS
    SVUOTA VARCHAR2(64);
    PRAGMA AUTONOMOUS_TRANSACTION;
    err_num number;
    err_msg varchar2(100);
    BEGIN
    SVUOTA := 'TRUNCATE TABLE TAB1 REUSE STORAGE';
    EXECUTE IMMEDIATE SVUOTA;
    INSERT INTO TAB1
    SELECT "COD_IMM","PIANO","COD_RITMI","TOTAL_AREA","MAX_AREA"
    FROM (SELECT a.*,
    MAX(total_area) OVER (PARTITION BY cod_imm, piano) max_area
    FROM REP_02_TEST1 a
    where a.COD_RITMI not in ('04'))
    WHERE max_area = total_area;
    COMMIT;
    EXCEPTION
    WHEN OTHERS THEN
    err_msg:= SUBSTR(SQLERRM, 1, 100);
    err_num:= SQLCODE;
    INSERT INTO tab_error (proc_name, err_code, err_msg, err_date)
    VALUES ('CREATE_TAB1', err_num, err_msg, sysdate);
    COMMIT;
    END CREATE_TAB1;
    but when I compile I get this error
    PROCEDURE AFM.CREATE_TAB1
    On line: 14
    PLS-00103: Encountered the symbol "(" when expecting one of the following:
    , from
    the procedure stop on line:
    MAX(total_area) OVER (PARTITION BY cod_imm, piano) max_area
    I think that oracle version 8.1.7.0 not allow the code "OVER (PARTITION BY"
    I tried also with:
    EXECUTE IMMEDIATE 'INSERT INTO TAB1
    SELECT "COD_IMM","PIANO","COD_RITMI","TOTAL_AREA","MAX_AREA"
    FROM (SELECT a.*,
    MAX(total_area) OVER (PARTITION BY cod_imm, piano) max_area
    FROM REP_02_TEST1 a
    where a.COD_RITMI not in ('04'))
    WHERE max_area = total_area';
    but I get:
    PROCEDURE AFM.CREATE_TAB1
    On line: 16
    PLS-00103: Encountered the symbol "04" when expecting one of the following:
    How can I create my stored procedure with Oracle version 8.1.7.0
    Thank in advance!

    What is this code suppose to accomplish?
    Is this type of processing not possible using Global Temporary Tables?
    Oracle8i PL/SQL did not parse analytic functions correctly so you would have to make that SELECT a view and then SELECT from that view in PL/SQL.
    I tried also with:When you wrap the SELECT in EXECUTE IMMEDIATE you have to properly use the single quotes. The single quote that appears at this line:
    where a.COD_RITMI not in ('04'))is assumed by the compiler as the end of the string started by EXECUTE IMMEDIATE. That is not what you want.
    Please post some more details about the type of procesing that this code is suppose to accomplish so we can suggest alternatives to get it done better.

  • How to call a sql server stored procedure from oracle

    Hi all,
    Please anybody tell me how to call a sql server stored procedure from oracle.
    I've made an hsodbc connection and i can do insert, update, fetch data in sql server from oracle. But calling SP gives error. when I tried an SP at oracle that has line like
    "dbo"."CreateReceipt"@hsa
    where CreateReceipt is the SP of sql server and hsa is the DSN, it gives the error that "dbo"."CreateReceipt" should be declared.
    my database version is 10g
    Please help me how can i call it... I need to pass some parameters too to the SP
    thanking you

    hi,
    thank you for the response.
    when i call the sp using DBMS_HS_PASSTHROUGH, without parameters it works successfully, but with parameters it gives the following error
    ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
    [Generic Connectivity Using ODBC][Microsoft][ODBC SQL Server Driver]Invalid parameter number[Microsoft][ODBC SQL Server Driver]Invalid Descriptor Index (SQL State: S1093; SQL Code: 0)
    my code is,
    declare
    c INTEGER;
    nr INTEGER;
    begin
    c := DBMS_HS_PASSTHROUGH.OPEN_CURSOR@hsa;
    DBMS_HS_PASSTHROUGH.PARSE@hsa(c, 'Create_Receipt(?,?)');
    DBMS_HS_PASSTHROUGH.BIND_VARIABLE@hsa(c,1,'abc');
    DBMS_HS_PASSTHROUGH.BIND_VARIABLE@hsa(c,2,'xyz');
    nr:=DBMS_HS_PASSTHROUGH.EXECUTE_NON_QUERY@hsa(c);
    DBMS_HS_PASSTHROUGH.CLOSE_CURSOR@hsa(c);
    end;
    Create_Receipt is the sp which requires two parameters.
    please give me a solution
    thanking you
    sreejith

  • PLS-00306,problem while executing procedure from oracle e_comerce

    Hi
    I have writen a procedure in oracle.Tere i have a parameter with type varchar2.
    While i registered it in e_comerce i choosed the value set as 15characters.
    When i am runing the program from my ecomerce application it gives an error as below:
    ORACLE error 6550 in FDPSTP
    Cause: FDPSTP failed due to ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'PO_OUTPUT'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    there is no error when i am executing my procedure in toad/sql+ but this error comes only in e_comerce application.
    PLease tell what is the reason and what can be the solution?

    Hi,
    <p>
    The function has the following parameters:<br>
    function insertj(jnum j.j#%type, jname j.jname%type, city j.city%type)<br>
    where j# is varchar2(5), jname is varchar2(35) and city is varchar2(35)<br>.
    I was trying to insert the following values:<br>
    j#:='J11', jname:='JobName' and city:='Paris'.<br>
    </p>
    <p>
    The procedure just calls this function with the same parameters. It is very strange because it is hard to see what the problem is. The line 10 is return 0 in the function where I believe the error comes from. It starts in the procedure and then goes in the function body, if I am interpreting this right.
    </p>
    <p>
    Any idea?
    </p>
    Thanks!

  • USerhook in HR_APPRAISALS_BK2.Update_appraisal_B throwing Error oracle.jbo.

    Hi All,
    The USerhook in the HR_APPRAISALS_BK2.Update_appraisal_B throwing Error "oracle.jbo.RemoveWithDetailsException: JBO-26019: Attempting to remove a parent entity without removing all children entities"
    We wrote a custom logic to throw error on the application in the Update Apprisals Page.
    The custom package is placed in the HR_APPRAISALS_BK2.Update_appraisal_B procedure
    create or replace PACKAGE BODY XX_APPR_HOOK_PKG
    PROCEDURE XX_APPR_HOOK_PRC (p_appraisal_id IN NUMBER)
    AS
    CURSOR APPRAISAL_DETAIL
    IS
    SELECT person_id
    FROM per_all_assignments_f
    WHERE supervisor_id = (SELECT APPRAISEE_PERSON_ID
    FROM PER_APPRAISALS
    WHERE APPRAISAL_ID = p_appraisal_id)
    and trunc(sysdate) between effective_start_date and effective_end_date;
    l_message VARCHAR2(3000) ;
    APPID NUMBER (30);
    APPSTATUS VARCHAR2 (30);
    l_names VARCHAR2(200) ;
    l_msg varchar2(500);
    l_cntr number:=0;
    BEGIN
    l_message :='Kindly close the appraisal for the following employees ';
    debug('1Hello1');
    debug('2Hello1'||p_appraisal_id);
    FOR J IN APPRAISAL_DETAIL
    LOOP
    debug('3Hello Inside loop'||J.PERSON_ID);
    APPSTATUS := null;
    BEGIN
    SELECT MAX (APPRAISAL_ID)
    INTO APPID
    FROM PER_APPRAISALS
    WHERE APPRAISEE_PERSON_ID = J.PERSON_ID;
    EXCEPTION
    WHEN OTHERS THEN
    APPID :=null;
    END;
    debug('4Hello after APPID'||J.PERSON_ID||'_'||APPID);
    BEGIN
    SELECT APPRAISAL_SYSTEM_STATUS
    INTO APPSTATUS
    FROM PER_APPRAISALS
    WHERE appraisal_id = APPID;
    EXCEPTION
    WHEN OTHERS THEN
    APPSTATUS:=null;
    END;
    debug('5Hello after APPSTATUS_'||J.PERSON_ID||APPSTATUS);
    BEGIN
    select (last_name ||' '|| first_name) employee_name,employee_number
    into l_emp_name,l_emp_number
    from per_all_people_f where person_id = J.PERSON_ID
    and trunc(sysdate) between effective_start_date and effective_end_date ;
    EXCEPTION
    WHEN OTHERS THEN
    l_emp_name :=null;
    l_emp_number:=null;
    END;
    debug('6Hello after l_emp_name'||J.PERSON_ID||l_emp_number);
    IF (APPSTATUS <> 'COMPLETED' or APPSTATUS is null)
    THEN
    l_cntr :=l_cntr +1;
    l_msg := l_msg ||l_cntr||') '||l_emp_name||' '||l_emp_number||' ';
    END IF;
    END LOOP;
    IF (l_cntr<>0 ) THEN
    debug('9_Inside l_cntr<>0 ');
    hr_utility.set_message(800, 'XX_APPRAISAL_USER_HOOK_MSG');
    hr_utility.set_message_token( 'XX_TOKEN',l_msg);
    hr_utility.raise_error;
    END IF;
    End XX_APPR_HOOK_PRC;
    END 'XX_APPR_HOOK_PKG;
    And ran the pre-processor,but still recieving the same error.
    Using the Debug procedure,I am inserting the debugmessages into table.
    It is inserting all the debug messages correctly.
    If I delete the api hook call using hr_api_hook_call_api.delete_api_hook_call, and then do the transaction it is not dispaying any error.
    but once i create the userhook using below code, it is displaying the error "oracle.jbo.RemoveWithDetailsException: JBO-26019: Attempting to remove a parent entity without removing all children entities"
    declare
    l_api_hook_call_id number;
    l_object_version_number number;
    begin
    hr_api_hook_call_api.create_api_hook_call
    (p_validate => false,
    p_effective_date => to_date('01-jan-2000','dd-mon-yyyy'),
    p_api_hook_id => 2925,
    p_api_hook_call_type => 'PP',
    p_sequence => 3000,
    p_enabled_flag => 'Y',
    p_call_package =>'XX_APPR_HOOK_PKG',
    p_call_procedure => 'XX_APPR_HOOK_PRC',
    p_api_hook_call_id => l_api_hook_call_id,
    p_object_version_number => l_object_version_number);
    COMMIT;
    end;
    Please let me know how to resolves this issue.
    Thanks,
    Anuradha

    Kindly help.

  • SQL Server Procedures to Oracle Functions

    Is there an option in the Migration Assistant 1.2.0 that will convert the SQL Server procedures into Oracle Functions (rather than procedures)?
    By default the T/SQL procedures return a integer status code. Our middle-tier requires calls to procedures to return a status code (integer), and I'd like the migration to modify the "procedure" to a "Function returning Integer" rather than Procedure.

    Thomas,
    This is not an option currently. We will look into this for a future release. You could manually make the changes post conversion, prior to generation. As well as adding appropriate RETURN statements, you may want to add additional exception handling so the appropriate error is passed back.
    Donal

  • Need sample source code for calling stored procedure in Oracle

    Hi.
    I try to call stored procedure in oracle using JCA JDBC.
    Anybody have sample source code for that ?
    Regards, Arnold.

    Thank you very much for a very quick reply. It worked, but I have an extended problem for which I would like to have a solution. Thank you very much in advance for your help. The problem is described below.
    I have the Procedure defined as below in the SFCS1 package body
    Procedure Company_Selection(O_Cursor IN OUT T_Cursor)
    BEGIN
    Open O_Cursor FOR
    SELECT CompanyId, CompanyName
    FROM Company
    WHERE CompanyProvince IN ('AL','AK');
    END Company_Selection;
    In the Oracle Forms, I have a datablock based on the above stored procedure. When I execute the form and from the menu if I click on Execute Query the data block gets filled up with data (The datablock is configured to display 10 items as a tabular form).
    At this point in time, I want to automate the process of displaying the data, hence I created a button and from there I want to call this stored procedure. So, in the button trigger I have the following statements
    DECLARE
    A SFCS1.T_Cursor;
    BEGIN
    SFCS1.Company_Selection(A);
    go_Block ('Block36');
    The cursor goes to the corresponding block, but does not display any data. Can you tell me how to get the data displayed. In the future versions, I'm planning to put variables in the WHERE clause.

  • Execute PROCEDURE in ORACLE

    I try to execute procedure on ORACLE(8i) but get err SQLException ..
    but for SELECT UPDATE INSERT statements all is OK!!
    for SELECT, UPDATE, INSERT I wrote such code:
    Statement stmt = conn.createStatement();
    String strExec="SELECT ...."
    stmt.executeQuery(strExec); (OR stmt.executeUpdate(strExec);)for proceure I wrote
    strExec = " my_proc() ";
    stmt.execute(strExec);what is wrong here??

    Try like this,
    CallableStatement cstm = con.prepareCall("{ call my_proc }");
    cstm.executeUpdate();
    Sudha

Maybe you are looking for