Conditional Exit from the script

Hi,
I have to code the script like the below
--Step 1
begin
If <Table1 doesnot exist> then
Display "User Defined Error Message: Table1 doesnot exit"
EXIT FROM THE SCRIPT(Below sql should not run)
endif
end
--Step 2
spool abc.txt;
select "should not run" from Table1;
spool off;Step 2 should not run if table1 doesnot exist.
Can someone please tell how to conditionally exit the script.
Thanks & Regards,C
CDPrasad
Edited by: cdprasad on Aug 12, 2010 1:35 PM
Edited by: cdprasad on Aug 12, 2010 1:36 PM
Edited by: cdprasad on Aug 12, 2010 1:38 PM
Edited by: cdprasad on Aug 12, 2010 1:38 PM

Hi,
David is right; SQL*Plus is the wrong tool for this job.
If you really want to to this in SQL*Plus, you can achieve a crude type of branching by using sub-sripts. Instead of an IF statement, you use START or @ to run one or another of those sub-scripts, based on a substitution variable, which in turn is set by a query.
For example:
--     abc.sql - Test if table1 exists, and
--                     (1) if it exists, run abc_query.sql to do a query
--                     (2) if it does not exist, run abc_error.sql to display an error message
--     Preliminary query, to define next_script:
COLUMN     next_script_col        NEW_VALUE next_script
SELECT     CASE      COUNT (*)
         WHEN  0  THEN  'abc_error'
                   ELSE  'abc_query'
     END     AS next_script_col
FROM     all_tables
WHERE     table_name     = 'TABLE1'
AND     owner          = 'SCOTT'
--     Now that we know what to do, do it:
@&next_scriptYou would run the above script (abc.sql) and it would decide whether to run the script containing you query, or the script that prints an error message.
Why does table1 sometimes disappear? In a good database design, tables are permanent structures, and get dropped only when they are obsolete. Perhaps you should be TRUNCATing the table, not dropping it.

Similar Messages

  • Portal logoff should Close or Exit from  the window

    Hi Friends,
    Please help me here, When user click on logoff or Exit from the portal the Window should be closed. (I disabled the popup message box , now I am trying to figured it out how to close the window)
    Please help me.
    Peter

    Hi Peter,
    If you try to write JavaScript  in par file to close window, i think portal will not properly logoff from portal.
    Better to create a seperate html page which contain script to close the window on load. Also include script to remove cookies created by portal (not mandatory). Save the html page in server..
    You can redirect portal after logoff to this page by setting ume logoff url in visual administrator.
    We implemented this in portal and working fine in IE. For Firefox it will prompt a message, since it will not allow close window from script due to security reasons.
    If you need html code and script let me know i will send it.
    Regards
    Baby

  • How to track exit from the PageFragment Lifecycle

    Hi,
    I have a requirement of keeping track of exit from a pageFragment.
    My structure contains: a TaskFlow which contains a train . This train node contains the page Fragments. Now when i navigate from one PageFrag to another ie. when i exit the currently selected node having a page Fragment, i need to fire a logic.
    I tried using creating a bean which implements RegionController interface which has refreshRegion(RegionContext ) method.I got hold of RegionBinding interface which has only one of the following values: Entry, Execute_Model, Prepare_Model, Refresh_Unknown, Render_Model and Type_executable_region.
    Also in this case i am not exiting the TaskFlow during the navigation.
    My doubt is how do i or can i use RegionController to keep track of exit from the currently rendered PageFragment's  Lifecycle.
    Also , can i use PagePhaseListener to keep track of the PageFragment lifecycle stage. (My understanding is PagePhaseListener is to be used for Jspx not Jsff). Plz do correct me if i am wrong.
    Thanks,
    Prasenjit
    Edited by: user586616 on Aug 31, 2009 3:54 AM
    Edited by: user586616 on Aug 31, 2009 3:57 AM

    Hi Frank,
    I have created a ControllerClass which implements RegionController. I have registered the same as controller class in my pageFragments PageDef.
    So, on navigation from one train node to another. due to post back call to leaving node and freshcall to the arriving node in the train flow. i am able to get the leaving as well approaching node.
    My doubt is can i get similar or better control over the nodes traversed using trainModel or anyother adfinternal controller class? Kindly suggest any better way of getting handle to the navigating train nodes.
    Sample Code which i have implemented:
    public class RegionControllerBean implements RegionController {
    public boolean refreshRegion(RegionContext regionContext) {
    System.out.println("**********************************");
    System.out.println("inside refreshRegion method call");
    String selectedView = ControllerContext.getInstance().getCurrentViewPort().getViewId(); ------> this gives me the handle to the viewId of the curently selected pageFragment
    System.out.println(ControllerContext.getInstance().getCurrentViewPort().getViewId().toString());
    String pageName = selectedView.split("/")[2];
    System.out.println("Current PageName:"+pageName);
    System.out.println("name: "+regionContext.getRegionBinding().getName());
    int refreshFlag = regionContext.getRefreshFlag();
    if(refreshFlag == RegionBinding.PREPARE_MODEL){
    System.out.println("Inside prepare Model phase"); ------> on entering of that node i need to call some logic before prepare_model phase
    if(refreshFlag == RegionBinding.EXECUTE_MODEL){
    System.out.println("Inside execute model phase");
    if(refreshFlag == RegionBinding.RENDER_MODEL){
    System.out.println("Inside render model phase");
    // propagate refresh to inner binding container
    regionContext.getRegionBinding().refresh(refreshFlag);
    return false;
    public boolean validateRegion(RegionContext regionContext) {
    // propagate the validate to inner binding container
    System.out.println("inside validate region method");
    regionContext.getRegionBinding().validate();
    return false;
    thanks,
    Prasenjit

  • Regarding exit from the module pool screen

    h experts,
    i have developed a module pool report in which in the selection screen i have four fields which are mandatory ,when i execute the program without entering in the selection screen it do not allow to come out of the module pool screen ...what i want that without entering any input in the selection screen if i press exit button push button it will allow to come out of the screen for this what sud i do plz help me....

    Hi
    keep a button called <b>EXIT</b> on the screen
    Make the function type of that field as <b>E</b>
    in Flow logic write
    PROCESS AFTER INPUT.
    Forced Exit from the transaction from screen
      MODULE exit AT EXIT-COMMAND.
    double click on exit module and
    then in PAI write
    *&      Module  exit  INPUT
    Exit from the Transaction
    MODULE exit INPUT.
      CASE okcode.
        WHEN 'EXIT' OR 'CANCEL'.
          CLEAR okcode.
          LEAVE PROGRAM.
      ENDCASE.
    ENDMODULE.                 " exit  INPUT
    <b>Reward points for useful Answers</b>
    Regards
    Anji

  • Accessing the Logon User Exit from the Internet using an ITS Service

    I can access the Logon User Exit (EXIT_SAPLSUSF_001) from R/3, but not from the Web using an ITS service. What am I missing in order to access the Logon User Exit from the Web. The ITS service was created from an ABAP screen program.
    Thanks
    david yee

    The SAPGui logon exit is called after successfull authentication has been completed and after a SAPGui session has been attached.
    If you logon via RFC, WebGui, ICM or the Wgate then this exit does not trigger.
    What are you wanting to add to your code after the logon ?
    An solution I have used is to create a wrapper RFC for a BAPI and create a webservice for the wrapper. Before calling the BAPI you can do whatever you want to from a security perspective.
    But for that you need to have an appropriate BAPI...
    Please explain what you want to do and what you would have wanted in the exit. Often there is a better way.
    Cheers,
    Julius
    ps: I moved this to the security forum.

  • How to exit from the class execution process?

    I am invoking an exe from my Java application using the Runtime.getRuntime().exec() method.
    though the process is completed, the class is still running.
    how do i exit from the class execution, but with the process still running??

    To sabre150 :
    I am directly executing the command through the exec() method:
    Runtime.getRuntime().exec("...../iexplore.exe");This way, the control is going to the opened IE window and only on closing it, my class is exiting.
    Is there any other way where I can come out of the class, but ensure that the process which i run through the exec() method, is still running?

  • Can`t exit from the app corner mode in windows phone 10 technical preview at Nokia Lumia 520

    After upgrading to windows phone 10, I just face several bugs as expected, including screen unlock bug. I just try app corner feature on my phone. That`s led to a big mistake. I can`t exit from the app corner mode. While pressing the power off
    button and swap right, nothing happens. (In lock screen, it doesn`t show that swap right to exist. I think this problem also related to locks screen bug.  Even I try  to remove the battery. But, still I struck at app corner. Please
    help me come out this problem!!!
    Thanks in advance
    Mohamed Usman
    www.neotech4u.weebly.com

    Very very disappointed. Sorry about windows phone. I have argued quit a lot with friends. Trying to convince them that WP are extremely good and nice to work with. Unfortunately they keep telling me about the poor apps of WP. Unfortunately I can now start seeing the problem. Guess what, I wasconsidering of buying my father a WP. Guess what. I will probably stick to android. Badly played about that. Farewell. Disappointed 7.8 WP customer from Athens Greece.

  • No condition update from the sales orders exist - VK322 Message

    Hello All,
    I have activated " Condition Index" & " Condition Update" flag for one of my discount condition type and then created it's condition record along with scales on three levels. The condition type which I mentioned above is set as " Value Scale" in Scale Basis for checking the document value and apply the applicable discount percentage.
    I have created three sales orders wherein the discount percentage is getting applied as per my condition record ( so, the document value is getting accumulated and compared with the condition record correctly )  but when I try to check the cumulative values ( ctrl +shift + F4 ) from the condition record, I get information message " VK322" mentioned in the subject.
    VK322 -
    No condition update from the sales orders exist
    Message no. VK322
    Diagnosis
    The following causes are possible:
    1. There are no sales orders for the condition record that you selected.
    2. Updating condition records in the sales order entry is not active.
    Procedure
    Concerning 1:
    Check the sales orders created for the condition record that you selected.
    Concerning 2:
    Activate the updating for condition records in the sales order entry.
    I have checked everything in SPRO for this but could not find anything which can give me a clue to resolve this problem, especially " Concerning 2" part of this message.
    My requirement > To be able to see the cumulative values from condition record.
    Also, in which table the accumulated values get stored?
    Appreciate your expert advise on this issue.
    Regards,
    Hrishi
    Edited by: Hrishikesh Bhalwankar on Sep 13, 2011 1:59 AM

    Hello Everyone,
    I would like to thank each one of you for giving valuable inputs in regard to my requirement and I would like to let you know that I am able to achieve the results as per the expectation.
    I would also like to share some key things which I did ( with the help of all your expert inputs ) due to which the requirement is met:-
    1. Activation of ' Condition Index, Condition Update' in V/06 for the discount condition type.
    2. Maintained ' B - Value Scale' in Scale Basis for the said condition type in V/06 - my requirement was to check against a value to apply the necessary scale base percentage.
    3. Activation of ' S071' info structure via OM01
    4. Condition record maintenance as per the required scales.
    4. Written a new routine to check the accumulated condition base value from S071 along with the current document condition base value.
    5. Put this routine in ' Scale Formula' in V/06.
    This is giving me the perfect results for the correct application of the discount.
    Just last question - How to re-organize the S071 info structure as I tried to re-organize it with Standard Program ' RV15F001' but it is not re-organizing this info structure... Any idea on this?
    Thanks a lot friends for all your advice...
    Regards,
    Hrishi
    Edited by: Hrishikesh Bhalwankar on Oct 11, 2011 2:11 AM

  • Can you help me EXIT  from the itunes store back to my play list?

    can you help me EXIT  from the itunes store back to my play list?

    If you're using iTunes 11, click on "Library" on the top right, then clck on "Playlists" on the top.

  • How to exit from the button test in diagnostic mode

    Hi,
    I am having some trouble with my ipod 7th gen.
    First my lightning cable wont be recognize. show the error Accesory incompatible.
    I try to solve the problem cleaning the golden pins in the cable and in the ipod. Don't work
    I enter in diagnostic mode in my ipod and I get stucked in the button counter test..
    In the screen appear a mesage 'Please reset the unit to end'. I don't know how to reset the unit
    I press any button and only increase the counter for every button.
    First how acan exit from the button counter test and how can fix the issue with the lightning cable

    Your problem is that you are trapped inside an event case. It is not a good idea to run extended code inside event cases, else the event structure cannot service other events.
    Why don't you use the outer loop for everything? Now things don't step on each others toes. What good is an event structure if it cannot react at all times???
    Message Edited by altenbach on 07-25-2008 12:26 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    event_problemMOD.vi ‏17 KB

  • Exiting from SQL script

    Hi,
    How do you exit from an sql script?
    e.g
    DECLARE
    VAR1 = VARCHAR2(10);
    VAR2 = VARCHAR2(10);
    BEGIN
    VAR1 := 'hello';
    VAR2 := 'world';
    IF VAR1 != VAR2
    THEN
    DBMS_OUTPUT.PUT_LINE('Variables not equal');
    ## Exit here! <------- HOW?????
    END IF;
    END;
    Cheers,
    Warren

    If I understand correctly, you have a series of anonymous PL/SQL blocks in a script. If some test fails in one of them, then you do not want to run the rest of the script.
    If exiting sqlplus is an acceptable means of failing, then you can do something like:
    WHENEVER SQLERROR EXIT 1;
    DECLARE
    v1 VARCHAR2(20);
    v2 VARCHAR2(20);
    BEGIN
       v1 := 'ABCDE';
       v2 := 'FBCDE';
       IF v1 <> v2 THEN
          DBMS_OUTPUT.Put_Line('Variables Not Equal');
          RAISE NO_DATA_FOUND;
       END IF;
    END;
    DECLARE
    v3 VARCHAR2(20);
    BEGIN
       v3 := 'Second Block';
    END;
    /in your script. As shown, the script will exit sqlplus without executing the second block. You can use any sql error instead of no data found.
    Another possibility if exiting sqlplus is not acceptable would be to do something like this in your script:
    VARIABLE failed NUMBER;
    DECLARE
    v1 VARCHAR2(20);
    v2 VARCHAR2(20);
    BEGIN
       :failed := 0;
       v1 := 'ABCDE';
       v2 := 'FBCDE';
       IF v1 <> v2 THEN
          DBMS_OUTPUT.Put_Line('Variables Not Equal');
          :failed := 1;
          RETURN;
       END IF;
    END;
    DECLARE
    v3 VARCHAR2(20);
    BEGIN
       IF :failed = 0 THEN
          v3 := 'Second Block';
       END IF;
    END;
    /Note, the IF :failed = 0/END IF block should cover all the code in each subsequent anonymous block.
    A third approach would be to re-write the series of anonymous blocks as a package, then create a small driver script to call each procedure in turn unless one returns an error.
    TTFN
    John

  • How to exit from the loop

    loop at itab.
    if <CONDITION>
    <EXIT LOOP>
    endif
    endloop.
    this ths condition , pz tel how to exit from loop

    Hi
    Loop
       statements
    EXIT
    Endloop.
    Will comes out of the loop.
    Regards,
    Sreeram Kumar.Madisetty

  • How to Exclude an Account from the script

    Hi BPC Experts,
    Below script, captures 403  DIVACCOUNTs as below.
    Deposits - DA_221101
    Lending  - DA_211101
    Current Account - DA_221102
    Plus around 400 accounts.
    From the above 403 accounts, I have to exclude the  Current Account - DA_221102 alone for the Flow: FL_AVG_CLO_ADJ in the below script.
    How can I make the change in the below script or in the dimension property.
    Below script should exclude the FLOW = FL_AVG_CLO_ADJ, just only for the Current Account - DA_221102. For all other DIVACCOUNTS, it should consider the FLOW = FL_AVG_CLO_ADJ.
    Advise me, please. Enclosed the screen shot for ref.
    Exclude this FLOW.bmp shows the flow which needs to be excluded in the transfer from Source model to Reporting model.
    Flow.bmp shows the FLOW = FL_AVG_CLO_ADJ .
    DIVACCOUNT shows the  account ids.
    Logic Script:
    *SELECT (%CATYP%,"[CAT_TYPE_CALC]","CATEGORY","[ID] = %CATEGORY_SET%")
    *SELECT (%TIMMBERS%,"[ID]","TIME","[%CATYP%]='F'")
    *SELECT (%DACMBERS%,"[ID]","DIVACCOUNT","[REPORT_ACC]<>''")
    *XDIM_MEMBERSET BOOK=BAS(BK_ALL)
    *XDIM_MEMBERSET DATASRC=BAS(DS_MGT_TOTAL)
    *XDIM_MEMBERSET DETAIL=BAS(DT_ALL)
    *XDIM_MEMBERSET DIVACCOUNT=%DACMBERS%
    *XDIM_MEMBERSET DIVOWNVIEW=BAS(DO_TOT)
    *XDIM_MEMBERSET FLOW=BAS(FL_CLO),FL_NONE,FL_AVG_CLO_ADJ
    *XDIM_MEMBERSET REPRICING=<ALL>
    *XDIM_MEMBERSET RPTCURRENCY=LC
    *XDIM_MEMBERSET TIME=%TIMMBERS%
    *XDIM_MEMBERSET TRNCURRENCY=BAS(TOTAL_CUR)
    *DESTINATION_APP = Reporting
    *SKIP_DIM = BOOK,DIVOWNVIEW,REPRICING
    *RENAME_DIM DIVACCOUNT=ACCOUNT
    *WHEN DIVACCOUNT
    *IS *
    *REC(DATASRC=DS_DIVROI,ENTITY=ENTITY.DIV_TO_REP,DIVACCOUNT=DIVACCOUNT.REPORT_ACC)
    *ENDWHEN
    *COMMIT

    Hi Rajesh,
    Something like:
    *SELECT (%CATYP%,"[CAT_TYPE_CALC]","CATEGORY","[ID] = %CATEGORY_SET%")
    *SELECT (%TIMMBERS%,"[ID]","TIME","[%CATYP%]='F'")
    *SELECT (%DACMBERS%,"[ID]","DIVACCOUNT","[REPORT_ACC]<>'' AND [ID]<>'DA_221102' AND [CALC]='N'")
    *XDIM_MEMBERSET BOOK=BAS(BK_ALL)
    *XDIM_MEMBERSET DATASRC=BAS(DS_MGT_TOTAL)
    *XDIM_MEMBERSET DETAIL=BAS(DT_ALL)
    *XDIM_MEMBERSET DIVOWNVIEW=BAS(DO_TOT)
    *XDIM_MEMBERSET REPRICING=<ALL>
    *XDIM_MEMBERSET RPTCURRENCY=LC
    *XDIM_MEMBERSET TIME=%TIMMBERS%
    *XDIM_MEMBERSET TRNCURRENCY=BAS(TOTAL_CUR)
    *XDIM_MEMBERSET FLOW=BAS(FL_CLO),FL_NONE,FL_AVG_CLO_ADJ
    *XDIM_MEMBERSET DIVACCOUNT=%DACMBERS%,DA_221102
    *DESTINATION_APP = Reporting
    *SKIP_DIM = BOOK,DIVOWNVIEW,REPRICING
    *RENAME_DIM DIVACCOUNT=ACCOUNT
    *WHEN DIVACCOUNT
    *IS %DACMBERS%
    *REC(DATASRC=DS_DIVROI,ENTITY=ENTITY.DIV_TO_REP,DIVACCOUNT=DIVACCOUNT.REPORT_ACC)
    *IS DA_221102
    *WHEN FLOW
    *IS <> FL_AVG_CLO_ADJ
    *REC(DATASRC=DS_DIVROI,ENTITY=ENTITY.DIV_TO_REP,DIVACCOUNT=DIVACCOUNT.REPORT_ACC)
    *ENDWHEN
    *ENDWHEN
    Vadim

  • App.activeDocument.name  not giving the new name entered in save as option from the script

    When I open a document and use save as option and enter a new name. The app.activeDocument.name object is still giving me the old file name, it not giving the new file name that was entered in the save as option. However this issue is comming when I open a document and use the save as option for the first time. From then on for any number of times I use the save as option it gives me the new name.

    Hi,
    In my case I am calling the script from my AI plugin(this is developed in c++) .  My plugin will be called when ever there is a event,  suppose I do ctrl+shift+s ( i,e File > Save as from Illustrator) , then my plugin will call the script.
    Script that I am using:
       var doc = app.activeDocument;
       alert (doc.name);
       var dest;
       var options= new IllustratorSaveOptions();
       dest = new File(app.activeDocument.path + '/' + doc.name);      
       doc.saveAs(dest, options);

  • To exit from the while(1) loop

    Hi all ,
    I have a simple question that if in a callback function of a command button, i use a While(bLoop)
    loop , where bLoop is a boolean variable initially set to TRUE, then how can i break or exit from this while Loop by using a control on the front panel  , which exits the while loop by setting     bLoop = FALSE .
    I have tried it but it is not exiting  
    Solved!
    Go to Solution.

    The problem here is that CVI normally only executes one callback at a time. While you are in one control callback, no GUI processing and subsequent calls to other callbacks normally occurs.
    You can try the following approach - but it is not really the best method:
        while (b_loop) {              // Inside a callback
            ...                       // Perform your tight program loop
            ProcessSystemEvents ();   // Force CVI to see if any GUI controls need servicing
    If you have a different control callback to clear the global b_loop, this quick-and-dirty approach might work for you.
    You should only use this technique for very simple programs - it can rapidly spiral out of control and end up in a mess if you're not careful. NI recommends that you do not use ProcessSystemEvents() inside a control callback.
    JR

Maybe you are looking for

  • Retrieve all pages in a site collection using powershell command

    Hi all, I need to retrieve all pages in a site collection and i wanted to display it in a csv file using powershell command.Please help. Regards, Praveen

  • Compare iMac to Mac Mini

    I've been wondering about buying the Mac Mini but would like to know how it compares to the iMac. Would I be happy with it's performance? Can it do all the things the iMac does? Also, the new Mini's use usb 3  and all my equipment uses usb2.

  • 2 versions of .jar, need to launch correct version

    Currently, our users are using a shortcut in Windows95/NT to launch a jar file. Now they will have two versions of the jar file, version_a.jar and version_b.jar. Now there will also need to be an ini file (or properties file) that will have four line

  • Kuler won't show in Photoshop

    I have Photoshop CC (English), and Kuler does not show up under the Windows/Extensions menu. Is there a download for Kuler that I need? How do I get it to show up?

  • An error occurred while backing up this iphone (-43)

    Hi, i am getting this error when upgrade to ios 5 can not update to ios 5 what to do?? TNX