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)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • How to use the item of table(ms access) in pl/sql

    I want to use oracle forms builer developer application with ms access database
    I don't know how to use the item of table in the pl/sql;please help me !

    MERGE INTO EmpDept Target
    Using (SELECT E.Address,
    e.Design,
    e.EmailId,
    e.EmpId,
    e.Ename,
    e.ManagerId,
    e.Salary,
    D.DeptId,
    D.DeptName,
    D.Location
    FROM Employee E
    INNER JOIN Dept D
    ON E.DeptId = D.DeptId) AS Source (Address, Design, EmailId, EmpId, EName, ManagerId, Salary, DeptId, DeptName, Location)
    ON Source.EmpId = Target.EmpId
    WHEN NOT matched THEN
    INSERT (Address,
    Design,
    EmailId,
    EmpId,
    Ename,
    ManagerId,
    Salary,
    DeptId,
    DeptName,
    Location)
    VALUES (Address,
    Design,
    EmailId,
    EmpId,
    EName,
    ManagerId,
    Salary,
    DeptId,
    DeptName,
    Location)
    WHEN matched THEN
    UPDATE SET Address = Source.Address,
    Design = Source.Design,
    EmailId = Source.EmailId,
    Ename = Source.Ename,
    ManagerId = Source.ManagerId,
    Salary = Source.Salary,
    DeptId = Source.DeptId,
    DeptName = Source.DeptName,
    Location = Source.Location;

  • How to use subroutine in user-exit program

    Hi Experts,
        I have a requirement in user-exit where i have to use some lines of code in several times. So i want to use Perform and perform inside the exit (i.e. Include ZXXX). But it is not recognizing the form part of the ubroutime and gives error.
                 Please let me know how to use the Perform and form statement in the exit or is there any way to  write repeated code once but used no of times in exit program.
    Thanks
    Ajit

    I'm sorry, I was overly harsh there. Please accept my apologies.  But I do despair sometime!
    Consider the structure of a function group and it should be clear - you need to remember that INCLUDES are just repositories of code. If you take the contents out of the include and put them into the main program, then this is what you get:
    function-pool xrsr.        
    * Global data definition.
    function exit_saplrrs0_001.
    * the source code within the zxrsru01 include.
    endfunction.
    Now, what you're trying to do, is create a form in your include. You can't do that, because you end up with:
    function-pool xrsr.        
    * Global data definition.
    function exit_saplrrs0_001.
      perform xyz.
      form xyz.
      endform.
    endfunction.
    And you can't have a FORM defined inside a function module definition. The solution is to put it outside the function module. If you follow the process suggested above, you end up with
    function-pool xrsr.        
    * Global data definition.
    function exit_saplrrs0_001.
      perform xyz.
    endfunction.
    form xyz. " This will be in LXRSRF01
    endform.
    Do you see how it works now?

  • How to use the updated value in the same update statement

    Hello,
    I just wonder how to use the updated new value of other column in the same udpate statement. I am using Oracle 11.2, and want to update the two columns with one update statement as following:
    create table tb_test (id number(5), tot number(5), mon_tot number(5));
    update tb_test set (tot = 15, mon_tot = tot *15) where id = 1;
    ...I would like to update both tot and mon_tot column, the value of mon_tot shall be determinted by the new value of tot.
    Thanks,
    Edited by: 939569 on 1-Feb-2013 7:00 AM

    Edit: example added
    SQL> create table tb_test
      2  ( id number(5)
      3  , tot number(5)
      4  , mon_tot number generated always as (tot*15) virtual
      5  );
    Table created.
    SQL> insert into tb_test (id, tot) values (1, 5);
    1 row created.
    SQL> select * from tb_test;
            ID        TOT    MON_TOT
             1          5         75
    1 row selected.
    SQL> update tb_test
      2  set    tot = 15
      3  where  id = 1;
    1 row updated.
    SQL> select * from tb_test;
            ID        TOT    MON_TOT
             1         15        225
    1 row selected.

  • How to use the Include Statement in the BADI

    Dear All,
            I am trying to implement the BADI. So i need to use the Include in the BADI.
    How to use the Include statement in the BADI. I cant able to use it in the Public, Private and protected statement.
    Where should i mention that,,,,
    Thanks
    Yogesh

    Hi Sharat,
      Thanks for your reply.
    I need to use the BADI HRWPC_PCR_APPR_FORM. In which the values are available in the Container. So if i need to use the container values then i need to use that include <cntain>.
    Is there any possible ways to make it.
    Thanks
    Yogesh

  • Can't access my gmail using the gmail app. States your browser's cookie functionality is turned off. please turn on. How do i do that???

    Can't access my gmail using the gmail app. States your browser's cookie functionality is turned off. please turn on. How do i do that???

    what if I don't want to accept cookies? I didn't have to before I upgraded

  • How to find the exact user exit for our requirement?

    Dear Mr. keerthi,
    can you please explain me how to find the exact user exit for our requirement?

    Hi sandip
    There is more than one method in which you can check for user-exits.The following method is used very often.
    <b>How to find the exact user-exit for your requirement.</b>
    1.     You can check the user exists using transaction SE85.
    2.     Repository Information System -> Enhancements -> Customer exits
    3.     You can search the user-exits by package name.
    4.     Double click on each exit name to check the function module exits.
    <b>The procedure to find the package name.</b>
    Execute transaction SE93 
    Enter the tcode of the transaction for which you want to check the user exit.
    Example: if you want to find the user-exit for purchase orders while changing, enter ME22n  and press display.
    You will get to see the package name
    But you need to confirm that the user exit will get triggered at the appropriate event.
    ( example: you might want some validations to be done ON SAVE of a purchase order)
    <b>Checking if the user-exit is getting triggered or not.</b>
    1.     Open the user exit function module (that you have got in step 4) in Tcode SE37.
    2.     Click on where used button. In the pop up that immediately appears choose only programs .
    3.     You will get a list of programs. Double click on the program name.
    4.     You will get the list of location where this function module user exit is used.
    5.     Place session break points at each of these location ( at each CALL FUNCTION statement)
    6.     Now go to your transaction ( say change purchase order tcode:Me22n) and check if the user exit is getting triggered on appropriate event.
    regards,
    Prasad

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

  • JNI - How to use the error reporting mechanism?

    I've developed a C++ DLL which is loaded from a commercial Win32 application (not written by me) as a plug-in for external calculations. On its initialization the C++ DLL launches the Java VM via the JNI invocation interface. When the DLL functions are called by the application, they forward the calls to Java objects inside the Java VM, again via JNI invocation interface.
    This works well, but I have encountered a weird error.
    From Java I open a JFrame containing a JTextArea as small console for debug output messages. If I turn output to this debug console off (my printToConsole routine checks whether a boolean flag is set), the string concatenation operator may lead to a crash of the Java VM.
    For example, if in one of the Java functions called from the
    DLL via JNI invocation interface the following is the first statement,
    it leads to a crash of the Java VM and the application that loaded the C++ proxy DLL.
    String test=""+Math.random(); // String test not used later
    Interestingly, if I comment this statement out, the Java code works fine WITHOUT any crash. I've already thought about potential races and synchronization issues in my code, but I don't see where this is the case. And the string concatenation error fails as well, if I insert sleep() statements in front of it and at other places in the code. However, if I turn on log messages printed to my JFrame debug console (containing a JTextArea), the String concatenation works without problems.
    So maybe the JNI interface has a bug and affects the Java VM; I don't see where my JNI code is wrong.
    One problem is that I do not get any stdout output, as the C++ proxy DLL is loaded by the Windows application, even if I start the Windows application from the DOS command line (under Windows).
    Does anyone know how to use the error reporting mechanism?
    http://java.sun.com/j2se/1.4.2/docs/guide/vm/error-handling.html
    Is it possible that the JVM, when it crashes, writes debug information about the crash into a file instead of stdout/stderr?
    My C++ proxy DLL was compiled in debug mode, but the commercial application (which loaded the DLL) is very likely not.
    I do not know hot to find the reason why the String concatenation fails inside the Java function called from the C++ DLL via JNI.

    Yes, I've initially thought about errors in the C++ code too. But the C++ code is actually very simple and short. It doesn't allocate anything on the C++ side. It allocates a couple of ByteBuffers inside the Java VM however via JNI invocation interface calls of env->NewDirectByteBuffer(). The native memory regions accessed via the ByteBuffers are allocated not by my own C++ code, but by the program that calls my DLL (the program is Metastock).
    The interesting thing is that everything works fine if output to my debug console is enabled, which means that in the Java print routine getConsoleLoggingState() returns true and text is appended to the jTextArea.
    static synchronized void print(String str)
    { MetaStockMonitor mMon=getInstance();
    if ( mMon.getFileLoggingState() && mMon.logFileWriter!=null) {
    mMon.logFileWriter.print(str);
    mMon.logFileWriter.flush();
    if ( mMon.getConsoleLoggingState() ) {
    mMon.jTextArea1.append(str);
    Only if output to the JTextArea is turned off (ie. getConsoleLoggingState()==false), the crash happens when the FIRST statement in the Java routine called via JNI invocation interface is a (useless) String concatenation operation, as described above.
    String test=""+Math.random(); // String test not used later
    Moreover, the crash happens BEFORE the allocated ByteBuffer objects are accessed in the Java code. But again, if console output is turned on, it works stable. If console output is turned off, it works when the (useless) String concatenation operation is removed in the Java routine called from C++.
    I've already thought about potential races (regarding multiple threads), but this can be ruled out in my case. It almost appears as if the JVM can have problems when called by the invocation interface (I tested it with Java 1.4.2 b28).
    All the calls between C++ and Java go ALWAYS in the direction from C++ code to Java. Unfortunately, there is no special JRE version with extensive logging capabilities to facilitate debugging. And the problem is not easily reproducible either.
    JNIEnv* JNI_GetEnv()
    JNIEnv *env;
    cached_jvm->AttachCurrentThread((void**)&env,NULL);
    fprintf(logfile,"env=%i\n",env);
    fflush(logfile);
    return env;
    // function called by Metastock's MSX plug-in interface
    BOOL __stdcall createIndEngine (const MSXDataRec *a_psDataRec,
    const MSXDataInfoRecArgsArray *a_psDataInfoArgs,
    const MSXNumericArgsArray *a_psNumericArgs,
    const MSXStringArgsArray *a_psStringArgs,
    const MSXCustomArgsArray *a_psCustomArgs,
    MSXResultRec *a_psResultRec)
    a_psResultRec->psResultArray->iFirstValid=0;
    a_psResultRec->psResultArray->iLastValid=-1;
    jthrowable ex;
    jmethodID mid;
    JNIEnv* env=JNI_GetEnv();
    jobject chart=getChart(env, a_psDataRec);
    if ( chart==NULL) {
    return MSX_ERROR;
    jobject getChart (JNIEnv* env, const MSXDataRec *a_psDataRec)
    jthrowable ex;
    jmethodID mid;
    int closeFirstValid, closeLastValid;
    closeFirstValid=a_psDataRec->sClose.iFirstValid;
    closeLastValid=a_psDataRec->sClose.iLastValid;
    long firstDate, firstTime;
    if (closeFirstValid>=1 && closeFirstValid<=closeLastValid) {
    firstDate = a_psDataRec->psDate[closeFirstValid].lDate;
    firstTime = a_psDataRec->psDate[closeFirstValid].lTime;
    } else {
    firstDate=0;
    firstTime=0;
    jclass chartFactoryClass = env->FindClass("wschwendt/metastock/msx/ChartFactory");
    if (ex= env->ExceptionOccurred() ) {
    env->ExceptionDescribe();
    env->ExceptionClear();
    sprintf(sbuf, "DLL: Cannot find class ChartFactory\n");
    printSBufViaJava(sbuf);
    return NULL;
    mid = env->GetStaticMethodID(chartFactoryClass, "getInstance", "()Lwschwendt/metastock/msx/ChartFactory;");
    if (ex= env->ExceptionOccurred() ) {
    env->ExceptionDescribe();
    env->ExceptionClear();
    sprintf(sbuf, "DLL: Cannot find method ID for ChartFactory.getInstance()\n");
    printSBufViaJava(sbuf);
    return NULL;
    jobject chartFactory=env->CallStaticObjectMethod(chartFactoryClass, mid);
    if (ex= env->ExceptionOccurred() ) {
    env->ExceptionDescribe();
    env->ExceptionClear();
    sprintf(sbuf, "DLL: Exception while calling ChartFactory.getInstance()");
    printSBufViaJava(sbuf);
    return NULL;
    mid = env->GetMethodID(chartFactoryClass, "getChartID", "(Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;IIIIIII)F");
    if (ex= env->ExceptionOccurred() ) {
    env->ExceptionDescribe();
    env->ExceptionClear();
    sprintf(sbuf, "DLL: Cannot find method ID for ChartFactory.getChartID()\n");
    printSBufViaJava(sbuf);
    return NULL;
    jobject symbolBuf=env->NewDirectByteBuffer(a_psDataRec->pszSymbol, strlen(a_psDataRec->pszSymbol) );
    if (ex= env->ExceptionOccurred() ) {
    env->ExceptionDescribe();
    env->ExceptionClear();
    sprintf(sbuf, "DLL: Cannot allocate symbolBuf\n");
    printSBufViaJava(sbuf);
    return NULL;
    jobject securityNameBuf=env->NewDirectByteBuffer(a_psDataRec->pszSecurityName, strlen(a_psDataRec->pszSecurityName) );
    if (ex= env->ExceptionOccurred() ) {
    env->ExceptionDescribe();
    env->ExceptionClear();
    sprintf(sbuf, "DLL: Cannot allocate securityNameBuf\n");
    printSBufViaJava(sbuf);
    return NULL;
    jobject securityPathBuf=env->NewDirectByteBuffer(a_psDataRec->pszSecurityPath, strlen(a_psDataRec->pszSecurityPath) );
    if (ex= env->ExceptionOccurred() ) {
    env->ExceptionDescribe();
    env->ExceptionClear();
    sprintf(sbuf, "DLL: Cannot allocate securityPathBuf\n");
    printSBufViaJava(sbuf);
    return NULL;
    jobject securityOnlineSourceBuf=env->NewDirectByteBuffer(a_psDataRec->pszOnlineSource, strlen(a_psDataRec->pszOnlineSource) );
    if (ex= env->ExceptionOccurred() ) {
    env->ExceptionDescribe();
    env->ExceptionClear();
    sprintf(sbuf, "DLL: Cannot allocate onlineSourceBuf\n");
    printSBufViaJava(sbuf);
    return NULL;
    // Java Function call leads to crash, if console output is turned off and
    // the first statement in the Java routine is a (useless) string concatenation.
    // Otherwise it works stable.
    jfloat chartID=env->CallFloatMethod(chartFactory, mid, securityNameBuf, symbolBuf,
    securityPathBuf, securityOnlineSourceBuf, (jint)(a_psDataRec->iPeriod),
    (jint)(a_psDataRec->iInterval), (jint)(a_psDataRec->iStartTime),
    (jint)(a_psDataRec->iEndTime), (jint)(a_psDataRec->iSymbolType),
    (jint)firstDate, (jint)firstTime );
    if (ex= env->ExceptionOccurred() ) {
    env->ExceptionDescribe();
    env->ExceptionClear();
    sprintf(sbuf, "DLL: Exception while calling ChartFactory.getChartID()");
    printSBufViaJava(sbuf);
    return NULL;

  • How to use the Output clause for the updated statment

    How to use the output clause for the below update stament,
    DECLARE @MyTableVar table(
        sname int NOT NULL)
    update A set stat ='USED' 
    from (select top 1 * from #A 
    where stat='AVAILABLE' order by sno)A
    Output inserted.sname
    INTO @MyTableVar;
    SELECT sname
    FROM @MyTableVar;
    Here am getting one error incorrect syntax near Output
    i want to return the updated value from output clause

    see
    http://blogs.msdn.com/b/sqltips/archive/2005/06/13/output-clause.aspx
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • How to use the transformation matrix in Placed Suite.

    I am in trouble how to use the transformation matrix Placed Art (PlacedSuite ). 
           AIRealMatrix rasterMatrix;
    AIRealMatrix placedMatrix;
    if (artType == kRasterArt {
         error = sAIRaster-> GetRasterMatrix (art, & rasterMatrix);
    } else if ((artType == kPlacedArt) {
         error = sAIPlaced-> GetPlacedMatrix (art, & placedMatrix);
    When I converted to using the transformation matrix of PlacedArt, the target art could not be converted to expect.
    I could convert in case of the RasterArt. (The reference point of the transformation matrix of RasterArt is (0,0).) 
    In the PlacedArt, preference point is not (0,0)?
    The tx/ty of the transformation matrix of PlacedArt is not correct? 
    In the transformation matrix of RasterArt and Placed Art, how are those two different?

    The short answer is "no", (0, 0) is not the origin of placed art (unlike kRasterArt). Off the top of my head, I believe when you place art, its original state is upside-down and flipped horizontally in the upper-right of the artboard. If you want to see where it starts, simply create an identity matrix and apply that as the matrix for the kPlacedArt and you'll see how it starts. Yes, its pretty crazy.
    minimum99 posted some code that might help. I haven't tried it (I rolled my own years ago) but I'd give it a whirl:
    http://forums.adobe.com/message/3195790#3195790

  • How to use the POST method In Oracle APEX 3.1

    Hi,
    In APEX if we are submitting the page the parameters( Variables ) will pass through URL.
    How to hide the these parameters from URL??
    I Hope POST method will solve this problem.
    How to use the POST method in APEX???
    Help me out to solve this problem.
    thanks in advance.
    Cheers,
    Shan

    In APEX if we are submitting the page the parameters( Variables ) will pass through URL.No they won't. Submission POSTs the <tt>wwv_flow</tt> form.
    Sometimes a branch may be performed after submission, generating a URL in which parameter values are visible. To avoid this, use the save state before branching option.
    Other actions&mdash;like using navigation lists, or clicking a link in a report&mdash;will perform a GET using parameters in the URL. In these cases using Session State Protection is advised.

  • How to find the ME29N 'USER EXIT' when our save the release PO after.

    How to find the ME29N 'USER EXIT' when our save the release PO after.
    which user exit will be used?
    thanks.
    alex.

    Hi,
      process :
        go to tranx code :   ME29N ,
           System---->Status , here copy the program name (SAPLMEGUI),
         go to abap editor and specify the program name SAPLMEGUI and find the package "ME".
         tranx code : CMOD ,  Utilites--->Sap Enanchement,
                                         specify the package name : ME
                                          and execute, displays a list of exits ,
                                 and find out our suitable exit based on requirement.
    check these :   EXIT_SAPMM06E_021
    reg
    Siva

Maybe you are looking for

  • How to print a logo in existing / seeded report?

    Explain in details about the steps involved in printing a logo in existing / seeded report Thanks in advance Madhan

  • How do i transfer my contacts from macbook to iPad

    Fairly new to macbookpro with osx maverics and novice to ipad version 7.0.4. Cannot find a working solution from guides as requested actions are not anywehre to be seen. I have a cable connection between the 2 machines.

  • Numberic with leading zero

    hi, can any one please help me, i need to display a number in my report, with maximum of 3 digits, where if it is 1, then it will display as 001, and if it is 10, it will display 010. curently, the leading zero does not come out. can anly please advi

  • Close the session when closing the opendoc link

    HI, Environment: BOXIR3.1 SP3 FP 3.6 When the user logging into infoview/CMC that time one session is creating , once logged off session also automatically closing. But when we using the open doc link, we dont have option to sign out the application.

  • How to check Field Value in Controller

    Hi All, I have a requirement to check if the field entered in invAmount is null or zero. The vo.getinvAmount() returns a Number. How can I check it to see if it has a 0.00 ? My code is in Controller. I tried some conversions using Number inv = (Numbe