How to give the table name as input for the insertion procedure parameter

Hello
Could a little help in this scenario,
Here is an example of how to insert,
where the 'b' table name will change at each
is there a possible way to keep the name of the table as an input parameter

SQL > CREATE or REPLACE PROCEDURE PROC_INSERT as
BEGIN 2
3 INSERT INTO A
4 (ID, NAME, LOC)
5. SELECT ID, NAME, B LOC;
6 VALIDATION;
7 END;

Kind regards
Vikram

If you need to pass the object name to a SQL running, you must use dynamic SQL statements.

A simpler way is the following

create or replace procedure proc_insert
(
     pTableName varchar2
)
as
begin
     execute immediate 'insert into a (id, name, loc) select id, name, loc from ' || pTableName;
     commit;
end;

Tags: Database

Similar Questions

  • How to give the bios password and secure in windows 7

    How to give the bios password and secure in windows 7

    Hello

    BIOS - FAQ
    http://Windows.Microsoft.com/en-us/Windows7/BIOS-frequently-asked-questions

    Check with the manufacturer of your system (manufacturer of motherboard for customized systems)
    information on the definition of a BIOS password.

    I hope this helps.

    Rob Brown - Microsoft MVP<- profile="" -="" windows="" expert="" -="" consumer="" :="" bicycle=""><- mark="" twain="" said="" it="">

  • How to give the necessary time and unite all files of images together?

    Adobe first Pro 7.2.1 CC

    I insert image PNG files in pieces of the track for example 50 and got dry duration for each Image at 06:07. I need 00.03 for each of them make an animation so I have to cut and drag each of them separately. How to give the required duration and unite all together faster?

    Before you import the files again (e.g.: PNG), go to Preferences > General > still Image default duration:

    You can set the default there. This will apply to the newly imported files, but (it will not apply to the files that you have already imported).

  • How to give the user ONLY views all SYS?

    My DBA cannot give me all s/n priveligies, but does not know how to give me ONLY priveligies all SYS views (v$ sql, v$ sqltext, process$ v, dba_scheduler_jobs,...)

    How to give the user to display all VIEWS SYS?

    in my case should be 1)? Right?

    The privilege or role will provide the desired access.

  • How to move the insertion point from editText ScriptUI?

    Hello.

    How to move the insertion point from editText ScriptUI?

    Please tell me the JS code.

    Thank you.

    I don't think you can. You can control the selection of text in an editText widget, but not the position of the insertion point.

  • How to give the user name, pwd, db in a URL of 10g of forms?

    We organize our application using this URL: http://192.168.11.216:7778/forms90/f90servlet? config = inforoam

    How pass us the username/pwd@db to this URL? that is we do not want to look, we want to automatically connect to the system in a .NET PROGRAM, a connection box.

    Hello

    Add user name in the URL:

    http://192.168.11.216:7778/forms90/f90servlet?config=inforoam&userid=Scott/Tiger@dbalias

    Concerning

  • How to dynamically create table names?

    I need to dynamically create arrays with array variable names.

    for example, something like this:

    for (var n = 0; n < nodeContainer.length; n ++) {}

    nodeObj = nodeContainer [n];

    var name: String = nodeObj.nodeID;

    table [name]: Array = new Array(); will create the table as "arrayName?

    }

    How?

    Although MovieClip is a dynamic class, classes that extend it DO NOT INHERIT of dynamic features.

    You'd become a big favor if you read the documentation:

    http://www.Adobe.com/LiveDocs/Flex/201/langref/statements.html#dynamic

    To be a class dynamic it must be explicitly defined as such. In your case, it should:

    SerializableAttribute public class dynamic couple extends MovieClip

    And, even once, you REALLY need to understand the AS3 syntax. I'm sorry for you teaches, but despite suggestions you insist on doing bad, although solutions are presented in the clearest way possible.

    The line var myObject ["v_" + VNAME] = new Object(); is a total nonsense in terms of syntax. If you have read my previous message (s), you must write it this way:

    var myObject:Object = new Object();

    ["v_" + VNAME] myObject = new Object();

  • How to give the parameter for the set_menu_item_proprty?

    Hello

    I saw the sub menu...
    I know that the syntax of set_menu_item_property.
    set_menu_item_property ('menuname.menuitem', Enabled, property_true);

    But in my case, THE POINT (IE TABLE2) IN THE MENU is disabled status.
    I want to like activate State.
    I wrote the code below in the menu startupcode...
    set_menu_item_property('XYZ0100.) TABLE2 "(, activé, property_true);"
    IT DOES NOT WORK... SHOWING AN ERROR CANNOT FIND THE MENU ITEM.
    THUS,.
    What values should pass instead of NomMenu and menuitem?
    IMAGINE IT IS LIKE IN FORM BUILDER

    -Menus
    -XYZ100
    + Home libraries
    -Menus
    + FILE_MENU
    + EDIT_MENU
    + HELP_MENU
    -XYZ100
    -Objects
    FILE
    EDIT
    Help
    + XYZ0901
    -XYZ0902
    TABLE1:
    TABLE2
    TABLE 3
    TABLE 4

    Hello

    IT DOES NOT WORK... SHOWING AN ERROR CANNOT FIND THE MENU ITEM.

    This error means that you not give good menu name and the name of the element.

    Open the menu and select the menu that you want to turn on and off dynamically, then press F3 (to call the browser of the object). You will find the menu name and the name of the (current) element. Note that menu name and the name of the element and then use as below...

    SET_MENU_ITEM_PROPERTY('MENU_NAME.ITEM_NAME',ENABLED,PROPERTY_TRUE);
    

    -Clément

  • External link - how to give the link of a theme of subproject about main project

    Hi all

    I created a main and two subprojects and project master merged these two subprojects.

    I scoured all the external link topics in this forum.

    As a result, I was able to give the link of a main project theme about a subproject.

    However, I need your help to achieve the following two things:

    A first:
    =======
    I need to give a link to a section of the subproject in a master project topic...

    For example. Introductory section is located in the Master project

    When I click on a button in a subject found in the subproject (merged with the masterone), I should be able to view the introductory section.

    How can this be achieved...

    A second:
    ==========
    I manually included a home button in each header and footer of all subjects (depending on condition), which opens the present welcome topic in the main project)-pretty easy

    However, I'm fighting to give the link to the present home button in the subproject merged to open the welcome topic of the master of the project.

    Pls guide me how to do it...

    Thankx in advance...

    Try to remove the underlining from your CHM file names, reissue and compilation. Do not use underscores or other special character traits.

  • How to pass the content of the table as OUT of the stored procedure parameter

    Hi all

    I am writing a stored procedure where he must accept date as one of the parameters IN and it must interrogate the table of database on this criterion and should address data in a temporary table.

    in the end, he must send all the data from the temporary table as the OUT parameter.

    How to get there? should I create a new TYPE with all the columns in the Temp table and use this Type as a parameter? or SYS_REFCURSOR is the best option.

    Thanks in advance.

    Hello

    The best way to do what you want depends on what you want.  Start by describing what you need to do.  It is best to post some data examples (CREATE TABLE and INSERT statements), and what results you want from this sample data.  (See the FAQ forum: https://forums.oracle.com/message/9362002)

    If you have any ideas on how to do the work (for example, populating a temporary table) it may be useful to include those who, too, but a clear distinction between WHAT you do and HOW you do it.

    Bencol suggested, a SYS_REFCURSOR may be the best way to transmit the results.

    Since you only post your table, or even describe what you wanted to do with it, I will illustrate using scott.emp, which is probably on your system.

    Say you want a procedure that takes a DATE as an argument, then returned a certain designated columns (empno, ename, and hiredate in the example below) for all employees hired from the given DATE.  You can write a procedure like this:

    CREATE OR REPLACE PROCEDURE hired_since

    (IN start_date DATE

    out_data ON SYS_REFCURSOR

    )

    AS

    BEGIN

    OPEN FOR Out_data

    SELECT ename, empno, hiredate

    FROM scott.emp

    WHERE hiredate > = start_date;

    END hired_since;

    /

    DISPLAY ERRORS

    You can test it in SQL * more like this:

    VARIABLE c REFCURSOR

    EXEC hired_since (DATE ' 1982-01-01',: c);

    PRINTING: c

    The output I received this test was:

    ENAME, EMPNO, HIREDATE

    ---------- ---------- ---------

    7788 SCOTT APRIL 19, 87

    7876 ADAMS MAY 23, 87

    7934 MILLER JANUARY 23, 82

  • How to give an instance name of a loaded image?

    Once an external image is loaded via a charger, how an instance of this name?  Can I simply do the following:

    var ImageInstance:bitmapdata = new bitmapdata (loader.content);

    I need to associate it with an interpolation it is display object using AS3, method of the AnimatorFactory class addTarget().

    Hi you want to display the name of the installer image

  • Using variables such as table names. Ideas for alternative designs

    Hello

    I am the design of an application that uses synonyms to pull information from the 'client' DBs via links from DB. Synonyms are created with a DB_ID in name (example: CUSTOMER_100, CUSTOMER_200... where the 100 and 200 are DB IDs of 2 separate DBs customer.)

    I have a procedure that selects data in the synonym based on what DB_ID is passed to the procedure. I want to be able to perform this procedure for any entered DB_ID. I know now I can't use variable for the table names names and using EXECUTE IMMEDIATE does not seem suitable for what I'm trying to do.

    Does anyone have suggestions or re-design options, I could use to achieve this generic procedure which will select a certain synonym based on the information of DB input parameters? Thank you.

    CREATE or REPLACE PROCEDURE CUSTOMER_TEST (p_host IN VARCHAR2, p_db_name IN VARCHAR2, p_schema in VARCHAR)

    IS

    v_hostname VARCHAR2 (50): = UPPER (p_host);

    v_instance VARCHAR2 (50): = UPPER (p_db_name);

    v_schema VARCHAR2 (50): = UPPER (p_schema);

    v_db_id NUMBER;

    v_synonym VARCHAR2 (50);

    CURSOR insert_customer

    IS

    SELECT

    c.customer_fname,

    c.customer_lname

    OF v_synonym_name c;

    BEGIN

    -MADE BASED ON INPUT PARAMETERS DB_ID

    Select d.db_id

    in v_db_id

    of t_mv_db_accounts ac.

    t_mv_db_instances I,.

    t_mv_dbs d,

    t_mv_hosts h

    where ac.db_ID = d.db_ID

    and i.db_ID = d.db_ID

    and i.HOST_ID = h.host_id

    and upper (H.HOST_NAME) = v_hostname

    and upper (D.DB_NAME) = v_instance

    and upper (Ac.ACCOUNT_NAME) = v_schema;

    -ADD DB_ID TO NAME SYNOYNM

    v_synonym: = 'CUSTOMER_ | v_db_id;

    FOR cust_rec IN insert_customer

    LOOP

    INSERT INTO CUSTOMER_RESULTS (First_Name, Last_Name)

    VALUES (cust_rec.customer_fname, cust_rec.customer_lname);

    END LOOP;

    COMMIT;

    END;

    /

    RGS,

    Rob

    EXECUTE IMMEDIATE ' INSERT IN CUSTOMER_RESULTS (First_Name, Last_Name) SELECT customer_fname, customer_lname FROM ' | v_synonym;

  • table name not valid error when inserting values into a table

    I use the following statement to insert values into a table:

    curs. Execute ("INSERT INTO _ * '%s' * _ VALUES ((SELECT MAX (REC_ID) + 1 OF GSAP_MSG_IN), (SELECT MAX (gsap_msg_id) + 1 OF GSAP_MSG_IN), 'SHELLSAP', sysdate, '%s', EMPTY_BLOB(), 1, SYSDATE, EMPTY_BLOB (), SYSDATE)" %(*table_name*,file_extension)) ")

    whence table_name the following statement

    table_name = ' config.staging_db_tablesNames ['in_msgs]

    as I created a configuration file for all parameters that can change. The value of the table in the audit using a print command is correctly, but when put in the query above to run the insert statement gives an error. The following is the summary of comprehensive performance where you can see the table name as

    $ python gsapscnr.py
    Vote for the data files in/home/mh/inbox /...

    GSAP_MSG_IN
    Traceback (most recent call changed):
    File "gsapscnr.py", line 147, in it?
    poll_for_data()
    File "gsapscnr.py", line 86, in poll_for_data
    Sorter = load_details_first)
    File "gsapscnr.py", line 42, survey
    curs. Execute ("INSERT INTO '%s' VALUES ((SELECT MAX (REC_ID) + 1 OF GSAP_MSG_IN), (SELECT MAX (gsap_msg_id) + 1 OF GSAP_MSG_IN), 'SHELLSAP', sysdate, '%s', EMPTY_BLOB(), 1, SYSDATE, EMPTY_BLOB (), SYSDATE)" %(table_name,file_extension)) ")
    cx_Oracle.DatabaseError: ORA-00903: invalid table name

    Can anyone help with this problem please. I'm passing the value of the table in a bad way. Also if anyone can suggest a good tutorial for paythong programming using cx_Oracle.

    Concerning

    Print the SQL string that you establish, cut and paste it this output in SQL * more and see if it runs. This may show you that you should remove the single quotes around the name of the table %s in the Python file.

  • How to show the stored procedure code

    Hello
    How can I get the code for creating a stored procedure using sqlplus instead of sql-developer? I want to get all of the code of the stored procedure. I saw it in writing

    SQL > desc proced_1

    I get the Argument Name, Type and input/output by default of the stored procedure, but if I want to get the code 'create procedure', how can I do?
    Thank you!

    Hai

    Try this

    Select * from user_source where name = 'Procedure_name '.
    online ordering;

    Concerning

    Srikkanth.M

  • How to call the stored procedure from javascript? (Google suggest, AJAX)

    Hi I want to set up a text field so that it behaves like [Google Suggest | http://www.google.com/webhp?complete=1 & hl = en].

    I read this post .

    Now, I installed everything according to this document. But it simply doesn't. And I don't know why.

    I think that problems can fall into the following three categories:
    1. the text field and the page invoking the appropriate javascript?
    2 - is the JavaScript call the stored procedure?
    3. the stored procedure correctly returns the result formatted?

    I'm assertive for 1 and 3, but I'm not sure 2. Because I don't know how if a stored procedure has been called? Is there a PL/SQL statement that I can query in SQL * more?

    Also, I would like to know how to debug AJAX in the APEX. It involves a lot of things.

    Finally, I used APEX 3.2 and Oracle XE. I can't find file dads.conf or marvel.conf. Is ' / apex / "the virtual directory for APEX?

    Thank you very much!

    Buffalo,

    I managed to make it work on XE with APEX 3.2!
    It took more time than expected because my XE installation was still on an earlier version of the Apex and I had put it first...

    But that's what I did:
    -in the ac.js file, I changed the path ' / apex / "and I added the ac.js file to my candidacy as a static file. So as you did.
    -J' copied my request to the XE and copied my procedure on the schema that is related to my request
    -J' gave to run anonymous rights my procedure

    Now at first, it did not work...
    Then I suddenly remembered something: If you want to run a procedure through the pl/sql gateway in the XE, XE please how it is.
    Do you this by changing the APEX_030200.wwv_flow_epg_include_mod_local function!

    This is the code for the function changed for my example:

    CREATE OR REPLACE function APEX_030200.wwv_flow_epg_include_mod_local(
        procedure_name in varchar2)
    return boolean
    is
    begin
        --return false; -- remove this statement when you modify this function
        --
        -- Administrator note: the procedure_name input parameter may be in the format:
        --
        --    procedure
        --    schema.procedure
        --    package.procedure
        --    schema.package.procedure
        --
        -- If the expected input parameter is a procedure name only, the IN list code shown below
        -- can be modified to itemize the expected procedure names. Otherwise you must parse the
        -- procedure_name parameter and replace the simple code below with code that will evaluate
        -- all of the cases listed above.
        --
        if upper(procedure_name) in (
              'MATTHIASH.INCSEARCH') then
            return TRUE;
        else
            return FALSE;
        end if;
    end wwv_flow_epg_include_mod_local;
    /
    

    After that, the AJAX function worked as expected...

    HTH
    Matthias Hoys

    Published by: mhoys on August 13, 2009 15:24

Maybe you are looking for