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.

Similar Messages

  • 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.

  • 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

  • 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.

  • 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 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>

  • 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 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 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.

  • 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

  • Oracle + Unix question , Error validation for SQL statements in co process

    Hi,
    If I use co process in a shell script , what is the best way to do the error validation of the execution of any sql statements . I was trying to change the following code to make use of co process concept. When I tried echo $? after the execution of a "wrong statements"
    it is still giving Zero output ( meaning success)
    <<<<<<<<<<<<<<<<<<<<<<<<<<<
    cat ${CFG_DIR}/srs_indx.lst | egrep -v '^#' | egrep -v '^[    ]*$' | while read x
    do
    echo " Processing values :: pre $pre tbl $tbl indx $indx tblspc $tblspc cols $cols param $param" >> ${LOGS_DIR}/srs_indx.log
    sqlplus ${BIZSTG} << EOT >> ${LOGS_DIR}/srs_indx.log
    set verify on timing on term on echo on feedback on serveroutput on
    WHENEVER SQLERROR CONTINUE
    drop index $indx;
    WHENEVER SQLERROR EXIT FAILURE
    alter session set query_rewrite_enabled = true;
    create $pre index $indx on $tbl ($cols)
    tablespace $tblspc
    $param;
    exit
    EOT
    RC=$?
    if ( test $RC -ne 0 )
    then
         ERR_MSG="ERROR in creating index $indx for table $tbl from srs_indx.ksh of $ENVIR : $APP by `whoami`@`hostname` on `date` "
         echo $ERR_MSG >> ${LOGS_DIR}/srs_indx.log
         process_warning ${LOGS_DIR}/srs_indx.log
         exitstat=1
    else
         echo "$indx created at `date`" >> ${LOGS_DIR}/srs_indx.log
    fi
    done
    >>>>>>>>>>>>>>>>>>>>
    Any help will be appreciated .
    with thanks and regards
    Ranjeesh K R

    Hi,
    Thanks for the response, I guess people misunderstood my question .
    My question was about "error handling in case of CO PROCESS". For those who don't know about this, in case CO PROCESS you just need to login once to Oracle. In my above code It is logging in & out for each entry in the list. CO process statements may look Similar to SQL statements in pro*C. In PRO*C we use EXEC, but here print -p statements..
    a sample is given for those who are new to co process.
    sqlplus -s /nolog |& # Open a pipe to SQL*Plus
    print -p -- 'connect user/password@instance'
    print -p -- 'set feed off pause off pages 0 head off veri off line 500'
    print -p -- 'set term off time off'
    print -p -- "set sqlprompt ''"
    print -p -- "select sysdate from dual;"
    read -p SYSDATE
    print -p -- "select user from dual;"
    read -p USER
    print -p -- "select global_name from global_name;"
    read -p GLOBAL_NAME
    print -p -- exit
    echo SYSDATE: $SYSDATE
    echo USER: $USER
    echo GLOBAL_NAME: $GLOBAL_NAME
    But I got stuck during error handling of these SQL statements, especially the $? / $* returns 0 even after an erroneus execution.
    Regards

  • SQL Plus Bug/Question: 'COMPUTE' command does not work in script.(BUG?!)

    Good Day to ALL!
    I have a script of SQLPlus that creates a report. I have 8/9 numeric columns which are 'SUM'ed up thru 'COMPUTE' command. It works for all BUT 2 columns. If I put these two columns, compute does not take affect. If I remove these two columns ( just cut) 'COMPUTE' works fine!!! These two coulumns use DB Function. But I have other column that also use DB Function. These two columns has some extra additions. Any thing wrong with the script/column defn.
    Thanks - Pradip (Pradip Biswas @Singapore) Could you pl. reply to [email protected]
    Here is bit of script. Sorry about the length of the cut and paste.
    COLUMN OPEN_QTY_BAL           FORMAT 9,99,990          HEADING 'Opening|Qty'           Justify LEFT
    COLUMN OPEN_QTY_VALUE          FORMAT 99,999,990      HEADING 'Opening|S$'           Justify LEFT
    COLUMN PO_RECEIPTS_QTY      FORMAT 99,990          HEADING 'PO Rec|QTY '          Justify LEFT
    COLUMN PO_RECEIPTS_QTY_VALUE     FORMAT 9,999,990      Heading 'PO Rec|S$'           Justify LEFT
    COLUMN MISC_RECEIPTS_QTY     Format 99,990          Heading 'Misc |Qty'          Justify LEFT
    Column MISC_RECEIPTS_QTY_VALUE      Format 9,999,990      Heading 'Misc|S$'          Justify LEFT
    COLUMN WORKORDER_QTY           FORMAT 99,990          HEADING 'WorkOrd|Qty'          Justify LEFT
    COLUMN WorkOrder_QTY_VALUE      Format 9,999,990      HEADING 'WorkOrd|S$'          Justify LEFT
    COLUMN SALES_SHIPMENT_QTY      FOrmat 99,990          Heading 'SalesShip|Qty'          Justify LEFT
    COLUMN SALES_SHIPMENT_QTY_VALUE FOrmat 9,999,990      Heading 'SalesShip|S$'          Justify LEFT
    COLUMN MISC_ISSUE_QTY     Format 99,999          HEADing 'Misc|Qty'          Justify LEFT
    COLUMN MISC_ISSUE_QTY_VALUE Format 9,999,990 heading 'Misc|S$'          Justify LEFT
    COLUMN TRANSFER_QTY          format 99,990          heading 'Transfer|Qty'          Justify LEFT
    COLUMN TRANSFER_QTY_VALUE     format 99,999,990     heading 'Transfer|S$'          Justify LEFT
    COLUMN REVAL_VALUE Format 99,990          Heading 'Reval|S$'          Justify LEFT
    COLUMN ON_HAND_QTY           FORMAT 9,99,990      HEADING 'Closing|Qty'           Justify LEFT
    COLUMN ON_HAND_QTY_VALUE     FORMAT 99,999,999,990      HEADING 'Closing|S$'           Justify LEFT
    REPHEADER on
    REPHEADER left ' GL Period From: &&P_GL_PERIOD_NAME_FROM ' skip left ' GL Period To : &&P_GL_PERIOD_NAME_TO ' skip left ' Inv Org Code : &&P_INV_ORG_CODE ' skip left 'SubInventory Code : &&P_SUBINVENTORY_CODE ' skip 2
    TTITLE left 'H - Inv Inventory Movement Report as at:' TTITLE_DATE RIGHT 'PAGE:' FORMAT 999 SQL.PNO SKIP 2
    BTITLE skip 1 CENTER 'COMPANY CONFIDENTIAL - Printed on ' TTITLE_DATE
    BREAK on REPORT skip 1;
    --rem(1) compute SUM label 'Total' of OPEN_QTY_VALUE PO_RECEIPTS_QTY_VALUE MISC_RECEIPTS_QTY_VALUE WorkOrder_QTY_VALUE SALES_SHIPMENT_QTY_VALUE MISC_ISSUE_QTY_VALUE TRANSFER_QTY_VALUE REVAL_VALUE on report;
    --REM(2) compute SUM label 'Total $S: ' of OPEN_QTY_VALUE REVAL_VALUE on report;
    --REM(3) compute SUM label 'Total $S: ' of OPEN_QTY_VALUE REVAL_VALUE  ON_HAND_QTY_VALUE on report;
    compute SUM label 'Total $S:' of OPEN_QTY_VALUE PO_RECEIPTS_QTY_VALUE MISC_RECEIPTS_QTY_VALUE WorkOrder_QTY_VALUE SALES_SHIPMENT_QTY_VALUE MISC_ISSUE_QTY_VALUE TRANSFER_QTY_VALUE REVAL_VALUE on report;
    WHENEVER SQLERROR EXIT FAILURE
    select
    --     MSI.ORGANIZATION_ID                          ORGANIZATION_ID,
    -- MSI.INVENTORY_ITEM_ID                                   INVENTORY_ITEM_ID,
         MSI.SEGMENT1||'//'||MSI.DESCRIPTION                                   ITEM,
    -- MSI.DESCRIPTION                                             DESCRIPTION,
    All_Item_subinv.SUBINVENTORY_CODE                              SUBINVENTORY,
    MSIV.PRIMARY_UOM_CODE                                        UOM,
         --NVL(MOQ_OPen_BAL.OPEN_QTY_BAL ,0)                               OPEN_QTY_BAL ,
    -- NVL(MOQ_OPen_BAL.OPEN_QTY_BAL,0) * NVL(AVG_ITEM_COST1.ITEM_COST,0)           OPEN_QTY_VALUE,
    (MOQ_OPen_BAL( All_Item_subinv.SUBINVENTORY_CODE,
              MSI.ORGANIZATION_ID,
    MSI.INVENTORY_ITEM_ID,
    '&P_GL_PERIOD_NAME_FROM') )     OPEN_QTY_BAL ,
    (MOQ_OPen_BAL_VAL( All_Item_subinv.SUBINVENTORY_CODE,
              mSI.ORGANIZATION_ID,
    MSI.INVENTORY_ITEM_ID,
    '&P_GL_PERIOD_NAME_FROM')
         )                                             OPEN_QTY_VALUE,
    NVL(AGGREGATED_MTT.PO_RECEIPTS_QTY,0)                              PO_RECEIPTS_QTY,
         NVL(AGGREGATED_MTT.PO_RECEIPTS_QTY_VALUE,0)                          PO_RECEIPTS_QTY_VALUE,
         NVL(AGGREGATED_MTT.MISC_RECEIPTS_QTY,0)                              MISC_RECEIPTS_QTY,
         NVL(AGGREGATED_MTT.MISC_RECEIPTS_QTY_VALUE,0)                          MISC_RECEIPTS_QTY_VALUE,
         NVL(AGGREGATED_MTT.WORKORDER_QTY,0)                              WORKORDER_QTY,
         NVL(AGGREGATED_MTT.WorkOrder_QTY_VALUE,0)                          WorkOrder_QTY_VALUE,
    NVL(AGGREGATED_MTT.SALES_SHIPMENT_QTY,0)                         SALES_SHIPMENT_QTY,
         NVL(AGGREGATED_MTT.SALES_SHIPMENT_QTY_VALUE,0)                         SALES_SHIPMENT_QTY_VALUE,
         NVL(AGGREGATED_MTT.MISC_ISSUE_QTY,0)                              MISC_ISSUE_QTY,
         NVL(AGGREGATED_MTT.MISC_ISSUE_QTY_VALUE,0)                          MISC_ISSUE_QTY_VALUE,
         NVL(AGGREGATED_MTT.TRANSFER_QTY,0)                              TRANSFER_QTY,
         NVL(AGGREGATED_MTT.TRANSFER_QTY_VALUE,0)                         TRANSFER_QTY_VALUE,
         NVL(AGGREGATED_MTT.REVAL_VALUE,0)                              REVAL_VALUE,
              (MOQ_OPen_BAL(All_Item_subinv.SUBINVENTORY_CODE,
              MSI.ORGANIZATION_ID,
    MSI.INVENTORY_ITEM_ID,
    '&P_GL_PERIOD_NAME_FROM')
              +
              nvl(AGGREGATED_MTT.PO_RECEIPTS_QTY,0)      +
              nvl(AGGREGATED_MTT.MISC_RECEIPTS_QTY,0)     +
              nvl(AGGREGATED_MTT.WORKORDER_QTY,0)     +
              nvl(AGGREGATED_MTT.SALES_SHIPMENT_QTY,0)     +
              nvl(AGGREGATED_MTT.MISC_ISSUE_QTY,0)          +
              nvl(AGGREGATED_MTT.TRANSFER_QTY,0)     )                ON_HAND_QTY,
    ((MOQ_OPen_BAL_VAL( All_Item_subinv.SUBINVENTORY_CODE,MSI.ORGANIZATION_ID,MSI.INVENTORY_ITEM_ID,'&P_GL_PERIOD_NAME_FROM'))
    +(nvl( AGGREGATED_MTT.PO_RECEIPTS_QTY_VALUE,0) )     
    +(nvl( AGGREGATED_MTT.MISC_RECEIPTS_QTY_VALUE,0) )
    +(nvl( AGGREGATED_MTT.WorkOrder_QTY_VALUE,0) )
    +(nvl( AGGREGATED_MTT.sALES_SHIPMENT_QTY_VALUE,0) )
    +(nvl( AGGREGATED_MTT.MISC_ISSUE_QTY_VALUE,0) )
    +(nvl( AGGREGATED_MTT.TRANSFER_QTY_VALUE,0) )
    +nvl( AGGREGATED_MTT.REVAL_VALUE,0))                               ON_HAND_QTY_VALUE -- column alias
    FROM
    -- In line View for MSI
    (select distinct MMT.ORGANIZATION_ID, MMT.INVENTORY_ITEM_ID, MMT.SUBINVENTORY_CODE
    From MTL_MATERIAL_TRANSACTIONS      MMT,
    ORG_ORGANIZATION_DEFINITIONS      OOD,
    MTL_ONHAND_QUANTITIES moq
    where
         OOD.organization_code           = '&P_INV_ORG_CODE' --'HS' --'&P_INV_ORG_CODE'
    AND OOD.inventory_enabled_flag = 'Y'
    AND OOD.operating_unit          = fnd_profile.value('ORG_ID') --83 --fnd_profile.value('ORG_ID')
    AND OOD.SET_OF_BOOKS_ID          = fnd_profile.value('GL_SET_OF_BKS_ID') --1 --fnd_profile.value('GL_SET_OF_BKS_ID')
    AND     MMT.ORGANIZATION_ID          = OOD.organization_id
    AND MMT.SUBINVENTORY_CODE          = NVL('&P_SUBINVENTORY_CODE', MMT.SUBINVENTORY_CODE)
    and MMT.ORGANIZATION_ID      = MOQ.ORGANIZATION_ID -- to eliminate consigend items:2007Jan04:PKB
    and MMT.INVENTORY_ITEM_ID = MOQ.INVENTORY_ITEM_ID --,,
    and MMT.SUBINVENTORY_CODE = MOQ.SUBINVENTORY_CODE --,,
    UNION
    Select distinct      MOQ.ORGANIZATION_ID,      MOQ.INVENTORY_ITEM_ID,     MOQ.SUBINVENTORY_CODE
    from      MTL_ONHAND_QUANTITIES                MOQ,
         ORG_ORGANIZATION_DEFINITIONS           OOD2
    WHERE
         OOD2.organization_code           = '&P_INV_ORG_CODE' --'HS' --'&P_INV_ORG_CODE'
    AND OOD2.inventory_enabled_flag      = 'Y'
    AND OOD2.operating_unit          = fnd_profile.value('ORG_ID') --83 --fnd_profile.value('ORG_ID')
    AND OOD2.SET_OF_BOOKS_ID          = fnd_profile.value('GL_SET_OF_BKS_ID') --1 --fnd_profile.value('GL_SET_OF_BKS_ID')
    AND moq.ORGANIZATION_ID          = OOD2.organization_id
    AND moq.SUBINVENTORY_CODE          = NVL('&P_SUBINVENTORY_CODE', moq.SUBINVENTORY_CODE)
    ) ALL_Item_SUBInv,
    MTL_SYSTEM_ITEMS_B MSI,
    Mtl_System_Items_Vl MSIV,
    (SELECT
         MMT.ORGANIZATION_ID ORGANIZATION_ID,
    MMT.INVENTORY_ITEM_ID          INVENTORY_ITEM_ID,
    MMT.SUBINVENTORY_CODE          SUBINVENTORY_CODE,
    -- PO RECEIPTS.
    SUM(CASE
         WHEN MTST.TRANSACTION_SOURCE_TYPE_NAME in
    ('Purchase order')
         THEN
              CASE
              WHEN MTT.TRANSACTION_TYPE_NAME in
    ('PO Receipt','PO Rcpt Adjust','Return to Vendor')
    THEN
                   --MMT.TRANSACTION_QUANTITY
                   mmt.primary_quantity
    ELSE 0
    END
    ELSE 0
    END ) PO_RECEIPTS_QTY,
    SUM(CASE
         WHEN MTST.TRANSACTION_SOURCE_TYPE_NAME in
    ('Purchase order')
         THEN
              CASE
              WHEN MTT.TRANSACTION_TYPE_NAME in
    ('PO Receipt','PO Rcpt Adjust','Return to Vendor')
    THEN
                   NVL(MMT.ACTUAL_COST,0)* nvl(mmt.primary_quantity,0)
                   MMT.TRANSACTION_COST * NVL(AVG_ITEM_COST.ITEM_COST,0)
    ELSE 0
    END
    ELSE 0
    END ) PO_RECEIPTS_QTY_VALUE,
    -- MISC RECEIPTS.
    SUM( CASE
         WHEN MTST.TRANSACTION_SOURCE_TYPE_NAME in
    ('Account','Inventory')
         THEN
              CASE
              WHEN MTT.TRANSACTION_TYPE_NAME in
    ('Account receipt','Miscellaneous receipt')
    THEN
                   --MMT.TRANSACTION_QUANTITY
                   mmt.primary_quantity
    ELSE 0
    END
    ELSE 0
    END ) MISC_RECEIPTS_QTY,
    SUM(CASE
         WHEN MTST.TRANSACTION_SOURCE_TYPE_NAME in
    ('Account', 'Inventory')
         THEN
              CASE
              WHEN MTT.TRANSACTION_TYPE_NAME in
    ('Account receipt','Miscellaneous receipt')
    THEN
                   NVL(MMT.ACTUAL_COST,0) * nvl(mmt.primary_quantity,0)
                        MMT.TRANSACTION_COST NVL(AVG_ITEM_COST.ITEM_COST,0)
    ELSE 0
    END
    ELSE 0
    END ) MISC_RECEIPTS_QTY_VALUE,
    -- WorkOrder Qty and S$
    SUM( CASE
         WHEN MTST.TRANSACTION_SOURCE_TYPE_NAME in
    ('Job or Schedule')
         THEN
              CASE
              WHEN MTT.TRANSACTION_TYPE_NAME in
    ('WIP Assembly Return','WIP Assy Completion','WIP component issue','WIP Component Return')
    THEN
                   --MMT.TRANSACTION_QUANTITY
                   mmt.primary_quantity
    ELSE 0
    END
    ELSE 0
    END ) WORKORDER_QTY,
    SUM(CASE
         WHEN MTST.TRANSACTION_SOURCE_TYPE_NAME in
    ('Job or Schedule')
         THEN
              CASE
              WHEN MTT.TRANSACTION_TYPE_NAME in
    ('WIP Assembly Return','WIP Assy Completion','WIP component issue','WIP Component Return')
    THEN
                   NVL(MMT.ACTUAL_COST,0) * nvl(mmt.primary_quantity,0)
                        MMT.TRANSACTION_COST NVL(AVG_ITEM_COST.ITEM_COST,0)
    ELSE 0
    END
    ELSE 0
    END ) WorkOrder_QTY_VALUE,
    -- Sales Shipment
    SUM(CASE
         WHEN MTST.TRANSACTION_SOURCE_TYPE_NAME in
    ( 'Sales order','RMA')
         THEN
              CASE
              WHEN MTT.TRANSACTION_TYPE_NAME in
    ('Sales order issue','Sales Order Pick','RMA Return','RMA Receipt')
    THEN
                   --MMT.TRANSACTION_QUANTITY
                   mmt.primary_quantity
    ELSE 0
    END
    ELSE 0
    END ) SALES_SHIPMENT_QTY,
    SUM(CASE
         WHEN MTST.TRANSACTION_SOURCE_TYPE_NAME in
    ( 'Sales order','RMA')
         THEN
              CASE
              WHEN MTT.TRANSACTION_TYPE_NAME in
    ('Sales order issue','Sales Order Pick','RMA Return','RMA Receipt')
    THEN
                   NVL(MMT.ACTUAL_COST,0) * nvl(mmt.primary_quantity,0)
                   MMT.TRANSACTION_COST NVL(AVG_ITEM_COST.ITEM_COST,0)
    ELSE 0
    END
    ELSE 0
    END ) SALES_SHIPMENT_QTY_VALUE,
    -- MISC ISSUE
    SUM(CASE
         WHEN MTST.TRANSACTION_SOURCE_TYPE_NAME in
    ('Inventory','Account' )
         THEN
              CASE
              WHEN MTT.TRANSACTION_TYPE_NAME in
    ('Miscellaneous issue','Account issue')
    THEN
                   --MMT.TRANSACTION_QUANTITY
                   mmt.primary_quantity
    ELSE 0
    END
    ELSE 0
    END ) MISC_ISSUE_QTY,
    SUM(CASE
         WHEN MTST.TRANSACTION_SOURCE_TYPE_NAME in
    ('Inventory','Account' )
         THEN
              CASE
              WHEN MTT.TRANSACTION_TYPE_NAME in
    ('Miscellaneous issue','Account issue')
    THEN
                   NVL(MMT.ACTUAL_COST,0) * nvl(mmt.primary_quantity,0)
                   MMT.TRANSACTION_COST NVL(AVG_ITEM_COST.ITEM_COST,0)
    ELSE 0
    END
    ELSE 0
    END ) MISC_ISSUE_QTY_VALUE,
    -- Transfers
    SUM( CASE
         WHEN MTST.TRANSACTION_SOURCE_TYPE_NAME in
    ( 'Inventory' )
         THEN
              CASE
              WHEN MTT.TRANSACTION_TYPE_NAME in
    ('Subinventory Transfer')
    THEN
                   --MMT.TRANSACTION_QUANTITY
                   mmt.primary_quantity
    ELSE 0
    END
    ELSE 0
    END ) TRANSFER_QTY,
    SUM( CASE
         WHEN MTST.TRANSACTION_SOURCE_TYPE_NAME in
    ( 'Inventory')
         THEN
              CASE
              WHEN MTT.TRANSACTION_TYPE_NAME in
    ('Subinventory Transfer')
    THEN      NVL(MMT.ACTUAL_COST,0) * nvl(mmt.primary_quantity,0)
                   MMT.TRANSACTION_COST NVL(AVG_ITEM_COST.ITEM_COST,0)
    ELSE 0
    END
    ELSE 0
    END ) TRANSFER_QTY_VALUE,
    -- Adjustment to Cost (Revaluation)
    SUM(CASE
         WHEN MTST.TRANSACTION_SOURCE_TYPE_NAME in
    ( 'Standard cost update','Job or Schedule')
         THEN
              CASE
              WHEN MTT.TRANSACTION_TYPE_NAME in
    ('Standard cost update','WIP cost update')
    THEN
                   --2007JAN03:PKB MMT.TRANSACTION_COST
    MMT.TRANSACTION_COST* MMT.QUANTITY_ADJUSTED
    ELSE 0
    END
    ELSE 0
    END ) REVAL_VALUE
         FROM
         MTL_MATERIAL_TRANSACTIONS                MMT,
         --GL_PERIODS                          GP,
         MTL_TRANSACTION_TYPES                MTT,
         MTL_TXN_SOURCE_TYPES                    MTST,
    ORG_ORGANIZATION_DEFINITIONS                OOD
    WHERE     
    OOD.organization_code           = '&P_INV_ORG_CODE' --'HS' --'&P_INV_ORG_CODE'
    AND OOD.inventory_enabled_flag = 'Y'
    AND OOD.operating_unit          = fnd_profile.value('ORG_ID') --83 --fnd_profile.value('ORG_ID')
    AND OOD.SET_OF_BOOKS_ID          = fnd_profile.value('GL_SET_OF_BKS_ID') --1 --fnd_profile.value('GL_SET_OF_BKS_ID')
    AND     MMT.ORGANIZATION_ID          = OOD.organization_id
    AND MMT.SUBINVENTORY_CODE          = NVL('&P_SUBINVENTORY_CODE', MMT.SUBINVENTORY_CODE)
    -- AND GP.PERIOD_SET_NAME          = 'HF-ACCTG-CAL' -- Hardcoded PKB
    AND
         (     (EXISTS
         ( select GP.Period_name
    FROM GL_PERIODS GP
    where TO_DATE(TO_CHAR(MMT.TRANSACTION_DATE,'DD-MM-YYYY'),'DD-MM-YYYY')
                   >= TO_DATE(TO_CHAR(GP.START_DATE,'DD-MM-YYYY'),'DD-MM-YYYY') --Between GP.START_DATE and GP.END_DATE
         AND GP.PERIOD_NAME      = '&P_GL_PERIOD_NAME_FROM'
              and GP.PERIOD_SET_NAME          = 'HF-ACCTG-CAL'
    AND NVL('&P_GL_PERIOD_NAME_FROM','ALL')      != 'ALL'
    OR (NVL('&P_GL_PERIOD_NAME_FROM' ,'ALL')               = 'ALL')
    AND
         (     (EXISTS
         ( select GP.Period_name
    FROM GL_PERIODS GP
    where TO_DATE(TO_CHAR(MMT.TRANSACTION_DATE,'DD-MM-YYYY'),'DD-MM-YYYY')
                   <= TO_DATE(TO_CHAR(GP.END_DATE,'DD-MM-YYYY'),'DD-MM-YYYY')
         AND GP.PERIOD_NAME      = '&P_GL_PERIOD_NAME_TO'
              and GP.PERIOD_SET_NAME          = 'HF-ACCTG-CAL'
    AND NVL('&P_GL_PERIOD_NAME_TO','ALL')      != 'ALL'
    OR (NVL('&P_GL_PERIOD_NAME_TO','ALL')               = 'ALL')
    AND MMT.TRANSACTION_TYPE_ID          = MTT.TRANSACTION_TYPE_ID
    AND MMT.TRANSACTION_SOURCE_TYPE_ID          = MTST.TRANSACTION_SOURCE_TYPE_ID
    group by
         MMT.ORGANIZATION_ID,
    MMT.INVENTORY_ITEM_ID,
    MMT.SUBINVENTORY_CODE
    )                    AGGREGATED_MTT,
    -- Inline Table for AVG_ITEM_COSTs 2nd time,
    (SELECT
         CIC.ORGANIZATION_ID     ORGANIZATION_ID,
    CIC.INVENTORY_ITEM_ID INVENTORY_ITEM_ID,
    CIC.COST_TYPE_ID COST_TYPE_ID,
    CCT.COST_TYPE     COST_TYPE,
    NVL(CIC.ITEM_COST ,0) ITEM_COST
    FROM
         CST_ITEM_COSTS           CIC,
         CST_COST_TYPES           ccT,
    ORG_ORGANIZATION_DEFINITIONS                OOD1
    WHERE
         CCT.COST_TYPE_ID           = CIC.COST_TYPE_ID
         /*AND (
         (CCT.COST_TYPE          = 'Average' and '&P_INV_ORG_CODE' = 'HS')
              OR
    (CCT.COST_TYPE          = 'Frozen' and '&P_INV_ORG_CODE' = 'HL')
    AND CCT.COST_TYPE_ID =
              ( select      m.primary_cost_method
              from      mtl_parameters m
    where      m.organization_id      = OOD1.ORGANIZATION_ID
         and OOD1.organization_code      = '&P_INV_ORG_CODE' --'HS' --'&P_INV_ORG_CODE'
         AND OOD1.inventory_enabled_flag = 'Y'
         AND OOD1.operating_unit          = fnd_profile.value('ORG_ID') 83 --fnd_profile.value('ORG_ID')
         AND OOD1.SET_OF_BOOKS_ID     = fnd_profile.value('GL_SET_OF_BKS_ID') 1 --fnd_profile.value('GL_SET_OF_BKS_ID')
         AND cic.ORGANIZATION_ID          = OOD1.organization_id
         )                               AVG_ITEM_COST1
    WHERE
    AGGREGATED_MTT.ORGANIZATION_ID(+)          = All_Item_subinv.ORGANIZATION_ID
    AND AGGREGATED_MTT.INVENTORY_ITEM_ID(+) = All_Item_subinv.INVENTORY_ITEM_ID
    AND AGGREGATED_MTT.subinventory_code(+)     = All_Item_subinv.subinventory_code
    AND All_Item_subinv.ORGANIZATION_ID          = MSI.ORGANIZATION_ID
    AND ALL_Item_SUBInv.INVENTORY_ITEM_ID          = MSI.INVENTORY_ITEM_ID
    AND AVG_ITEM_COST1.ORGANIZATION_ID(+)     = MSI.ORGANIZATION_ID
    AND AVG_ITEM_COST1.INVENTORY_ITEM_ID(+)      = MSI.INVENTORY_ITEM_ID
    and msi.ROWID                         = MSIV.ROW_ID
    and msi.ORGANIZATION_ID                    = fnd_profile.value('ORG_ID') --83 --fnd_profile.value('ORG_ID')
    and sysdate between NVL(msi.start_date_active,sysdate -1 )
    and NVL(msi.end_date_active,sysdate+1)
    Order BY
         MSI.SEGMENT1,
    MSI.DESCRIPTION     ,
    All_Item_subinv.SUBINVENTORY_CODE
    /

    Hi Barry and All: This indeed is a bug in SQLPLUS ! Version 9.2.0.1.0 as well.
    Thanks for asking the version no of SQLLPLUs. I was working thru Oracle Apps 11i.10 (concurrent program). So I did not get any message from SQLPLUS.
    I tested independently in SQLPLUS and got the message! Thanks Oracle!!!
    The Bug is in the name of COLUMN NAME or ALIAS Name. I renamed the columns from ON_HAND_QTY and ON_HAND_VALUE to CLOSE_QTY and CLOSE_QTY_VALUE. It worked!! The string 'ON' in the column/alias name is taken as 'ON' keyword/clause for 'compute' statement for SQLPLUS.
    Here is the message from SQLPLUS
    " SP2-0084: COMPUTE ON keyword specified already"
    See these two line and compare
    --compute SUM label 'Total $S: ' of SALARY ON_SALARY  on report;
    compute SUM label 'Total $S: ' of SALARY on report;
    Thanks - Pradip
    Here is the sample code to simulate. (not Big :))
    WHENEVER SQLERROR EXIT FAILURE
    CLEAR computes
    CLEAR BREAKS
    clear column
    TTITLE OFF
    BTITLE OFF
    set verify off
    set feedback off
    set echo off
    set heading off
    set termout off
    set linesize 203
    set pagesize 30
    set termout on
    SET UNDERLINE =
    set heading on
    COLUMN SALARY               FORMAT 9,999,990      Heading 'SALARY'           
    COLUMN ON_SALARY          format 9,999,990 Heading 'ON Salary'
    column ENAME format a20 heading 'NAME'
    COLUMN EMPNO Format 99999 HEADING 'EMPNO'
    BREAK on REPORT skip 3;
    --compute SUM label 'Total $S: ' of SALARY ON_SALARY  on report;
    compute SUM label 'Total $S: ' of SALARY on report;
    WHENEVER SQLERROR EXIT FAILURE
    select empno, ename, sal SALARY, sal ON_SALARY from scott.emp;

  • Error whenever error -Script shell error

    Hello this is a pice of my code in my shell script code (bsh)
    My file name its: ord.extractor_porven2.sh
    exit | sqlplus -s $USERPV_DB/$PWDPV_DB @$VORDSQLPATH/ord.extractor_porven_V2.sql $VFDESDE $VFHASTA > $VORDDATOS_PATH/ord.extractor_porven2$VDATE.dat 2>> $VLOG
    set serveroutput on feedback off verify off heading off echo off
    whenever sqlerror exit sql.sqlcode
    . . . . more staff here
    And returns error : ord.extractor_porven2.sh[82]: whenever: not found (line where is whenever error ....... )
    Does anybody please why returns this error?
    Thanks in advance.
    Best regards
    Antonio -Spain

    user5647282 wrote:
    Hello this is a pice of my code in my shell script code (bsh)
    My file name its: ord.extractor_porven2.sh
    exit | sqlplus -s $USERPV_DB/$PWDPV_DB @$VORDSQLPATH/ord.extractor_porven_V2.sql $VFDESDE $VFHASTA > $VORDDATOS_PATH/ord.extractor_porven2$VDATE.dat 2>> $VLOG
    set serveroutput on feedback off verify off heading off echo off
    whenever sqlerror exit sql.sqlcode
    . . . . more staff here
    And returns error : ord.extractor_porven2.sh[82]: whenever: not found (line where is whenever error ....... )
    Does anybody please why returns this error?error above is from OS command line interpreter & indicates that on line 82 it does not recognize "whatever" as being valid at OS level

  • OEM Grid Control Newbie ... hopefully easy question

    I am trying to setup a simple "SQL script" corrective action and want to pass in the object being monitored to the script. For example, in my tablespace %used metric I have defined a corrective action that calls a SQL script on the local host. I want to be able to pass in the tablespace name that raised the alert to the script. When I place the %key_value_name% in the parameters section the corrective action does not work. It doesn't permit me to choose %key_value% as would appear to be the most suitable target property. I am trying to avoid hard-coding the name of the tablespace upon which to take corrective action in the CA script. I feel like I am missing something very simple here.

    Just verified and it appears to work out of the box.
    Fix it job I put on a broken job metric:
    WHENEVER SQLERROR EXIT FAILURE;
    spool /tmp/mylogfile
    set feedback on
    set heading on
    set echo on
    select sysdate from dual;
    select '%metric%' from dual;
    select '%metric_value%' from dual;
    spool off
    The details of the alert job firing:
    Output Log
    SQL*Plus: Release 10.2.0.2.0 - Production on Wed May 2 11:58:24 2007
    Copyright (c) 1982, 2005, Oracle. All Rights Reserved.
    SQL> SQL> SQL> SQL> Connected.
    SQL> SQL> SQL> SQL> SQL> SQL> SQL> SQL> SQL>
    SYSDATE
    02-MAY-07
    1 row selected.
    SQL>
    'BROKENJOBCOUNT'
    Broken Job Count
    1 row selected.
    SQL>
    '1'
    1
    1 row selected.
    SQL> SQL> SQL> SQL> Disconnected from Oracle Database 10g Release 10.2.0.2.0 - Production
    And the spool file as well:
    $ more mylogfile.lst
    SQL> set feedback on
    SQL> set heading on
    SQL> set echo on
    SQL> select sysdate from dual;
    SYSDATE
    02-MAY-07
    1 row selected.
    SQL> select 'Broken Job Count' from dual;
    'BROKENJOBCOUNT'
    Broken Job Count
    1 row selected.
    SQL> select '1' from dual;
    '1'
    1
    1 row selected.
    SQL> spool off

  • Questions about Scheduler

    What I'm trying to do is to create and execute a External Job under a custom schema, CSSM.
    I also asked my DBA to grant system privileges "Create External Jobs" and "Create Job" to CSSM so I can create and exec Job under CSSM.
    dbms_scheduler.create_job (
      job_name =>'CSSM.LIST_FILES',
      job_type =>'EXECUTABLE',
      job_action =>'ls /disk2/app/applmgr/appltop/cssm/11.5.0/ftp/*',
      enabled => TRUE
      );The above code was executed with NO ERROR and the following statement is executed for a test drive.
    begin
      dbms_scheduler.run_job('CSSM.LIST_FILES');
    end;I get error message "ORA-27475: "CSSM.LIST_FILES" must be a job".
    and no result from the following query.
    SELECT owner, job_name, enabled FROM all_scheduler_jobs;What did I do wrong? and What am I missing here?
    I'm using 11.1.0.7.
    Thanks.

    The following works for me with 11.2.0.1 on Oracle Entreprise Linux 5.2:
    [oracle@lx01 ~]$ cat /tmp/lsjob.ksh
    #!/bin/ksh
    ls -al /tmp/?.ksh > /tmp/lsjob.log 2>&1
    [oracle@lx01 ~]$ ls -al /tmp/lsjob.ksh
    -rwxr-xr-x 1 oracle oinstall 51 May 15 09:15 /tmp/lsjob.ksh
    [oracle@lx01 ~]$ sqlplus / as sysdba  @tj
    SQL*Plus: Release 11.2.0.1.0 Production on Sat May 15 09:17:51 2010
    Copyright (c) 1982, 2009, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE    11.2.0.1.0      Production
    TNS for Linux: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    SQL> drop user u cascade;
    User dropped.
    SQL> whenever sqlerror exit failure;
    SQL> create user u identified by u;
    User created.
    SQL> grant create session, create job, create external job to u;
    Grant succeeded.
    SQL> connect u/u
    Connected.
    SQL> begin
      2  dbms_scheduler.create_job (
      3    job_name =>'U.LIST_FILES',
      4    job_type =>'EXECUTABLE',
      5    job_action =>'/tmp/lsjob.ksh',
      6    enabled => TRUE
      7    );
      8  end;
      9  /
    PL/SQL procedure successfully completed.
    SQL> show errors
    No errors.
    SQL> begin
      2    dbms_scheduler.run_job('U.LIST_FILES');
      3  end;
      4  /
    PL/SQL procedure successfully completed.
    SQL> show errors
    No errors.
    SQL> exit
    Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    [oracle@lx01 ~]$Make sure :
    1. to run dbms_scheduler.run_job as job owner (CSSM) or with SYSDBA privs.
    2. to call a script instead of a Unix command
    3. to redirect output in executed script
    See also Guide to External Jobs on 10g with dbms_scheduler e.g. scripts,batch files Guide to External Jobs on 10g with dbms_scheduler e.g. scripts,batch files

Maybe you are looking for

  • Utilities Applications grayed and crossed out, "No longer supported"?

    Originally I wanted to Verify and Repair my Disk Permissions since I've been having difficulty with my disk drive [playing the Sims 3, it told me that there was an error in the Disk Authorization and that the disk was not found in the drive]. Followi

  • Using Sequence in SQL Loader

    Hi, Does anybody know if I can generate the unique primary key using an Oracle Sequence for a Database table to which I am inserting records in SQL Loader? I checked the SQL Loader manual and there is no information as to how to make use of a Oracle

  • PDF attachments on emails

    Newbie here - looking for an answer: I receive an email on my phone (8530Curve) and I can see there is an attachment but when I go to the same email on my PB, no attachment shows - there's nothing there. Back to my phone or pc and it's there - I even

  • Unplanned delivery cost report per vendor

    Hi All, Is there any SAP report that lets us run all unplanned freight charges per supplier.Thanks in Advance. Rgd's, Jagdish

  • Can't add new MAC address to MAC ACL on Airport Express

    Hi, I just recently got a new iPhone 3GS. When I logged into my Airport Express to add it's MAC address to the ACL I found that the + icon was greyed out. I can modify old MAC addresses in the list and delete addresses, but I can't add new ones. Anyo