WHENEVER SQLERROR EXIT SQL.SQLCODE||SQLERRM  & Relate ORA-ERRNO & SQLCODE

Hi,
Is there any way to pass both the SQL.SQLCODE & SQLERRM to the os back ??
When I tried WHENEVER SQLERROR EXIT SQL.SQLCODE
The actual oracle error code (ORA-00942) and the error code (174 ) returned by SQL.SQLCODE are different . So how can I get the info. that is related to SQL.SQLCODE
eg :
For this test program
rm -f /home/etladm/test/test.log
sqlplus -S <<EOF >> /home/etladm/test/test.log
ranjeeshk/ics
set verify on time on timing on term on echo on feedback on serveroutput on
WHENEVER SQLERROR EXIT SQL.SQLCODE
-- WHENEVER SQLERROR EXIT SQLERRM
select sysdate sdate from dua;
exit 1
EOF
echo "Number of rows are: $?" >> /home/etladm/test/test.log
echo " -------- Log file -------- \n"
cat /home/etladm/test/test.log
The output was
etladm@stdwdev2:/home/etladm/test>. ./test.ksh
-------- Log file --------
select sysdate sdate from dua
ERROR at line 1:
ORA-00942: table or view does not exist
Number of rows are: 174
etladm@stdwdev2:/home/etladm/test>
So how can I link ORA-00942 and SQLCODE 174 ?
with thanks in advance
Ranjeesh K R

From the Oracle documentation:
<quote>
The range of operating system return codes is also restricted on some operating systems. This limits the portability of EXIT n and EXIT variable between platforms. For example, on UNIX there is only one byte of storage for return codes; therefore, the range for return codes is limited to zero to 255.
</quote>

Similar Messages

  • How to use the WHENEVER SQLERROR EXIT statement in a PL/SQL block.

    Hi,
    I am getting the following error when trying to add the following statement in an PL/SQL block.
    WHENEVER SQLERROR EXIT SQL.SQLCODE
    [exec] ERROR at line 23:
    [exec] ORA-06550: line 23, column 12:
    [exec] PLS-00103: Encountered the symbol "SQLERROR" when expecting one of the
    [exec] following:
    [exec] := . ( @ % ;
    How can i use the above statement in the PL/SQL Block? I have only IF statement in that block( between BEGIN and END).
    Thanks

    Hi,
    Usually there's always more than one solution.
    Can you post an example of what you're trying to accomplish?
    That would be useful.
    (Place the tag before and after your example to maintain formatting en spacing, see the [fac|http://forums.oracle.com/forums/help.jspa] regarding available tags)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Whenever sqlerror exit failure rollback in IDE's

    Hi all,
    Sorry to cross-post, but there is a tendancy for people who have a bunch of Expertise in SQL/PL/SQL to not check other forums all that often so I am hoping for more results here.
    I've started a thread over here:
    deployment scripts with "exit failure rollback"
    The basic problem is that when I have a SQLplus script with
    whenever sqlerror exit failure rollbackBut when this is executed through an IDE like toad or SQL developer the IDE appears to ignore the exit command and continues executing the script regardless of any errors.
    Has anyone encountered this problem previously and have a solution? or must I beat my deployment manager over the head to convince him to always use SQLPlus for database deployments?

    WhiteHat wrote:
    Hi all,
    Sorry to cross-post, but there is a tendancy for people who have a bunch of Expertise in SQL/PL/SQL to not check other forums all that often so I am hoping for more results here.
    I've started a thread over here:
    deployment scripts with "exit failure rollback"
    The basic problem is that when I have a SQLplus script with
    whenever sqlerror exit failure rollbackBut when this is executed through an IDE like toad or SQL developer the IDE appears to ignore the exit command and continues executing the script regardless of any errors.
    Has anyone encountered this problem previously and have a solution? or must I beat my deployment manager over the head to convince him to always use SQLPlus for database deployments?"WHENEVER" is sqlplus (only) syntax.
    Either only code to work with any/every client or only use sqlplus

  • Whenever sqlerror exit failure - what value is failure ?

    I have a sql*plus script file that is run from a batch file on windows. The script file starts with whenever sqlerror exit failure; But what error value is returned for failure on windows ?
    SQL*Plus documentation simply says it's "operating-system dependent values", but I can't find any other documentation saying what these values are!
    By trial & error it seems to return 1 on windows, so sets the ERRORLEVEL to 1 within the batch file.
    But are the values that SQL*Plus will return actually documented anywhere ?

    I don't remember ever seeing them documented, but they are the standard error codes for whatever OS you're using. At one time, windows help listed the error codes: 0=good, 1=failure, 2=warning; but I can't find that anymore either. and since the values are different by OS, another option is to exit with a specific value
    whenever sqlerror exit 4
    then you script becomes more portable, and you don't need to worry about changing errorcodes.

  • WHENEVER SQLERROR Problem

    Below is my sql saved as testing.sql
    SET PAGESIZE 0
    WHENEVER SQLERROR EXIT SQL.SQLCODE;
    WHENEVER OSERROR EXIT SQL.OSCODE;
    SPOOL /u021/idaho/load_scripts/ebiz_ctgry_prodfam/build_ebiz_ctgry_prodfam_1.og
    select
    productid,
    categoryid,
    sequence,
    inherit
    from site.categoryproduct@TO_EBIZ_DBLINK1
    SPOOL OFF
    exit
    The issue is that code is working as expected on AIX but not on SUN Solaris, here the DBLINK used is invalid one and the select should fail.
    AIX Server output:*
    sqlplus -s userid/password @testing.sql
    from site.categoryproduct@TO_EBIZ_DBLINK1
    ERROR at line 13:
    ORA-02019: connection description for remote database not found
    113620 spss7a04:/u021/idaho/load_scripts/ebiz_ctgry_prodfam> echo $?
    *227*
    Solarix Server output:*
    from site.categoryproduct@TO_EBIZ_DBLINK1
    ERROR at line 13:
    ORA-02019: connection description for remote database not found
    4143 v08k44:/u021/idaho/load_scripts/ebiz_ctgry_prodfam> echo $?
    *0*
    The question is why in solaris $? returning 0. I have also tried WHENEVER SQLERROR EXIT FAILURE ; option but even that is not working. Also any help in fixing this would be appreciated.

    It doesn't have to be 'EOF', it can be any token (I know that doesn't help you here).
    I don't know if there's any other option for you here, I've always found it good practice to use a terminating token regardless of the particular shell. It seems you are going to have to make a change to get this to port properly in any case, so you may have no choice, however laborious that might be.
    Edit you may be better asking this question in a shell scripting forum, for example: [http://www.unix.com/shell-programming-scripting/], and in which case you can close this one off.

  • WHENEVER SQLERROR does not work for remote db?

    Hi,
    I've encountered a problem that an error on a remote db (called via db link) does not force SQL*PLUS to exit and report the error.
    Local machine: Sun Solaris
    Local db: 8.1.7.2
    Remote machine: Windows NT, 2000 or XP (I don't know).
    Remote db: 9.2.0.5
    Call to SQL*PLUS: sqlplus /NOLOG @$BASE_DIR/tools/bin/xxx.sql
    Relevant piece of code in xxx.sql:
    connect cemis/cemis@loc9280
    whenever sqlerror exit SQL.SQLCODE
    set heading off
    set trimspool on
    SET PAGES 0
    SET LINESI 250
    SET ECHO OFF
    SET VERIFY OFF
    set termout off
    set feedb off
    set recsep off
    rem *** Do the work ***
    whenever sqlerror exit SQL.SQLCODE
    rem Get rid of old data
    TRUNCATE TABLE local_table;
    rem fill table via db-link
    INSERT INTO local_table
    col1,
    col2
    SELECT
    rem_col1,
    rem_col2
    FROM rem_user.rem_table@dbl_name
    COMMIT;
    spool file.csv
    SELECT 'Spalte1' || chr(9) || 'Spalte2'
    FROM dual;
    SELECT col1, col2 FROM local_table;
    spool off
    exit 0
    In our environment the script runs through without any error. After execution the file.csv is not there. No errors in the log file.
    I tried to select data from the remote db manually and ran into this:
    'ORA-01017: invalid username/password; logon denied' followed by
    'ORA-02063: preceding line from dbl_name'.
    Do you have any idea why this error does not cause sql*plus to exit?
    Does the WHENEVER... only work properly with local errors?
    I would be grateful for any information regarding this.
    Regards,
    Guido

    I believe this is a limitation in SP3, but tell me, are you running with a simple producer or a complex producer?

  • WHENEVER SQLERROR question

    I want a script to exit when it executes successfully and to stop when there is a error, so instead of WHENEVER SQLERROR EXIT, I want something like WHENEVER SQLERROR CONTINUE, ELSE EXIT.
    How can it be done?

    "whenever sqlerror continue" does exist and works.
    If you want to exit after the whole script is done, just add "exit"
    as the last line.
    Exiting after one successfull statement when others are following is not possible.

  • WHENEVER SQLERROR and 11.2.0.2.0 client

    Hi,
    Facing one issue which am not to understand further.
    One of the file say 'config.tmp' has a variable defined as follows:
    define termout = 'on';
    define SQLErrorHandling = 'continue none';In another sql file say 'myfile.sql' I read the above file as @config.tmp and then try to fetch the variable value as follows:
    @config.tmp
    execute DBMS_OUTPUT.PUT_LINE('&SQLErrorHandling');
    whenever sqlerror &SQLErrorHandling;
    set termout &termout;But am getting following error
    SQL> @myfile;
    continue none
    Usage: WHENEVER SQLERROR
         { CONTINUE  [ COMMIT | ROLLBACK | NONE ]
         | EXIT  [ SUCCESS | FAILURE | WARNING | n | <variable> | :<bindvariable> ]
                 [ COMMIT | ROLLBACK ] }
    SQL>Looks like it fails to replace the variable '&SQLErrorHandling' value. However value of '&termout' variable gets fetched.
    This issue is not seen when 11.1.0.6.0 client is used. Only when the client version is 11.2.0.2.0 am facing this issue.
    Any suggestions?
    Regards,
    Neuron
    p.s.: earlier asked this question under PL/SQL section but no helpful responses.

    Thanks guys for your replies, please find my comments so far.
    I don't understand why you have a call to execute DBMS_OUTPUT ... this is not the place for it. Write to a log file or echo to the terminal window.Thanks 'damorgan', however DBMS_OUTPUT was added from debugging perspective, to check if the value is being fetched or not. Btw that's not the intent of my post and business logic too, what am trying to figure out is why if throws 'Usage: WHENEVER SQLERROR' error only when am connected with 11.2.0.2.0 client. If you help to provide some pointers here, that will be really great.
    if you GOOGLE "SQLErrorHandling" you get a number of hits for TSQL & none for Oracle.Thanks 'SB' but sorry I did not understand your comments. Not sure why you want to GOOGLE 'SQLErrorHandling' but you can check this [url http://docs.oracle.com/cd/B19306_01/server.102/b14357/ch12052.htm]link.
    Any suggestions for usage errors?
    Regards,
    Neuron
    Edited by: Neuron on Jan 24, 2013 12:30 PM
    Edited by: Neuron on Jan 24, 2013 12:34 PM

  • Problems with WHENEVER SQLERROR

    I'm creating a PRO C application, and I'm having problems with the use of WHENEVER SQLERROR DO <function>.
    I've got this function: void mensajeDeError(int error); defined in a static library, and compiles perfectly, but when I try to call it from a program, I get this warning message:
    warning: improper pointer/integer combination: arg #1
    I've checked the call to the function a lot of times, but I haven't got any solution, because it's right.
    I've realized, that this funcion (if you put in into a structure of WHENEVER SQLERROR DO), only works if you pass a char* as a parameter too, but not with the rest of stardard types of variables (f.e. ints, floats, etc.,)
    I hope you give me a solution.
    Thank you.
    Juan Carlos.

    EXEC SQL WHENEVER SQLERROR DO sql_error();
    void sql_error()
    char msg[512];
    size_t buf_len, msg_len;
    EXEC SQL WHENEVER SQLERROR CONTINUE;
    buf_len = sizeof(msg);
    sqlglm(msg, &buf_len, &msg_len);
    printf("\nOracle error detected:");
    printf("\n%.*s \n", msg_len, msg);
    EXEC SQL ROLLBACK WORK RELEASE;
    exit(1);
    }Hope this help.
    Thomas Devalli.
    KSI Int'l
    [mailto][email protected][mailto]
    www.ksi.be
    null

  • REP-1401: 'cf_10formula': Fatal PL/SQL error occurred. ORA-06502: PL/SQL: numeric or value error

    Hi Team,
    I am running one conc programme.
    After running I am getting below  error. I checked the issue on metalink  and other, seems that it is an size related issue. I have increased the size of formula columns and placeholdder too.
    But still getting issue.
    My requirement is to get comma seperated values using SQL query itself. Neither i wanted to create layout of the report , since it is a XML publisher report and nor  I am including it on RTF template.
    I want the CF_10 formula column to be populated with comma seperated values.
    MSG-00187: From Date 01-Sep-2014
    REP-1401: 'cf_10formula': Fatal PL/SQL error occurred.
    ORA-06502: PL/SQL: numeric or value error
    And Here is my code for CF_10
    function CF_10Formula return Number is
    begin
       SELECT NVL(TO_CHAR(sum(Amount),'99,99,99,999'),0) into :CP_5 --NVL(ROUND(sum(Amount)),0) into :CP_5
    --  xxhw_Coll_cat(category)     "Intercat  Catg"
    FROM hhxw_Region_col_v
    WHERE Category IN ('Intercompany - CATV')
    AND trunc(gl_date) BETWEEN TO_DATE(:P_FROM_DATE, 'DD/MM/RRRR') AND TO_DATE(:P_TO_DATE, 'DD/MM/RRRR');
    RETURN ROUND(:CP_5);
    end;
    Anyone please suggest me.
    Regards,
    Sachin

    Hi,
    1)Why are you selecting the value into a report item? Select into a local variable and return that
    RETURN :CP_5 --> This one!!
    2)And you should avoid applying functions to DB columns in where clauses wherever possible, so oracle can use indexes on them if applicable:
    AND gl_date >= To_date(:P_FROM_DATE, 'DD/MM/RRRR')
    AND gl_date < To_date( :P_TO_DATE, 'DD/MM/RRRR') + 1;
    I think you are taking 2 column in the Layout CF_10 and CP_5 right? if so, then use below Query.
    FUNCTION cf_10formula
      RETURN NUMBER
    IS
      v_amount NUMBER:null;
    IS
    BEGIN
      BEGIN
        SELECT nvl(round(SUM(amount)), 0)
        INTO   v_amount --> Retruns the value for CF_10 column
        FROM   hhxw_region_col_v
        WHERE  category IN ( 'Intercompany - CATV' )
        AND    gl_date >= to_date(:P_FROM_DATE, 'DD/MM/RRRR')
        AND    gl_date < to_date( :P_TO_DATE, 'DD/MM/RRRR') + 1;
        :CP_5 := nvl(trunc(v_amount),0); --> Retruns the value for CP_5 column
      EXCEPTION
      WHEN OTHERS THEN
        v_amount := 0;
        srw.message(1003,'Error in Getting  :' ||p_from_date);
      END;
    END;
    And
    If you've got a number function returning into a number field then all you should need to do to make the comma appear is to change the number format mask in field.
    From 40000 to 40,000

  • ORA-06521: PL/SQL: Error mapping function :ORA-06522:undefined :ODCIAggre

    Hi,
    I am getting the following error :
    SQL> select MinDistance(TT) from egg1;
    select MinDistance(TT) from egg1
    ERROR at line 1:
    ORA-06521: PL/SQL: Error mapping function
    ORA-06522: /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib/custagg.so:
    undefined symbol: ODCIAggregateInitialize
    I am compiling my C program with OCI using the following command :
    g++ -Wall -c custagg.c -o custagg.o -I$ORACLE_HOME/rdbms/public -I/usr/lib
    I am linking to get a shared library custagg.so file with following command :
    ld -shared -o custagg.so custagg.o $ORACLE_HOME/lib/l*.so ../../usr/lib/libstdc++.s*
    I am not getting any errors during these two phases.
    And when i am calling the extproc custagg(Mindistance) which i implemented using ODCI(oracle data catridge interface) ...I am getting the error undefined symbol : ODCIAggregateInitialize
    So can any one please let me know what shared libraries are required to access the ODCI services and also am I compiling and linking it the right way or am I missing any libraries.
    I have the oci.h & odci.h and several other header files in my :
    $ORACLE_HOME/rdbms/public
    And while linking i am using : $ORACLE_HOME/lib/*.so files.
    So I don't know whether my directory is missing some shared files related to ODCI : can any one please let me know which files or shared libraries I am missing :
    Below are list of files in my : $ORACLE_HOME/lib :
    custagg123.o libclntsh.so libdbcfg10.so libjox10.so libocci.so.10.1 liborasdkbase.so libskgxpd.so libunwind.so.5
    custagg.so libclntsh.so.10.1 libemmas10.so libldapjclnt10.so libocijdbc10.so liborasdkbase.so.10.2 libskgxpu.so libxdb.so
    facility.lis libclsra10.so libhasgen10.so libnjni10.so libocr10.so liborasdk.so libsqlplus.so shell.so
    hsdb_odbc.so libcorejava.so libheteroxa10.so libnjssl10.so libocrb10.so liborasdk.so.10.2 libsqora.so.10.1 sysliblist
    hsdb_ora.so libcoresh10.so libhsbase.so libnnz10.so libocrutl10.so libqsmashr.so libsrvm10.so
    lclasses12.zip libcprts.so.5 libhsnav.so libnque10.so libodm10.so libskgxn2.so libsrvmhas10.so
    libagtsh.so libcxa.so.3 libimf.so libntcpaio10.so libodmd10.so libskgxns.so libsrvmocr10.so
    libagtsh.so.1.0 libcxa.so.5 libirc.a libocci.so libons.so libskgxp10.so libuini10.so
    Please reply to my queries.
    Please let me know if you want to have a look at the symbols of my object file
    Thanks & Regards,
    -NN

    Your issue may relate to XE and it may relate to OCI but it does not relate to SQL and PL/SQL. Consider posting your question in a forum where it will be on topic.
    When you do include full version information (3 decimal places) and the code that is generating the exception.

  • ORA-06521:PL/SQL:Error mapping function :ORA-06522:undefined :ODCIAggregate

    Hi,
    I am getting the following error :
    SQL> select MinDistance(TT) from egg1;
    select MinDistance(TT) from egg1
    ERROR at line 1:
    ORA-06521: PL/SQL: Error mapping function
    ORA-06522: /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib/custagg.so:
    undefined symbol: ODCIAggregateInitialize
    I am compiling my C program with OCI using the following command :
    g++ -Wall -c custagg.c -o custagg.o -I$ORACLE_HOME/rdbms/public -I/usr/lib
    I am linking to get a shared library custagg.so file with following command :
    ld -shared -o custagg.so custagg.o $ORACLE_HOME/lib/l*.so ../../usr/lib/libstdc++.s*
    I am not getting any errors during these two phases.
    And when i am calling the extproc custagg(Mindistance) which i implemented using ODCI(oracle data catridge interface) ...I am getting the error undefined symbol : ODCIAggregateInitialize
    So can any one please let me know what shared libraries are required to access the ODCI services and also am I compiling and linking it the right way or am I missing any libraries.
    I have the oci.h & odci.h and several other header files in my :
    $ORACLE_HOME/rdbms/public
    And while linking i am using : $ORACLE_HOME/lib/*.so files.
    So I don't know whether my directory is missing some shared files related to ODCI : can any one please let me know which files or shared libraries I am missing :
    Below are list of files in my : $ORACLE_HOME/lib :
    custagg123.o libclntsh.so libdbcfg10.so libjox10.so libocci.so.10.1 liborasdkbase.so libskgxpd.so libunwind.so.5
    custagg.so libclntsh.so.10.1 libemmas10.so libldapjclnt10.so libocijdbc10.so liborasdkbase.so.10.2 libskgxpu.so libxdb.so
    facility.lis libclsra10.so libhasgen10.so libnjni10.so libocr10.so liborasdk.so libsqlplus.so shell.so
    hsdb_odbc.so libcorejava.so libheteroxa10.so libnjssl10.so libocrb10.so liborasdk.so.10.2 libsqora.so.10.1 sysliblist
    hsdb_ora.so libcoresh10.so libhsbase.so libnnz10.so libocrutl10.so libqsmashr.so libsrvm10.so
    lclasses12.zip libcprts.so.5 libhsnav.so libnque10.so libodm10.so libskgxn2.so libsrvmhas10.so
    libagtsh.so libcxa.so.3 libimf.so libntcpaio10.so libodmd10.so libskgxns.so libsrvmocr10.so
    libagtsh.so.1.0 libcxa.so.5 libirc.a libocci.so libons.so libskgxp10.so libuini10.so
    Please reply to my queries.
    Please let me know if you want to have a look at the symbols of my object file
    Thanks & Regards,
    -NN

    It's only a quick guess but have you checked your tnsnames.ora file to ensure you've opened the environment to find the libraries? If you set the EXTPROC_DLLS=ANY, you open the database to security issues but it should tell you if this cause because you can't access the library that contains the symbol.
    SID_LIST_CALLOUT_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME = <oracle_home_directory>)
    (PROGRAM = extproc)
    (ENV = "EXTPROC_DLLS=ONLY:
    <oracle_home_directory>/customlib/writestr1.so
    ,LD_LIBRARY_PATH=<oracle_home_directory>/lib")
    )

  • Oracle Error: SQL Error Messge: [SERVERERROR] ORA-06550: line 1, column 7:

    The following is the error msg, I am trying to run the stored procedure to insert data into few tables.
    Pls suggest any solution to this error msg: Thanks.
    08/05/2005 11:27:41-> Level:1, UpLoader: SQL Error Messge: [SERVERERROR] ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'ENTPRFMAN'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    PROCEDURE ENTPRFMAN
    p_source_acct_id char, /*1*/
    p_source_system char, /*2*/
    p_entity_name char, /*3*/
    p_entity_legal_name char, /*4*/
    p_entity_long_name char, /*5*/
    p_associated_entity_id char, /*6*/
    p_entity_type char, /*7*/
    p_list_order char, /*8*/
    p_tax_id_number char, /*9*/
    p_inception_date char, /*10*/
    p_fiscal_end_date char, /*11*/
    p_marketing_open_date char, /*12*/
    p_base_currency char, /*13*/
    p_account_status char, /*14*/
    p_entity_code char, /*15*/
    p_orig_source_system char, /*16*/
    p_account_legal_form char, /*17*/
    p_business_sector char, /*18*/
    p_direct_account_ind char, /*19*/
    p_portfolio_type_code char, /*20*/
    p_target_dict_name char, /*21*/
    p_dict_level char, /*22*/
    p_cust_indx_type char, /*23*/
    p_blnd_source char, /*24*/
    p_ml_interpolate_yn char, /*25*/
    p_source_level1 char, /*26*/
    p_source_entity_xref1 char, /*27*/
    p_source_entity_xref1_type char, /*28*/
    p_source_dict_name1 char, /*29*/
    p_weight1 char, /*30*/
    p_source_level2 char, /*31*/
    p_source_entity_xref2 char, /*32*/
    p_source_entity_xref2_type char, /*33*/
    p_source_dict_name2 char, /*34*/
    p_weight2 char, /*35*/
    p_source_level3 char, /*36*/
    p_source_entity_xref3 char, /*37*/
    p_source_entity_xref3_type char, /*38*/
    p_source_dict_name3 char, /*39*/
    p_weight3 char, /*40*/
    p_source_level4 char, /*41*/
    p_source_entity_xref4 char, /*42*/
    p_source_entity_xref4_type char, /*43*/
    p_source_dict_name4 char, /*44*/
    p_weight4 char, /*45*/
    p_source_level5 char, /*46*/
    p_source_entity_xref5 char, /*47*/
    p_source_entity_xref5_type char, /*48*/
    p_source_dict_name5 char, /*49*/
    p_weight5 char, /*50*/
    p_source_level6 char, /*51*/
    p_source_entity_xref6 char, /*52*/
    p_source_entity_xref6_type char, /*53*/
    p_source_dict_name6 char, /*54*/
    p_weight6 char, /*55*/
    p_source_level7 char, /*56*/
    p_source_entity_xref7 char, /*57*/
    p_source_entity_xref7_type char, /*58*/
    p_source_dict_name7 char, /*59*/
    p_weight7 char, /*60*/
    p_source_level8 char, /*61*/
    p_source_entity_xref8 char, /*62*/
    p_source_entity_xref8_type char, /*63*/
    p_source_dict_name8 char, /*64*/
    p_weight8 char, /*65*/
    p_source_level9 char, /*66*/
    p_source_entity_xref9 char, /*67*/
    p_source_entity_xref9_type char, /*68*/
    p_source_dict_name9 char, /*69*/
    p_weight9 char, /*70*/
    p_source_level10 char, /*71*/
    p_source_entity_xref10 char, /*72*/
    p_source_entity_xref10_type char, /*73*/
    p_source_dict_name10 char, /*74*/
    p_weight10 char, /*75*/
    p_OUT OUT char
    AS
    v_date rulesdbo.entity.upd_date%TYPE:= SYSDATE;
    v_update_source rulesdbo.entity.upd_user%TYPE:= 'PRFENT';
    v_entity_id rulesdbo.entity.entity_id%type;
    b_valid BOOLEAN;
    /* Supported Entity Types - Index Index */
    v_sb_entity_type rulesdbo.entity.entity_type%type:= 'INDX';
    v_bb_entity_type rulesdbo.entity.entity_type%type:= 'CIDX';
    v_bb_dict_l1_cv rulesdbo.dictionary_detail.dict_l1_code_value%type := 'TOTAL';
    na_outparam EagleGen.t_outparam;
    /* Constants */
    g_prf_intfc rulesdbo.entity.src_intfc_inst%type:= -1;
    v_src_intfc_inst rulesdbo.entity.src_intfc_inst%type:= -1;
    /* Business Groups */
    v_group_name1 pace_masterdbo.pace_user_groups.group_name%type := 'ASP Reporting Grp';
    v_group_name2 pace_masterdbo.pace_user_groups.group_name%type := 'Client Rptg Grp';
    v_group_name3 pace_masterdbo.pace_user_groups.group_name%type := 'Client Rptg Mgr Grp';
    v_group_name4 pace_masterdbo.pace_user_groups.group_name%type := 'Client Srvc Grp';
    v_group_name5 pace_masterdbo.pace_user_groups.group_name%type := 'Client Srvc Mgr Grp';
    v_group_name6 pace_masterdbo.pace_user_groups.group_name%type := 'Data Mgmt Grp';
    v_group_name7 pace_masterdbo.pace_user_groups.group_name%type := 'Data Services Grp';
    v_group_name8 pace_masterdbo.pace_user_groups.group_name%type := 'Dom Operations (FDS)';
    v_group_name9 pace_masterdbo.pace_user_groups.group_name%type := 'QA Portfolio Mgr Grp';
    v_group_name10 pace_masterdbo.pace_user_groups.group_name%type := 'SRS (LPS) Group';
    v_group_name11 pace_masterdbo.pace_user_groups.group_name%type := 'LG Cap Val PM Group';
    v_group_name12 pace_masterdbo.pace_user_groups.group_name%type := 'APL Large Cap Value';
    v_group_name13 pace_masterdbo.pace_user_groups.group_name%type := 'Small Cap PM Grp';
    v_group_name14 pace_masterdbo.pace_user_groups.group_name%type := 'Client Rptg Dev Grp';
    v_entity_name rulesdbo.entity.entity_name%type; -- HX 17MAR05
    ** Checks to see if entity exists
    PROCEDURE validate_entityid(p_acctid IN rulesdbo.entity_xreference.xref_account_id%TYPE,
    p_acctid_type IN rulesdbo.entity_xreference.xref_account_id_type%TYPE,
    l_entity_id OUT rulesdbo.entity_xreference.entity_id%TYPE,
    b_valid OUT BOOLEAN)
    IS
    BEGIN
    select ex.entity_id into l_entity_id
    from rulesdbo.entity_xreference ex, rulesdbo.entity e
    where ex.xref_account_id = trim(p_acctid)
    and ex.xref_account_id_type = trim(p_acctid_type)
    and ex.entity_id = e.entity_id;
    b_valid:=TRUE;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    b_valid:=TRUE;
    l_entity_id:=null;
    dbms_output.put_line('IN ENTITY VALIDATE no data');
    WHEN OTHERS THEN
    dbms_output.put_line('IN ENTITY VALIDATE ERROR');
    b_valid:=FALSE;
    END; -- validate entity id func ends here
    ** Checks to see if entity xref exists, if not then add xref
    FUNCTION entity_xref(p_acctid rulesdbo.entity_xreference.xref_account_id%TYPE,
    p_acctid_type rulesdbo.entity_xreference.xref_account_id_type%TYPE,
    p_entity_id rulesdbo.entity_xreference.entity_id%TYPE)
    RETURN BOOLEAN
    AS
    l_count NUMBER:=0;
    v_entity_xref_id rulesdbo.entity_xreference.instance%type;
    BEGIN
    select count(*) into l_count
    from rulesdbo.entity_xreference
    where xref_account_id = trim(p_acctid)
    and xref_account_id_type = trim(p_acctid_type);
    if l_count > 0 then
    UPDATE rulesdbo.entity_xreference
    SET update_date = v_date,
    update_source = v_update_source,
    entity_id = p_entity_id
    WHERE xref_account_id = trim(p_acctid)
    AND xref_account_id_type = trim(p_acctid_type);
    RETURN TRUE;
    else
    pace_masterdbo.getnextinstance('RULESDBO.ENTITY_XREFERENCE',1,v_entity_xref_id);
    INSERT INTO rulesdbo.entity_xreference
    instance, update_date, update_source, entity_id, xref_account_id, xref_account_id_type
    VALUES
    v_entity_xref_id, v_date, v_update_source, p_entity_id, trim(p_acctid), trim(p_acctid_type)
    RETURN TRUE;
    end if;
    EXCEPTION
    WHEN OTHERS THEN
    RETURN FALSE;
    END; -- entity_xref func ends here
    ** Finds dictionary_id given dictionary_name
    FUNCTION getDictionaryId(p_dict_name IN rulesdbo.dictionaries.dictionary_name%TYPE,
    p_dict_id OUT rulesdbo.dictionaries.dictionary_id%TYPE)
    RETURN BOOLEAN
    AS
    v_dict_id rulesdbo.dictionaries.dictionary_id%type;
    v_dict_name rulesdbo.dictionaries.dictionary_name%type;
    BEGIN
    dbms_output.put_line('dictionary_name = '||p_dict_name);
    --trim input
    v_dict_name := trim(p_dict_name);
    select dictionary_id into v_dict_id
    from rulesdbo.dictionaries
    where dictionary_name = v_dict_name;
    dbms_output.put_line('dictionary_id = '||v_dict_id);
    if v_dict_id is not null then
    p_dict_id := v_dict_id;
    RETURN TRUE;
    else
    p_dict_id := NULL;
    RETURN FALSE;
    end if;
    EXCEPTION
    WHEN OTHERS THEN
    RETURN FALSE;
    END; -- getDictionaryId func ends here
    ** Finds dictionary_detail_id given dictionary_name
    FUNCTION getDictionaryItemId(p_dict_id IN rulesdbo.dictionary_detail.dictionary_id%TYPE,
    p_dict_l1_code_value IN rulesdbo.dictionary_detail.dict_l1_code_value%TYPE,
    p_dict_l2_code_value IN rulesdbo.dictionary_detail.dict_l2_code_value%TYPE,
    p_dict_item_id OUT rulesdbo.dictionary_detail.dictionary_item_id%TYPE)
    RETURN BOOLEAN
    AS
    v_dict_item_id rulesdbo.dictionary_detail.dictionary_item_id%type;
    v_dict_l1 rulesdbo.dictionary_detail.dict_l1_code_value%TYPE;
    v_dict_l2 rulesdbo.dictionary_detail.dict_l2_code_value%TYPE;
    BEGIN
    --trim input
    v_dict_l1 := trim(p_dict_l1_code_value);
    v_dict_l2 := trim(p_dict_l2_code_value);
    /* Total Level Only dictionary custom logic */
    if v_dict_l2 <> 'TOTAL' then
    select dictionary_item_id into v_dict_item_id
    from rulesdbo.dictionary_detail
    where dictionary_id = p_dict_id
    and dict_l1_code_value = v_dict_l1
    and dict_l2_code_value = v_dict_l2;
    else
    select dictionary_item_id into v_dict_item_id
    from rulesdbo.dictionary_detail
    where dictionary_id = p_dict_id
    and dict_l1_code_value = v_dict_l1
    and dict_l2_code_value is null;
    end if;
    if v_dict_item_id is not null then
    p_dict_item_id := v_dict_item_id;
    RETURN TRUE;
    else
    p_dict_item_id := NULL;
    RETURN FALSE;
    end if;
    EXCEPTION
    WHEN OTHERS THEN
    RETURN FALSE;
    END; -- getDictionaryDetailId func ends here
    ** Finds instance for given source short_desc
    FUNCTION getSourceId(p_source_name IN pace_masterdbo.interfaces.short_desc%TYPE,
    p_source_id OUT pace_masterdbo.interfaces.instance%TYPE)
    RETURN BOOLEAN
    AS
    v_source_id pace_masterdbo.interfaces.instance%TYPE;
    v_source_name pace_masterdbo.interfaces.short_desc%TYPE;
    BEGIN
    --trim input
    v_source_name := trim(p_source_name);
    select instance into v_source_id
    from pace_masterdbo.interfaces
    where short_desc = v_source_name;
    if v_source_id is not null then
    p_source_id := v_source_id;
    RETURN TRUE;
    else
    p_source_id := NULL;
    RETURN FALSE;
    end if;
    EXCEPTION
    WHEN OTHERS THEN
    RETURN FALSE;
    END; -- getSourceId func ends here
    ** Finds entity_id given xref_account_id
    FUNCTION getEntityId( p_account_id IN rulesdbo.entity_xreference.xref_account_id%TYPE,
    p_account_id_type IN rulesdbo.entity_xreference.xref_account_id_type%TYPE,
    p_entity_id OUT rulesdbo.entity_xreference.entity_id%TYPE)
    RETURN BOOLEAN
    AS
    v_entity_id rulesdbo.entity_xreference.entity_id%TYPE;
    v_account_id rulesdbo.entity_xreference.xref_account_id%TYPE;
    v_account_id_type rulesdbo.entity_xreference.xref_account_id_type%TYPE;
    BEGIN
    --trim input
    v_account_id := trim(p_account_id);
    v_account_id_type := trim(p_account_id_type);
    select entity_id into v_entity_id
    from rulesdbo.entity_xreference
    where xref_account_id = v_account_id
    and xref_account_id_type = v_account_id_type;
    if v_entity_id is not null then
    p_entity_id := v_entity_id;
    RETURN TRUE;
    else
    p_entity_id := NULL;
    RETURN FALSE;
    end if;
    EXCEPTION
    WHEN OTHERS THEN
    RETURN FALSE;
    END; -- getEntityId func ends here
    ** FOR BLENDED BENCHMARKS ONLY
    FUNCTION processLevel( p_level_id IN NUMBER,
    p_blend_entity_id IN rulesdbo.entity.entity_id%TYPE,
    p_target_dict_id IN rulesdbo.dictionaries.dictionary_id%TYPE,
    p_dict_level IN rulesdbo.custom_index_attributes.dict_level%TYPE,
    p_dict_l2_code_value1 IN rulesdbo.dictionary_detail.dict_l2_code_value%TYPE,
    p_entity_xref1 IN rulesdbo.entity_xreference.xref_account_id%TYPE,
    p_entity_xref1_type IN rulesdbo.entity_xreference.xref_account_id_type%TYPE,
    p_source_dictname1 IN rulesdbo.dictionaries.dictionary_name%TYPE,
    p_weight1 IN rulesdbo.custom_index_attributes.weight%TYPE
    RETURN BOOLEAN
    AS
    l_count NUMBER:=0;
    v_instance rulesdbo.custom_index_attributes.instance%TYPE;
    v_source_dict_id rulesdbo.custom_index_attributes.source_dict_id%TYPE;
    v_entity_id rulesdbo.entity.entity_id%TYPE;
    v_src_intfc_inst rulesdbo.custom_index_attributes.src_intfc_inst%TYPE;
    v_target_dict_item_id rulesdbo.custom_index_attributes.target_dict_item_id%TYPE;
    b_valid BOOLEAN;
    BEGIN
    b_valid := getSourceId('EAGLE PACE', v_src_intfc_inst);
    dbms_output.put_line('Source Id = '||v_src_intfc_inst);
    b_valid := getEntityId(p_entity_xref1, p_entity_xref1_type, v_entity_id);
    dbms_output.put_line('Level Entity Xref = '||p_entity_xref1);
    dbms_output.put_line('Level Entity Id = '||v_entity_id);
    IF NOT b_Valid THEN
    na_outparam(na_outparam.COUNT+1) := EagleGen.GetErrEdit(p_Src => v_src_intfc_inst,
    p_ShortDesc => 'ENTITY NF');
    p_OUT := EagleGen.simf_table_to_varchar(na_outparam);
    RETURN FALSE;
    END IF;
    b_valid := getDictionaryId(p_source_dictname1, v_source_dict_id);
    dbms_output.put_line('Level Dictionary Id = '||v_source_dict_id);
    IF NOT b_Valid THEN
    na_outparam(na_outparam.COUNT+1) := EagleGen.GetErrEdit(p_Src => v_src_intfc_inst,
    p_ShortDesc => 'DICT ID NF');
    p_OUT := EagleGen.simf_table_to_varchar(na_outparam);
    RETURN FALSE;
    END IF;
    b_valid := getDictionaryItemId(p_target_dict_id, v_bb_dict_l1_cv, p_dict_l2_code_value1, v_target_dict_item_id);
    dbms_output.put_line('Dictionary Item Id = '||v_target_dict_item_id);
    IF NOT b_Valid THEN
    na_outparam(na_outparam.COUNT+1) := EagleGen.GetErrEdit(p_Src => v_src_intfc_inst,
    p_ShortDesc => 'DIR NF');
    p_OUT := EagleGen.simf_table_to_varchar(na_outparam);
    RETURN FALSE;
    END IF;
    /* initial delete */
    if p_level_id = 1 then
    dbms_output.put_line('Deleting ALL prior blend info');
    DELETE FROM rulesdbo.custom_index_attributes
    WHERE entity_id = p_blend_entity_id
    and target_dict_id = p_target_dict_id
    and source_dict_id = v_source_dict_id
    and dict_level = p_dict_level;
    end if;
    /* verify level */
    if p_dict_l2_code_value1 is not null then
    if (v_entity_id is not null) then
    if (v_source_dict_id is not null) then
    if (p_weight1 is not null) then
    dbms_output.put_line('*** LEVEL '||p_level_id||' - INSERTING NEW RECORD INTO RULESDBO.CUSTOM_INDEX_ATTRIBUTES');
    pace_masterdbo.getnextinstance('RULESDBO.CUSTOM_INDEX_ATTRIBUTES',1,v_instance);
    dbms_output.put_line('Retrieved instance number = '||v_instance);
    /* insert row */
    INSERT INTO rulesdbo.custom_index_attributes (
    instance, effective_date, entity_id, entity_detail_id, target_dict_id, source_dict_id,
    dict_level, dict_level_value, weight, cust_indx_type, src_intfc_inst, update_date,
    update_source, target_dict_item_id
    VALUES (
    v_instance, trunc(v_date), p_blend_entity_id, v_entity_id, p_target_dict_id, v_source_dict_id,
    p_dict_level, substr(p_dict_l2_code_value1, 1, 30), p_weight1, substr(p_cust_indx_type, 1, 4),
    v_src_intfc_inst, v_date, v_update_source, v_target_dict_item_id
    b_valid := TRUE;
    RETURN TRUE;
    end if;
    end if;
    end if;
    end if;
    RETURN FALSE;
    EXCEPTION
    WHEN OTHERS THEN
    dbms_output.put_line('ERRROR - '||sqlerrm);
    RETURN NULL;
    END; -- processLevel func ends here
    FUNCTION customIndexAttributes(
    p_blend_entity_id IN rulesdbo.entity.entity_id%TYPE,
    p_target_dictname IN rulesdbo.dictionaries.dictionary_name%TYPE,
    p_dict_l2_code_value1 IN rulesdbo.dictionary_detail.dict_l2_code_value%TYPE,
    p_entity_xref1 IN rulesdbo.entity_xreference.xref_account_id%TYPE,
    p_entity_xref1_type IN rulesdbo.entity_xreference.xref_account_id_type%TYPE,
    p_source_dictname1 IN rulesdbo.dictionaries.dictionary_name%TYPE,
    p_weight1 IN rulesdbo.custom_index_attributes.weight%TYPE,
    p_dict_l2_code_value2 IN rulesdbo.dictionary_detail.dict_l2_code_value%TYPE,
    p_entity_xref2 IN rulesdbo.entity_xreference.xref_account_id%TYPE,
    p_entity_xref2_type IN rulesdbo.entity_xreference.xref_account_id_type%TYPE,
    p_source_dictname2 IN rulesdbo.dictionaries.dictionary_name%TYPE,
    p_weight2 IN rulesdbo.custom_index_attributes.weight%TYPE,
    p_dict_l2_code_value3 IN rulesdbo.dictionary_detail.dict_l2_code_value%TYPE,
    p_entity_xref3 IN rulesdbo.entity_xreference.xref_account_id%TYPE,
    p_entity_xref3_type IN rulesdbo.entity_xreference.xref_account_id_type%TYPE,
    p_source_dictname3 IN rulesdbo.dictionaries.dictionary_name%TYPE,
    p_weight3 IN rulesdbo.custom_index_attributes.weight%TYPE,
    p_dict_l2_code_value4 IN rulesdbo.dictionary_detail.dict_l2_code_value%TYPE,
    p_entity_xref4 IN rulesdbo.entity_xreference.xref_account_id%TYPE,
    p_entity_xref4_type IN rulesdbo.entity_xreference.xref_account_id_type%TYPE,
    p_source_dictname4 IN rulesdbo.dictionaries.dictionary_name%TYPE,
    p_weight4 IN rulesdbo.custom_index_attributes.weight%TYPE,
    p_dict_l2_code_value5 IN rulesdbo.dictionary_detail.dict_l2_code_value%TYPE,
    p_entity_xref5 IN rulesdbo.entity_xreference.xref_account_id%TYPE,
    p_entity_xref5_type IN rulesdbo.entity_xreference.xref_account_id_type%TYPE,
    p_source_dictname5 IN rulesdbo.dictionaries.dictionary_name%TYPE,
    p_weight5 IN rulesdbo.custom_index_attributes.weight%TYPE,
    p_dict_l2_code_value6 IN rulesdbo.dictionary_detail.dict_l2_code_value%TYPE,
    p_entity_xref6 IN rulesdbo.entity_xreference.xref_account_id%TYPE,
    p_entity_xref6_type IN rulesdbo.entity_xreference.xref_account_id_type%TYPE,
    p_source_dictname6 IN rulesdbo.dictionaries.dictionary_name%TYPE,
    p_weight6 IN rulesdbo.custom_index_attributes.weight%TYPE,
    p_dict_l2_code_value7 IN rulesdbo.dictionary_detail.dict_l2_code_value%TYPE,
    p_entity_xref7 IN rulesdbo.entity_xreference.xref_account_id%TYPE,
    p_entity_xref7_type IN rulesdbo.entity_xreference.xref_account_id_type%TYPE,
    p_source_dictname7 IN rulesdbo.dictionaries.dictionary_name%TYPE,
    p_weight7 IN rulesdbo.custom_index_attributes.weight%TYPE,
    p_dict_l2_code_value8 IN rulesdbo.dictionary_detail.dict_l2_code_value%TYPE,
    p_entity_xref8 IN rulesdbo.entity_xreference.xref_account_id%TYPE,
    p_entity_xref8_type IN rulesdbo.entity_xreference.xref_account_id_type%TYPE,
    p_source_dictname8 IN rulesdbo.dictionaries.dictionary_name%TYPE,
    p_weight8 IN rulesdbo.custom_index_attributes.weight%TYPE,
    p_dict_l2_code_value9 IN rulesdbo.dictionary_detail.dict_l2_code_value%TYPE,
    p_entity_xref9 IN rulesdbo.entity_xreference.xref_account_id%TYPE,
    p_entity_xref9_type IN rulesdbo.entity_xreference.xref_account_id_type%TYPE,
    p_source_dictname9 IN rulesdbo.dictionaries.dictionary_name%TYPE,
    p_weight9 IN rulesdbo.custom_index_attributes.weight%TYPE,
    p_dict_l2_code_value10 IN rulesdbo.dictionary_detail.dict_l2_code_value%TYPE,
    p_entity_xref10 IN rulesdbo.entity_xreference.xref_account_id%TYPE,
    p_entity_xref10_type IN rulesdbo.entity_xreference.xref_account_id_type%TYPE,
    p_source_dictname10 IN rulesdbo.dictionaries.dictionary_name%TYPE,
    p_weight10 IN rulesdbo.custom_index_attributes.weight%TYPE
    RETURN BOOLEAN
    AS
    l_count NUMBER:=0;
    v_instance rulesdbo.custom_index_attributes.instance%TYPE;
    v_target_dict_id rulesdbo.custom_index_attributes.target_dict_id%TYPE;
    v_source_dict_id rulesdbo.custom_index_attributes.source_dict_id%TYPE;
    v_entity_id rulesdbo.entity.entity_id%TYPE;
    v_entity_detail_id rulesdbo.entity_detail.entity_detail_id%TYPE;
    b_valid BOOLEAN;
    BEGIN
    dbms_output.put_line('TRYING TO INSERT NEW RECORD INTO RULESDBO.CUSTOM_INDEX_ATTRIBUTES');
    b_valid := getDictionaryId(p_target_dictname, v_target_dict_id);
    dbms_output.put_line('Target Dictionary Id = '||v_target_dict_id);
    -- process level 1
    if p_dict_l2_code_value1 is not null then
    dbms_output.put_line('Trying to process level 1');
    b_valid := processLevel(1,p_blend_entity_id,v_target_dict_id,p_dict_level,
    p_dict_l2_code_value1,p_entity_xref1,p_entity_xref1_type,
    p_source_dictname1,p_weight1);
    end if;
    -- process level 2
    if p_dict_l2_code_value2 is not null then
    dbms_output.put_line('Trying to process level 2');
    b_valid := processLevel(2,p_blend_entity_id,v_target_dict_id,p_dict_level,
    p_dict_l2_code_value2,p_entity_xref2,p_entity_xref2_type,
    p_source_dictname2,p_weight2);
    end if;
    -- process level 3
    if p_dict_l2_code_value3 is not null then
    dbms_output.put_line('Trying to process level 3');
    b_valid := processLevel(3,p_blend_entity_id,v_target_dict_id,p_dict_level,
    p_dict_l2_code_value3,p_entity_xref3,p_entity_xref3_type,
    p_source_dictname3,p_weight3);
    end if;
    -- process level 4
    if p_dict_l2_code_value4 is not null then
    dbms_output.put_line('Trying to process level 4');
    b_valid := processLevel(4,p_blend_entity_id,v_target_dict_id,p_dict_level,
    p_dict_l2_code_value4,p_entity_xref4,p_entity_xref4_type,
    p_source_dictname4,p_weight4);
    end if;
    -- process level 5
    if p_dict_l2_code_value5 is not null then
    dbms_output.put_line('Trying to process level 5');
    b_valid := processLevel(5,p_blend_entity_id,v_target_dict_id,p_dict_level,
    p_dict_l2_code_value5,p_entity_xref5,p_entity_xref5_type,
    p_source_dictname5,p_weight5);
    end if;
    -- process level 6
    if p_dict_l2_code_value6 is not null then
    dbms_output.put_line('Trying to process level 6');
    b_valid := processLevel(6,p_blend_entity_id,v_target_dict_id,p_dict_level,
    p_dict_l2_code_value6,p_entity_xref6,p_entity_xref6_type,
    p_source_dictname6,p_weight6);
    end if;
    -- process level 7
    if p_dict_l2_code_value7 is not null then
    dbms_output.put_line('Trying to process level 7');
    b_valid := processLevel(7,p_blend_entity_id,v_target_dict_id,p_dict_level,
    p_dict_l2_code_value7,p_entity_xref7,p_entity_xref7_type,
    p_source_dictname7,p_weight7);
    end if;
    -- process level 8
    if p_dict_l2_code_value8 is not null then
    dbms_output.put_line('Trying to process level 8');
    b_valid := processLevel(8,p_blend_entity_id,v_target_dict_id,p_dict_level,
    p_dict_l2_code_value8,p_entity_xref8,p_entity_xref8_type,
    p_source_dictname8,p_weight8);
    end if;
    -- process level 9
    if p_dict_l2_code_value9 is not null then
    dbms_output.put_line('Trying to process level 9');
    b_valid := processLevel(9,p_blend_entity_id,v_target_dict_id,p_dict_level,
    p_dict_l2_code_value9,p_entity_xref9,p_entity_xref9_type,
    p_source_dictname9,p_weight9);
    end if;
    -- process level 10
    if p_dict_l2_code_value10 is not null then
    dbms_output.put_line('Trying to process level 10');
    b_valid := processLevel(10,p_blend_entity_id,v_target_dict_id,p_dict_level,
    p_dict_l2_code_value10,p_entity_xref10,p_entity_xref10_type,
    p_source_dictname10,p_weight10);
    end if;
    RETURN b_valid;
    EXCEPTION
    WHEN OTHERS THEN
    dbms_output.put_line('ERRROR - '||sqlerrm);
    RETURN NULL;
    END; -- customIndexAttributes func ends here
    ** if record in entity Detail exists add else update master entity id
    ** benchmark entity_id = p_mast_entity_id
    ** portfolio entity_id = p_feed_entity_id
    FUNCTION entityDetail( p_mast_entity_id rulesdbo.entity_detail.entity_detail_id%TYPE,
    p_feed_entity_id rulesdbo.entity_detail.entity_id%TYPE,
    p_entity_type rulesdbo.entity_detail.entity_type%TYPE,
    p_list_order rulesdbo.entity_detail.list_order%TYPE)
    RETURN BOOLEAN
    AS
    l_count NUMBER:=0;
    a_count NUMBER:=0;
    BEGIN
    /* if blended benchmark don't need record in ENTITY_DETAIL */
    if (p_entity_type = v_bb_entity_type) then
    return TRUE;
    end if;
    select count(*) into l_count
    from rulesdbo.entity_detail
    where entity_id = p_feed_entity_id
    and entity_type = p_entity_type
    and entity_detail_id = p_mast_entity_id;
    if l_count > 0 then
    dbms_output.put_line('UPDATING EXISTING RECORD IN RULESDBO.ENTITY_DETAIL');
    UPDATE rulesdbo.entity_detail
    SET
    update_date = v_date,
    update_user = v_update_source,
    src_intfc_inst = v_src_intfc_inst,
    list_order = p_list_order
    WHERE
    entity_detail_id = p_mast_entity_id
    AND entity_id = p_feed_entity_id
    AND entity_type = p_entity_type;
    RETURN TRUE;
    else
    /* validate associated entity_id */
    dbms_output.put_line('VALIDATING ASSOCIATED ENTITY_ID');
    dbms_output.put_line('p_feed_entity_id ' || p_feed_entity_id);
    select count(*) into a_count
    from rulesdbo.entity
    where entity_id = p_feed_entity_id;
    if a_count > 0 then
    dbms_output.put_line('INSERTING NEW RECORD INTO RULESDBO.ENTITY_DETAIL');
    INSERT INTO rulesdbo.entity_detail
    entity_detail_id, entity_id, entity_type, update_date, update_user, src_intfc_inst, list_order
    VALUES
    p_mast_entity_id, p_feed_entity_id, p_entity_type, v_date, v_update_source, v_src_intfc_inst, p_list_order
    RETURN TRUE;
    else
    IF p_feed_entity_id is not null then
    --For invalid, non-null associated_entity_id
    RETURN FALSE;
    END IF;
    --For invalid, null associate_entity_id
    return TRUE;
    end if;
    return TRUE;
    end if;
    EXCEPTION
    WHEN OTHERS THEN
    RETURN FALSE;
    END; -- entityDetail func ends here
    ** FOR BUSINESS GROUPS
    FUNCTION setBusinessGroup
    ( p_group_name pace_masterdbo.pace_user_groups.group_name%TYPE,
    p_entity_id rulesdbo.entity.entity_id%TYPE,
    p_upd_user pace_masterdbo.pace_user_groups.upd_user%TYPE,
    p_upd_datetime pace_masterdbo.pace_user_groups.upd_datetime%TYPE
    RETURN BOOLEAN
    AS
    g_count NUMBER:=0;
    v_group_id pace_masterdbo.pace_user_groups.group_id%TYPE;
    BEGIN
    /* validate that business group is found */
    select count(*) into g_count
    from pace_masterdbo.pace_user_groups
    where group_name = p_group_name;
    if g_count <= 0 then
    dbms_output.put_line('BUSINESS GROUP NOT FOUND - ' || p_group_name);
    return FALSE;
    end if;
    /* get group_id for given group name */
    select group_id into v_group_id
    from pace_masterdbo.pace_user_groups
    where group_name = p_group_name;
    /* check if record already exists in group_entities */
    select count(*) into g_count
    from pace_masterdbo.group_entities
    where group_id = v_group_id
    and entity_id = p_entity_id;
    if g_count > 0 then
    /* update record */
    UPDATE pace_masterdbo.group_entities
    SET upd_user = p_upd_user,
    upd_datetime = p_upd_datetime
    WHERE group_id = v_group_id
    AND entity_id = p_entity_id;
    dbms_output.put_line('UPDATED RECORD FOR BUSINESS GROUP - ' || p_group_name);
    else
    /* insert record */
    INSERT INTO pace_masterdbo.group_entities
    ( group_id, entity_id, upd_user, upd_datetime )
    VALUES
    ( v_group_id, p_entity_id, p_upd_user, p_upd_datetime );
    dbms_output.put_line('INSERTED NEW RECORD FOR BUSINESS GROUP - ' || p_group_name);
    end if;
    RETURN TRUE;
    EXCEPTION
    WHEN OTHERS THEN
    RETURN FALSE;
    END; -- setBusinessGroup func ends here
    ** MAIN
    BEGIN
    -- HX 17MAR05
    v_entity_name := substr(p_entity_name,1,30);
    v_entity_name := translate(v_entity_name,'/\:*?"<>~`!^|;,.''',' ');
    b_valid := getSourceId('EAGLE PACE', g_prf_intfc);
    dbms_output.put_line('Global Source Id = '||g_prf_intfc);
    validate_entityid(p_source_acct_id,p_source_system,v_entity_id, b_valid);
    IF NOT b_Valid THEN
    na_outparam(na_outparam.COUNT+1) := EagleGen.GetErrEdit(p_Src => g_prf_intfc,
    p_ShortDesc => 'INV ENTITY');
    p_OUT := EagleGen.simf_table_to_varchar(na_outparam);
    RETURN;
    END IF;
    if v_entity_id is not null then
    dbms_output.put_line('ENTITY ID EXISTS - ' || v_entity_id);
    /*Update Record in Entity Table */
    UPDATE rulesdbo.entity
    SET entity_type = p_entity_type,
    entity_name = v_entity_name,
    entity_long_name = substr(p_entity_long_name,1,60),
    legal_name = p_entity_legal_name,
    inception_date = to_date(p_inception_date, 'YYYYMMDD'),
    marketing_open_date = to_date(p_marketing_open_date, 'YYYYMMDD'),
    fiscal_end_date = to_date(p_fiscal_end_date, 'YYYYMMDD'),
    tax_id_number = p_tax_id_number,
    upd_date = v_date,
    upd_user = v_update_source,
    base_currency = p_base_currency,
    account_status = p_account_status,
    entity_code = p_entity_code,
    orig_source_system = p_orig_source_system,
    account_legal_form = p_account_legal_form,
    business_sector = p_business_sector,
    direct_account_ind = p_direct_account_ind,
    portfolio_type_code = p_portfolio_type_code,
    ml_interpolate_yn = p_ml_interpolate_yn
    WHERE entity_id = v_entity_id;
    dbms_output.put_line('UPDATED EXISTING RULESDBO.ENTITY RECORD');
    b_valid := entityDetail(v_entity_id, p_associated_entity_id, p_entity_type, p_list_order);
    else
    pace_masterdbo.getnextinstance('RULESDBO.ENTITY',1,v_entity_id);
    /*Insert Record into Entity Table */
    INSERT INTO rulesdbo.entity
    entity_id, entity_type, entity_name,entity_long_name,legal_name,inception_date,marketing_open_date,
    upd_date, upd_user, tax_id_number, fiscal_end_date, base_currency, account_status,
    entity_code, orig_source_system, account_legal_form, business_sector, direct_account_ind,
    portfolio_type_code, ml_interpolate_yn
    VALUES
    ( v_entity_id, p_entity_type,v_entity_name,substr(p_entity_long_name,1,60),p_entity_legal_name,
    to_date(p_inception_date, 'YYYYMMDD'),to_date(p_marketing_open_date, 'YYYYMMDD'),v_date, v_update_source, p_tax_id_number, to_date(p_fiscal_end_date, 'YYYYMMDD'),
    p_base_currency, p_account_status, p_entity_code, p_orig_source_system, p_account_legal_form, p_business_sector,
    p_direct_account_ind, p_portfolio_type_code, p_ml_interpolate_yn
    dbms_output.put_line('ENTITY ID CREATED - ' || v_entity_id);
    /*Insert Record into Entity_Detail Table */
    b_valid := entityDetail(v_entity_id, p_associated_entity_id, p_entity_type, p_list_order);
    end if;
    /* Insert/Update CUSTOM_INDEX_ATTRIBUTES if blended benchmark */
    if (p_entity_type = v_bb_entity_type) then
    b_valid := customIndexAttributes(
    v_entity_id,
    p_target_dict_name,
    p_source_level1,
    p_source_entity_xref1,
    p_source_entity_xref1_type,
    p_source_dict_name1,
    p_weight1,
    p_source_level2,
    p_source_entity_xref2,
    p_source_entity_xref2_type,
    p_source_dict_name2,
    p_weight2,
    p_source_level3,
    p_source_entity_xref3,
    p_source_entity_xref3_type,
    p_source_dict_name3,
    p_weight3,
    p_source_level4,
    p_source_entity_xref4,
    p_source_entity_xref4_type,
    p_source_dict_name4,
    p_weight4,
    p_source_level5,
    p_source_entity_xref5,
    p_source_entity_xref5_type,
    p_source_dict_name5,
    p_weight5,
    p_source_level6,
    p_source_entity_xref6,
    p_source_entity_xref6_type,
    p_source_dict_name6,
    p_weight6,
    p_source_level7,
    p_source_entity_xref7,
    p_source_entity_xref7_type,
    p_source_dict_name7,
    p_weight7,
    p_source_level8,
    p_source_entity_xref8,
    p_source_entity_xref8_type,
    p_source_dict_name8,
    p_weight8,
    p_source_level8,
    p_source_entity_xref9,
    p_source_entity_xref9_type,
    p_source_dict_name9,
    p_weight9,
    p_source_level10,
    p_source_entity_xref10,
    p_source_entity_xref10_type,
    p_source_dict_name10,
    p_weight10
    end if;
    /* Insert/Update Business Groups */
    b_valid := setBusinessGroup(v_group_name1, v_entity_id, v_update_source, v_date);
    b_valid := setBusinessGroup(v_group_name2, v_entity_id, v_update_source, v_date);
    b_valid := setBusinessGroup(v_group_name3, v_entity_id, v_update_source, v_date);
    b_valid := setBusinessGroup(v_group_name4, v_entity_id, v_update_source, v_date);
    b_valid := setBusinessGroup(v_group_name5, v_entity_id, v_update_source, v_date);
    b_valid := setBusinessGroup(v_group_name6, v_entity_id, v_update_source, v_date);
    b_valid := setBusinessGroup(v_group_name7, v_entity_id, v_update_source, v_date);
    b_valid := setBusinessGroup(v_group_name8, v_entity_id, v_update_source, v_date);
    b_valid := setBusinessGroup(v_group_name9, v_entity_id, v_update_source, v_date);
    b_valid := setBusinessGroup(v_group_name10, v_entity_id, v_update_source, v_date);
    b_valid := setBusinessGroup(v_group_name11, v_entity_id, v_update_source, v_date);
    b_valid := setBusinessGroup(v_group_name12, v_entity_id, v_update_source, v_date);
    b_valid := setBusinessGroup(v_group_name13, v_entity_id, v_update_source, v_date);
    b_valid := setBusinessGroup(v_group_name14, v_entity_id, v_update_source, v_date);
    /* Insert/Update entity xref */
    b_valid := entity_xref(p_source_acct_id, p_source_system, v_entity_id);
    IF NOT b_Valid THEN
    dbms_output.put_line('INV ENT XREF 1');
    na_outparam(na_outparam.COUNT+1) := EagleGen.GetErrEdit(p_Src => g_prf_intfc,
    p_ShortDesc => 'INV ENT XREF');
    p_OUT := EagleGen.simf_table_to_varchar(na_outparam);
    RETURN;
    END IF;
    COMMIT;
    /* Pass back any warning messages */
    p_out := EagleGen.simf_table_to_varchar(na_outparam);
    END; -- End of Procedure

    The PLS-00306 error is normally a runtime error. It is telling you that the call to procedure ENTPRFMAN had either too few or too many parameters passed to it or that one or more of the parameters were of the wrong datatype.
    HTH -- Mark D Powell --

  • Where should I put WHENEVER SQLERROR CONTINUE clause?

    Hi all,
    this is my situation:
    I have 2 compiled packages and one compiled procedure which uses the 2 packages. I want to start the procedure with sql*plus.
    To do this, I wrote a script and start the script from sql*plus:
    SQL> @start_proc.sqlThe start_proc.sql script looks like this:
    SET SERVEROUTPUT ON
    SET ECHO OFF
    SET TERMOUT OFF
    WHENEVER SQLERROR CONTINUE
    SPOOL /home/scott/proc_out.txt
    BEGIN
      SCHEMA1.TEST_PR;
      COMMIT;
    END;
    SPOOL OFFThe question is, where should i put the statement WHENEVER SQLERROR CONTINUE ?
    In the current position, the procedure does not start at all. If I remove the statement completely, then I get error on the first record and the procedure does not go on with the rest of the records...

    Thanks for your follow-up, Frank.
    The bigger picture (imo, hence the "-ism") is still:
    When it comes down to error-handling, the world suddenly gets very complicated and turns into all shades of grey, for many years.
    (But actually it should be simple: quit when unexpected things happen)
    The Developer has done his/her best, based on inputs
    The DBA has done his/her best, based on inputs
    The Architect/Designer has done his/her best, based on inputs
    The Manager has done his/her best, based on inputs
    The Client/CST has done his/her best, based on being client/CST
    Funny thing is: whenever I mail/call CST asking for additional input, usually things make sense...
    I dare say: when things go wrong, let them go wrong.
    Propagate the message to another human, who probably didn't think of that/expected it to happen.

  • Script error not printed with WHENEVER OSERROR EXIT

    Hi!
    I run a script with SQL*Plus and noticed, that the script does not stop on an error like this:
    SP2-0310: unable to open file "../../some_script.sql"
    I added a line of:
    WHENEVER OSERROR EXIT
    And then it exits on error, but now the error message is not printed.
    So it looks like the script was finished successfully.
    Is there a way to get both?
    The error message and a stop to the script execution?
    Version:
    SQL*Plus: Release 10.2.0.3.0 - Production on Tue Jul 19 19:05:26 2011
    on Windows XP
    Regards,
    David Balažic

    Check out the documentation for the EXIT function.

Maybe you are looking for

  • Can't back up to old Time Machine from new Macbook Pro.

    TM wants to copy everything to external HD, not just back up the changes as per how i did it on my older 2007 Macbook. The external 320GB HD has only 13GB left and is trying to send all 300GB from new machine to it, not just any changes i've made in

  • How to associate 1997-2003 Word doc files with Word 2010?

    Hi I am surprised not to be able to find out how to associate word 1997-2003 Word files with Wrod 2010. The object is to have Word 2010 open the document when I click on the document. Many of my Word 1997-2003 documents were created using Word 2010.

  • Discmakers Project: Color Question

    Hi, Using Photoshop and Illustrator CS3 I'm wrapping up a project for a Discmakers digipac. My color management settings are synced...setting: North American General Purpose 2. All my linked images are 300 dpi. The photos were originally RGB then des

  • Regarding Sap Netweaver XI Trail Version

    Hi Experts, What is the Difference between the Sap Netweaver XI Trail Version And the Complete Version????????/ Is there Any Major Difference in between these Two?????????? Or Explain me In Detail What r the Differences Even it is a minor Difference

  • Adobe Premiere CC and Adobe Encore CS6

    Hi friends Perhaps I missed this information. In my personal notebook I already use the CC design apps like Photoshop, Illustrator, InDesign. My father works with video app and in his workstation he is still using CS6 applications, including Premiere