How to use the variable instead of the table name in the select statement of procedure

I have a procedure with a select statement with dynamic from clause. How can I use instead of the name of the table variable.

create or replace procedure scc_chemical_analysis
is
v_table_name varchar2 (100);
Start

declare
cursor c1 is select * from v_table_name; -This is the variable name. How can I use it in the select statement.
.
.
.
.



end;

Hello

something like that.

  1  declare
  2     vSQLString      VARCHAR2(32000);
  3  pTableName varchar2(1000):='EMP';
  4  BEGIN
  5     vSQLSTRING :=
  6  'SELECT ''x'' FROM ' || DBMS_ASSERT.sql_object_name(pTableName) || ' WHERE rownum<=1 ';
  7     EXECUTE IMMEDIATE vSQLSTRING;
  8* END;
SQL> /

PL/SQL procedure successfully completed.

Tags: Database

Similar Questions

  • How to use the select statement in loop for

    Hi all

    My question is can I use a select statement in for loop like as follows.

    for the key in the selection of one_table key.

    When I use this am getting an error as found select invalid I ID

    How to select a statement use in loop for

    Please suggest me.

    Thank you
    Sree

    Hello

    You can use code below

    For key in (select button from table_a)
    loop
    If key.key = 1 then
    -insert statement
    on the other
    -Select statement
    end loop;

    Thank you
    Naveen.

  • How to use the selection tool to resize a text box? Before I was able to click on the text box with the selection too in order to resize, but now I click on it and it only gives me 'path' or 'anchor' options.

    How to use the selection tool to resize a text box? Before I was able to click on the text box with the selection too in order to resize, but now I click on it and it only gives me 'path' or 'anchor' options.

    Ashley,

    What about window > show the rectangle enclosing (Ctrl / Cmd + Shift + B to toggle)?

  • How to pass parameter in the function using the select statement?

    Hello

    I had a problem. I can't pass as parameter to the function by using the select statement. But it can pass as a parameter using the "code". How can I solve this problem?

    For example,.
    Select * from table (SplitFunction ('HS750020, HS750021')) < < < this work.

    but

    Select * from table (SplitFunction (select LOT_NO in the TRACER_SEARCH_SCHEDULE where JOB_ID = '36')) < < < do not work.

    Thank you for trying to help him. Thank you.

    Select * from table (SplitFunction (select LOT_NO in the TRACER_SEARCH_SCHEDULE where JOB_ID = '36'))< do="" not="">

    Try like this

    select * from table(select splitfunction(lot_no) from tracer_search_schedule where job_id='36')
    

    Just make sure that your subquery returns only 1 row.

  • In version 5, how to use the selection tool to move items?

    I can use the selection tool to select objects, but when I try to drag, nothing happens. My solution is to use the selection tool to select an object, then use the transform tool to drag the object in its new position. Any help is greatly appreciated.

    Start by restoring your InDesign preferences. Tutorial here:

    http://PFL.com/TRB

  • How to display the data type long using the select statement

    Hai All

    I have to select the text of a view. But the text is declared as long and I need to see full view

    When I use this

    Select the text in all_views where view_name = "DAILY_ATTEND_VIEW";

    I have got only half of a select statement

    Concerning

    Srikkanth.M

    Hello

    SQL> SET LONG 100000
    SQL> select text from user_views
      2   where view_name='MVIEW';
    
    TEXT
    ------------------------------------------
    select e.empno,e.deptno,d.dname
    from emp@sdblink e,dept@sdblink d
    where e.deptno=d.deptno
    

    But it is limited to sql alone. If you use the double click TOAD on the text column in the grid will show you the entire SQL views.
    Unfortunately, there is limitation to consider,
    The largest value that you return from the function would be 32 k (RETURN VARCHAR2), both.

    Twinkle

  • How to use the type of packages, procedures and functions in another schema?

    I have two schema target in an OWB project, such as A and b. In a map of A, I would use some packet types, functions and procedures of B. I tried the method of the suggested such synonym, but I couldn't find the metadata of these when importing... The only type of synonym I can import is the synonym for the table. Y at - it a bug for synonym?

    If I can't use a synonym for that matter, is there another way to solve the problem?

    Now, in some cases you will absolutely need to create the second module as Carsten described, but it should also be noted that you can reference objects in things like Expressions even if you have not loaded the metadata. It's only when you need strong bonding that it becomes necessary to import objects. For everything else, as long as the reference can solve during the compilation so you are good to go.

    For example, I target a function in a schema (S1) and a synonym private that it in another (s2). A mapping of the S2 schema has an expression object that uses the synonym of the function in the expression property for a couple of the attirbutes of output. The synonym has not been loaded in metadata - OWB has indeed no knowledge of its existence. But she is resolved at compile time if the mapping validates and generates successfully.

    Mike

  • Help: How to use the Case statement in the ODI11g Interface?

    Hello
    My basic source I get 'Year' values and I want that these values result code in the interface and after translation want to push on the target system.
    Example:
    Database source, I get value for
    Year
    2010
    2011
    2012

    When I get the year 2010 I want to change the value in "FY10".
    When I get year 2011 I want to change the value in "FY11.
    and even for the year 2012 to "FY12.
    I've tried to make the Case statement, but had no success.
    I don't want to create the lookup table in the source system.
    Any help in this matter.

    Thank you

    Concerning
    Sher

    Published by: Sher Ullah Baig on August 26, 2012 17:52

    CASE
    WHEN source_column = '2010' THEN 'FY10.
    WHEN source_column = '2011' and THEN 'FY11.
    WHEN source_column = '2012' and THEN 'FY12.
    END

  • Insert a variable + string using the select statement with cfquery

    I'm doing an insertion by a select statement where the insert for one of the fields should be a combination of a vaule comes from the selection and concatenated with a string of text. Is this possible and if what the correct syntax so? Here is an example of what I'm trying, but does not.

    < name cfquery = "createnote" datasource = "#application.datasource #" >
    INSERT INTO gtbl_notes (notedate, strCustomerID, notetype, note, notecreatedby)
    SELECT "#currentdate #", strCustomerID, "miscellaneous", "#gtbl_people.email # DELETED because of HARD BOUNCE ', 'Bounce Routine.
    OF gtbl_people, gtbl_bounces
    WHERE gtbl_bounces.email = gtbl_people.email AND gtbl_bounces.subscriber = 1 AND gtbl_bounces.status = 2

    < / cfquery >

    Any input would be greatly appreciated.

    Concatonation is possible with most, if not all of the databases.  The syntax is a specific software and you do not your specify.

  • [JS CS5] How to get the selected state of a multi-state object

    Does anyone know if there is a way to identify the State of a multi-state object is selected?

    You can select different States of an object of several State in the States Panel.

    In the object model.

    Mon_etat = app.selection [0].states.item (0);

    myState.active = true;

    .. .all the first State to the DSO. But I can't understand how to identify the State in which is currently visible. This doesn't seem to be possible in the object model, unless I'm missing something. Any ideas?

    Hey!

    Take a look at 'activeStateIndex' of MSO.

    Hope that helps.

    --

    tomaxxi

    http://indisnip.WordPress.com/

  • Update using the Select statement

    I have a requirement of the main table was updated. Here is an example
    Example (a) works in PL SQL but does not work in Forms6i.
    Example (b) works in PLSQL so in Forms 6i.

    I need work example (a) in forms 6i. What is the solution


    one)
    UPDATE fman_validation_master SET TOT_HRS = TOT_HRS +.
    (SELECT SUM (FAV. H TOT_HRS)
    OF FMAN_ACTQTY_VALIDATION FAV
    WHERE fman_validation_master. = PROJECT: CONTROL. PROJECT AND
    fman_validation_master. PROJECT = fav. PROJECT AND
    fman_validation_master. ACTIVITY_CODE = FAV. ACTIVITY_CODE
    FAV GROUP. PROJECT, FAV. ACTIVITY_CODE
    ) where of the = project: CONTROL. PROJECT;


    (b)
    UPDATE fman_validation_master SET TOT_HRS =
    (SELECT SUM (FAV. H TOT_HRS)
    OF FMAN_ACTQTY_VALIDATION FAV
    WHERE fman_validation_master. = PROJECT: CONTROL. PROJECT AND
    fman_validation_master. PROJECT = fav. PROJECT AND
    fman_validation_master. ACTIVITY_CODE = FAV. ACTIVITY_CODE
    FAV GROUP. PROJECT, FAV. ACTIVITY_CODE
    ) where of the = project: CONTROL. PROJECT;

    Hello

    According to Oracle 8.1, you can say:

    UPDATE  table_x
    SET     column_a = exp;
    

    where exp is any expression, or

    UPDATE  table_x
    SET     column_a = (ssq);
    

    where ssq is now called a scalar subquery. Oracle 8.1 sometimes allowed scalar subqueries in places where the documentation did not say that they were allowed. The first statement is an example, when you use

    tot_hrs + (ssq)
    

    as an expression. It works in SQL * Plus and also in PL/SQL, but (apparently) not in the forms.

    Re-write your UPDATE statement so that the scalar subquery appears in itself to the right of the sign =, like this:

    UPDATE     fman_validation_master
    SET     tot_hrs =
         (
         SELECT     fman_validation_master.tot_hrs + SUM (fav.tot_hrs)
         FROM     fman_actqty_validation     fav
         WHERE     fman_validation_master.project          = fav.project
           AND     fman_validation_master.activity_code     = fav.activity_code
         )
    WHERE     project = :control.project;
    

    In other words, just move the original fman_validation_master.tot_hrs (to which you add the SUM) of the main request in the subquery.

  • How to use the United States-International keyboard in Windows 8

    Hello

    I can't find a way to US International keyboard configuration in Windows 8. It's really frustrating because I like working with an English keyboard, but I often have to write Spanish accents or special characters.
    Best regards, Miguel.

    Hello

    Took me a little while to understand it as it is not obviously accessible somehow...
    Please, try the following. Go to 'Control Panel\Clock, language and Region\Language', click English (United States)... 'options', then 'Add an input method', search for [QWERTY] United States International Touch Keyboard layout (in my case) or similar; then 'Add '.
    Once he shows up the international sort, DELETE the default English input method.
    You should then be able to n, a e i o u without delay by pressing first the focus then the letter
    Then hold down the Ctrl and Alt keys +! do
    Then hold down the Ctrl and Alt keys +? do
    I hope this helps.
    Pablo
  • Creating a table using the Select statement of the physical layer

    Hello

    I use 10G, and I have the sub query in my physical layer. I chose the type of Table as Select and gave the SQL below. When I say the number of lines of update updates lines 93, that is correct, but does not show me the columns, or when I say display data, it does not show me the data, please see if I'm doing something worng. Thanks for your time and your help.

    Select (select program_id, project, actvty_id, commitment_date, row_number() over (partition by order project by commitment_date desc) as rnk project, actvty_id, program_id, commitment_date)
    of project_detail) a
    where rnk = 1

    Yes, create columns individually and click view data, you'll be able to get data

  • JCheckBoxMenuItem with Action aid - how to get the selected state

    Hello

    I have a JMenu with some JCheckBoxMenuItems. I want to use with an Action. Is it possible to get the status of the Action CheckBoxMenuItem selection?

    Thanks in advance
    Dominik

    Swing only updates the Action.SELECTED_KEY property if it has been set, so when you create your action you must set this value.

    myAction.putValue(Action.SELECTED_KEY, false);
    
  • How to write the SELECT statement

    Commission of the CARDS
    0-20 0
    21-25 500
    26-31 650
    32-36 850
    37 > 1050


    If a PERSON sells 28 cards in one month, commission would be calculated as below.

    25 * 500 = 12500
    3 * 650 = 1950

    Total commission 14450

    I guess that's what you're looking for...

    CREATE TABLE WG (A NUMBER);

    INSERT GT VALUES (0);

    INSERT GT VALUES (28);

    SELECT * FROM GT

    0
    28

    SELECT THE CHECK BOX
    WHEN IS > = 0 AND<=20 then="">
    WHEN WAS > = 21 AND HAS<=25 then="">
    WHEN WAS > = 26 AND HAS<=31 then="">
    WHEN WAS > = 32 AND HAS<=36 then="">
    WHEN > = 37 THEN 36 * 850 + (A-36) * 1050
    ON THE OTHER
    NULL VALUE
    END TEST
    THE GT;

    Output:

    0
    14450

    Thank you...

Maybe you are looking for

  • X 220-card Whitelisted WWAN to W10

    Unfortunately, the Ericsson F5521gw W7 driver that worked for W8.1 works more on W10. Is it possible to find a WWAN card for the X 220 which would work in W10?

  • modell FWB bridge diode error

    Hello! I discovered a mistake in the fwb rectifiers modells. The reverse Breakdown voltage is set to 100V, even on the parts that have a rating of 1kV in real life. For example: 3N252. When inside the 230 v AC, then it's not market. As I see it, mode

  • Error code 800F0811 when you try to install service pack 2 for vista

    Original title: error code 800F0811 when trying to install service pack 2 for vista tried booting in minimum mode and reset my compents windows update or where he worked? When try to install service pack 2 for vista tried clean boot and reset my wind

  • BlackBerry Smartphones unable to delete or to update contact

    Hello I noticed other people have had this problem and tried to solve using suggestions, but to no avail. I got an error that says "Recordset bad peripheral", I used the DataPurgeUI program and found a contact on my BlackBerry Pearl 8120, I can't del

  • SWF files

    Hello, sorry if this is a stupid question I tried to do my research to find a solution but did not find anything. So this is my last ditch effort before I break my laptop in two. I add some graphical features of movement to my Muse portfolio site. I