How Build an Iteration Control

Hello DBA's,
I've my barin in pieces with this issue.
I ve to create one procedure that needs :
DROP temp_table
CREATE temp_table
So I've done :
create or replace Procedure refesh_temp
is
var1 varchar2(2000);
sql varchar2(2000);
Begin
/***** STEP 1 ****/
vsql := 'drop table temp_table';
execute immediate vsql;
/***** STEP 2 ***/
vsql := 'create table temp_table as select * from tab1,tab2';
execute immediate vsql;
exception
WHEN OTHERS THEN NULL;
END refesh_temp;
Simple RIGHT?
My questions IS :
When by mystake the temp_table is alredy droped before we run the procedure
it generates an Error at step 1 because when the Procedure goes to execute the DROP TEMP_TABLE it doesn exist ....
SO I've done this :
IF TEMP TABLE EXIST THEN DROP
ELSE
CREATE TEMP_TABLE
WRONG Again because if temp table Exist it just drop the Table and do not Recreate it Right?
SO I've created a Cursor to retriev if the Table Exist
and 2 Variable Statements VSQL :
vsql1 := 'drop table temp_table'; --- Drop The Temp table
vsql2:= 'create table temp_table as select * from tab1,tab2'; ---- Create the TEMP TABLE
BEGIN
FOR REC in
(SELECT OBJECT_NAME AS VOBJ FROM USER_OBJECTS
WHERE OBJECT_NAME IN ('temp_table'')
LOOP
BEGIN
/ **** IF THE CURSOR RETURNS the TEMP TABLE NAME *****/
VAL1 := REC.VOBJ;
IF VAL1 = 'temp_table'     
THEN
EXECUTE IMMEDIATE VSQL1;
EXECUTE IMMEDIATE VSQL2;
/***** IF NOT Just Recreates The TEMp tABLE *****/
ELSIF
VAL1 IS NULL
THEN
EXECUTE IMMEDIATE VSQL2;
END IF;
END;
END LOOP;
EXCEPTION
END ;
PB it does Nothing ......
Does someone can see and tell me what I don't see ??
Txs
Rgds
Carloos

You could try something like this:
CREATE OR REPLACE PROCEDURE REFRESH_TEMP
AS
        drop_table      EXCEPTION;
        PRAGMA          EXCEPTION_INIT(drop_table,-942);
BEGIN
        BEGIN
                EXECUTE IMMEDIATE 'DROP TABLE TEMP_TABLE';
        EXCEPTION
                WHEN drop_table THEN
                        NULL;
        END;
        EXECUTE IMMEDIATE 'CREATE TABLE TEMP_TABLE AS SELECT * FROM TAB1,TAB2';
END;
/This catches the ORA-00942 error and ignores it so the procedure can continue.
However, I question this implementation to begin with. How does this procedure fit in with your whole process? Basically, what are you trying to do?

Similar Messages

  • How to get the name of the selected building block in a building block content control?

    Hello,
    How can I obtain the name of the selected building block in a building block content control?
    I want to use this together with an on exit-event to populate other content Controls depending on the name of the selected building block item.
    Environment: Word 2010.
    Thanks,
    Peeter

    Hi Peeter,
    As far as I know the building block is the pre-built content, and the
    BuildingBlock object represents a building block in a template. After add the building block to the document, it inserts the content to the document.
    Building blocks are stored in the templates, therefore, to access the building blocks available for a document, we need to access an attached template.
    So, I think, we can’t obtain selected building block in the document.
    There are some links that may benefit you:
    # BdingBlock Object (Word)
    https://msdn.microsoft.com/en-us/library/office/ff192414.aspx?f=255&MSPPError=-2147217396
    # Working with Building Blocks
    https://msdn.microsoft.com/en-us/library/office/ff837878.aspx
    # Set the Building Blocks That You Can Use for a Content Control
    https://msdn.microsoft.com/en-us/library/office/ff197523.aspx
    Regards
    Starain
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Single 3850(MC) how many AP can control

    Hi All now i testing about 3850.. 
    i have some question about 3850
    1. how many APs can control in single 3850(MC)
        if we buy Single 3850(48port) then can we use all port for AP?
    2. build a MC-MA Wireless environment, If MC goes down MA Can still working without MC?(is there kind of NSF?)
    3. for example MC has a AP and MA has a AP. then we can see ap only each 3850. how we can management whole APs
        Prime infrastructure can see whole APs, is this only way ?. I think this is not good for management Wireless.
    4. If MA has over two APs(AP1, AP2),  User1 connected AP1, User2 connected AP2.
        User1 need to connect with User2(FTP or something) , User1,2 can connect directly? without through of MC
              MC-----------------MA
                                            |
                                   AP1          AP2
                                     |                  |
                                user1           user2
     if you have any answer plz talk to me.
    thank you.

    A 3850 can support up to 50 directly-connected APs.

  • Building custom date control in WAD

    Hi,
    Plz. let me know how can I build a custom date control in WAD which will take date intervals.
    OR
    How can I represent a date interval variable in WAD by not using the variable screen feature of the web template.
    Thanks,
    Priya

    Hi Ashish,
    Actually I searched for quite sometime & also consulted with SAP, but could not find an answer. I thus ended up building the whole logic myself. I used Input Field & Button Group web items to build the date controls & made it look like the standard SAP date control complete with icon etc. I enabled Javascript on the Button Group webitems that called a Calendar control for input date selection (my requirement was a date interval, so from & to dates). I then passed the input selection thru' Javascript using Command API to the query variables on click of another Button Group webitem along with some other inputs from Drop Down webitem etc.
    --Priya

  • Building a TreeView control without ActiveX

    It's interesting, how to build TreeView control in LabVIEW without using of ActiveX technology? For example, LabVIEW Menu Editor (see attachment) has such control. This control seems to be developed in LabVIEW. Are anyone know, how to program such control? I have only idea to use multicolumn ListBox with hidden grid lines. But I can not insert picture (or color text) in it. The developers of LabVIEW can do it (see attachment)!
    Attachments:
    TreeView.zip ‏11 KB

    Ah yes, another LabVIEW "Holy Grail".
    I think you may be making a huge assumption that this wizard was created in LabVIEW. NI doesn't always use LabVIEW for these things.
    To see an example of what I believe is the best you can do with LabVIEW's standard tools to create a "tree view" check out the File Manager, located in the "Tools" menu under "VI Library Manager". This is a shining example of the best that most people can do using a List Control and the available symbols.
    Don't get me wrong, LabVIEW is capable of creating a true list view; however; you don't have the patience to write the code, as I would never try that.
    Perhaps someone will (or already has) created one, and has made this available. If you find one, let us all know, because we a
    re all seeking this Holy Grail too...
    PS: If I had to make a bet, I would guess that this wizard was either created using Visual C++, or perhaps even Visual Basic. Just don't tell anyone at NI I said the VB word...

  • How to stop voice control

    how to stop voice control?

    Hi Joannewpark,
    Press your Home Button to get to the Home Screen.
    Press Settings, then press again 2x fast - you will go to the Settings screen
    Press on General, then press again 2x fast - you will go to the General screen
    Use 2 fingers to indicate scroll up - Voice Over will begin to read the items on the screen, and will eventually get to the Accessibility option. When it says "Accessibility" press on it, then press on it 2x fast
    It will go to the Accessibility screen, tap on the Voice Over option one, and then again 2x fast, now tap on the Voice Over option again, and then double tap to turn it off.
    Cheers,
    GB

  • How to address form controls in jsp page

    Hello,
    I have a very stupid question. How do i empty the textfield value in my jsp page. I know that i can make a function that does that. but i dont know how to adress the control. Its got to be something like txtfield.setValue("myvalue") but i just dont know
    i cant find anything either on the internet. can somebody help me plz?
    thx very much,
    Kim

    Hi Kim,
    You can use the following JavaScript command:
    document.nameField.value = theValue;
    You can use this on submit of the form or in a click event at the field.
    I hope it be useful

  • How to get record control in sony ericsson p1i.

    How to get record control in sony ericsson p1i....
    does jsr234 helps??

    I'm not sure it is possible to get the PL/SQL record type through JDBC. Please try to access this procedure through JDBC to see if it is possible.
    You may need to convert the record type, to an object-type, i.e. wrap the procedure in another procedure that converts the record type. You could also just wrap the procedure in another that expands the record values into individual output parameters.

  • How to insert tabstrip control in module pool screen painter

    Hi all!
    plz tell e how to use tabstrip control in module pool screen painter.Also plz give me an example program using tabstrip control.

    To insert tabstrip just open layout of screen and press on the tabstrip button there .
    Use this souce code further to activate it .
    CONTROLS tabstrip TYPE TABSTRIP.
    DATA: okcode TYPE sy-ucomm,
    dynnr TYPE sy-dynnr,
    flag type flag,
    active like tabstrip-activetab .
    call SCREEN 100.
    *& Module USER_COMMAND_0100 INPUT
    text
    MODULE USER_COMMAND_0100 INPUT.
    data: lv_okcode type syucomm.
    lv_okcode = okcode.
    clear okcode.
    case lv_okcode.
    WHEN 'TAB1'.
    dynnr = '0110'.
    WHEN 'TAB2'.
    dynnr = '0120'.
    WHEN 'TAB3'.
    dynnr = '0130'.
    WHEN 'TAB4'.
    dynnr = '0140'.
    WHEN 'TAB5'.
    "check authorization, if authorization fails
    flag = 'X'. "set the global flag
    active = 'TAB1'. "store active tab in global variable
    dynnr = '0110'. "set the screen number
    WHEN 'BACK' or 'EXIT'.
    leave program.
    ENDCASE.
    IF lv_okcode(3) = 'TAB'.
    tabstrip-activetab = lv_okcode.
    ENDIF.
    ENDMODULE. " USER_COMMAND_0100 INPUT
    *& Module STATUS_0100 OUTPUT
    text
    MODULE STATUS_0100 OUTPUT.
    SET PF-STATUS 'MAIN'.
    SET TITLEBAR 'xxx'.
    IF tabstrip-activetab IS INITIAL OR
    dynnr IS INITIAL.
    tabstrip-activetab = 'TAB1'.
    dynnr = '0110'.
    ENDIF.
    "set the activetab explicilty here
    if flag eq 'X'. "from authorization failure
    tabstrip-activetab = active. "'TAB1'
    clear flag.
    endif.
    ENDMODULE. " STATUS_0100 OUTPUT

  • How build where clause in select statement in FM for Virtual provider

    Hi
    I looking for example of FM for Virtual provider where I find code how assign to select statement "where" clause value from query variable.
    In following code how build t_r_custtype range and how assign value to it.
    CODE********************************
    TYPE-POOLS: abap.
    initialize
      CLEAR: e_t_data, e_t_msg.
    this is specific to infoprovider VIRTPROV
      CHECK i_infoprov = 'VIRTPROV'.
      FIELD-SYMBOLS: <l_s_sbook> TYPE sbook,
                     <l_s_data>  TYPE ANY.
      DATA: l_t_component TYPE abap_compdescr_tab,
            l_t_sbook     TYPE TABLE OF sbook.
    initialize
      CLEAR e_t_data.
    Data selection / only Business Customer
      SELECT * FROM sbook
        INTO CORRESPONDING FIELDS OF TABLE l_t_sbook
        WHERE custtype in t_r_custtype.
    ENDCODE********************************
    Thanks a lot
    Adam

    Hello,
    Would you like fill the ranges in Customer exit for BEx..? 
    If Yes. please refer the attachment for the whole code...
    "Sample code in Customer Exit in BEx"
    IF i_step = 2.
    CASE i_vnam.
    WHEN 'ZDAY_CX'.
    LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'ZDAY_IN'.
    CLEAR: l_s_range.
    ZT_DT1 = loc_var_range-low.
    ZT_DT2 = loc_var_range-HIGH.
    CALL FUNCTION 'DATE_CREATE'
    EXPORTING
    ANZAHL_JAHRE = 0
    ANZAHL_KALTAGE = 0
    ANZAHL_MONATE = '-1'
    ANZAHL_TAGE = 0
    DATUM_EIN = ZT_DT1
    DATUM_EIN_ULT = ' '
    ULTIMO_SETZEN = ' '
    IMPORTING
    DATUM_AUS = ZFIDAY .
    E_TT =
    E_ULTKZ =
    CALL FUNCTION 'DATE_CREATE'
    EXPORTING
    ANZAHL_JAHRE = 0
    ANZAHL_KALTAGE = 0
    ANZAHL_MONATE = '-1'
    ANZAHL_TAGE = 0
    DATUM_EIN = ZT_DT2
    DATUM_EIN_ULT = ' '
    ULTIMO_SETZEN = ' '
    IMPORTING
    DATUM_AUS = ZLSDAY.
    E_TT =
    E_ULTKZ =
    l_s_range-low = ZFIDAY .
    l_s_range-high = ZLSDAY .
    l_s_range-sign = 'I'.
    l_s_range-opt = 'EQ'.
    APPEND l_s_range TO e_t_range.
    ENDLOOP.
    *****************************************End*************************************
    **To get the From date (For Text Variable) as per the user input date interval range**
    WHEN 'ZR_S'.
    LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'ZDAY_IN'.
    CLEAR: l_s_range.
    ZT_DT1 = loc_var_range-low.
    ZT_DT2 = loc_var_range-HIGH.
    CALL FUNCTION 'DATE_CREATE'
    EXPORTING
    ANZAHL_JAHRE = 0
    ANZAHL_KALTAGE = 0
    ANZAHL_MONATE = 0
    ANZAHL_TAGE = 0
    DATUM_EIN = ZT_DT1
    DATUM_EIN_ULT = ' '
    ULTIMO_SETZEN = ' '
    IMPORTING
    DATUM_AUS = ZFIDAY .
    E_TT =
    E_ULTKZ =
    l_s_range-low0(2) = ZFIDAY6(2).
    l_s_range-low+2(1) = '.'.
    l_s_range-low3(2) = ZFIDAY4(2).
    l_s_range-low+5(1) ='.'.
    l_s_range-low6(4) = ZFIDAY0(4).
    l_s_range-sign = 'I'.
    l_s_range-opt = 'EQ'.
    APPEND l_s_range TO e_t_range.
    ENDLOOP.
    *****************************************End*************************************
    Please let me know if any clarification required..
    Rinku..

  • How to handle the control records in case of file to idoc scenario.

    Hi All,
    can you please clarify me how to handle the control records in case of file to idoc scenario.

    Hi,
    In File to Idoc scenario even though you selected apply control record values from payload and you are not getting those correct values which you have provided in the mapping.
    Also check the checkboxes Take sender from payload and Take receiver from payload along with the Apply control record values from payload checkbox
    Regards
    Seshagiri

  • How to restore a control file without having its backup

    Hi,
    Can any one please suggest me how to restore a control file without having its backup.
    Thanks

    To add to what SB said, in years past the instructions for re-creating the control file manually were contained in the DBA Administration manual. It used to be and may still be common to be taking and saving a "backup control file to trace" for this purpose.
    If you lost only the primary copy of the control file and it is an OS file then while the database is shutdown you can copy the secondary over the primary and then use if to start the database. If the control file is stored in ASM then there should be a way to perform the copy via ASM.
    If you use rman for backups then a copy of the control file should be part of the backup process and you can retrieve it from the backup set then perform recovery using the backup control file though I do note the OP said something to the effect no backup exists. Still, I have knows of instances where the DBA did not realize that the backup set contained the control file and the spfile so I think this is worth mentioning just in case.
    HTH -- Mark D Powell --

  • How to use print control in Sap script

    I would like to use print control in Sap script.Actualy my problem I have security font Troy ECF. Using this font I would like to print amount field in Check printing.
    we count download this font with sap .we talked to customer care they told we should hard code in sapscript. pls can any1 help on this how to do and how to use print control for this fonts.

    call this funcation. crate_text.
    CALL FUNCTION 'CREATE_TEXT'
             EXPORTING
               FID               =
               FLANGUAGE         =
               FNAME             =
               FOBJECT           =
             SAVE_DIRECT       = 'X'
             FFORMAT           = '*'
             TABLES
               FLINES            =
           EXCEPTIONS
             NO_INIT           = 1
             NO_SAVE           = 2
             OTHERS            = 3
           IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
           ENDIF.

  • How to maintain Vertion Control in PL/SQL

    Hi all..
    How to maintain Vertion Control in PL/SQL. I created one procedure/function/
    package. After sometime, i made changes to it. How to maintain
    that changes. Writing manually in it, what are the changes i made is the
    only option OR is there any other option is there...?
    Thanks in advance,
    Pal

    Hi,
    Version control is there for tables in oracle, but i don't think it is available for plsql code. Best method will be to use the third party software. Using Flashback DB you can try source control certain extent.
    Regards,
    Satheesh Babu S
    http://aaryaan.com/

  • How to Create a Control In Notepad

    Hello:
    I am need help creating a control file. I have never done this before. I have to load the following script into notepad:
    load data
    infile 'names.txt'
    badfile 'names.bad'
    truncate
    into table names
    fields terminated by ','
    trailing nullcols
    (first,last)
    I then went to Command Prompt to begin the SQL Loader command and recieved the following message.
    SQL*Loader-500: Unable to open file (names.ctl)
    SQL*Loader-553: file not found
    SQL*Loader-509: System error: The system

    DUPLICATE post
    How to Create a Control In Notepad

Maybe you are looking for