TableName in another Table

Hello

I have a small question. I want to get a tabelname on another table.

I have a question 'P1_xyz' (selection list). This select list returns a name of a table in my database.

Now, I want to create a report (select * from...) where the part behind the keyword 'FROM' is in the item "P1_xyz". But it dosent work... The selection of the report do not show the two column...

Can someone help me?

Workspace: TEST_OA5
Username: [email protected]

password: Hund123


There is a single application, you can find it, really!


THX René

Hi RWErene81,

RWErene81 wrote:

There is only one thing, that I need too. I need the original titles in the columns of the tables / views. How can I do that. in your SQL query all columns that are named by col01, col02...

Can you explain or show me, how can I get the real column names?

See the 586 page of your application. I've implemented the dynamic report headers depending on the selected table.

That's what I did:

  • Page 586 - "Guard" report - column attributes - headers of Type-> set it to PL/SQL
  • Page 586 - "guard" report attributes - attributes of column - Type headers-> function of the sections of the colon delimited:
DECLARE

  L_LABEL_STR VARCHAR2(32000);

BEGIN

  -- get the column names if the table exists
  FOR REC IN ( SELECT COLUMN_NAME
                 FROM USER_TAB_COLUMNS
                WHERE TABLE_NAME = UPPER(TRIM(:P586_TIERAUSWAHL))
                ORDER BY COLUMN_ID )
  LOOP
    IF L_LABEL_STR IS NULL THEN
      L_LABEL_STR := REC.COLUMN_NAME;
    ELSE
      L_LABEL_STR := L_LABEL_STR ||':'|| REC.COLUMN_NAME;
    END IF;
  END LOOP;

  RETURN L_LABEL_STR;

END;

NOTE: in an opinion, here to show that I wrote directly the code into anonymous blocks for the dynamic query, as well as for the labels. You could make a formula with two functions and replace the anonymous by function calls as blocks:

For the query:

RETURN APP_REPORTS_PKG.FNC_GET_TIERE_QUERY (:P586_TIERAUSWAHL);

Label:

RETURN APP_REPORTS_PKG.FNC_GET_TIERE_LABEL (:P586_TIERAUSWAHL);

I hope this helps!

Kind regards

Kiran

Tags: Database

Similar Questions

  • a few fields in double writing to another table with separate records

    I have a requirement to write a few fields in duplicate a table and writes the separate records to another table. Please find the script below and share your ideas

    TableName: EMP_DETAIL

    EMPNO Date of birth CITY STATE GRADE
    12305051982FREMONTCAA
    45605051982FREMONTCAB
    78905051982FREMONTCAC
    22202021975SANJOSECAD

    (1) in table EMP_DETAIL, if we have duplicate fields date of birth, CITY AND STATE and take everything save random duplicates of this field and write in another table EMP_DETAILS_DISTINCT

    EXPECTED RESULTS: EMP_DETAILS_DISTINCT

    EMPNO Date of birth CITY STATE GRADE
    12305051982FREMONTCAA
    22202021975SANJOSECAD

    (2) in the EMP_DETAIL table, I want to search only duplicates of birth date, CITY AND STATE fields and write only duplicate in another EMP_DETAILS_DUPLICATE table records

    EXPECTED RESULTS: EMP_DETAILS_DUPLICATE


    EMPNO Date of birth CITY STATE GRADE
    12305051982FREMONTCAA
    45605051982FREMONTCAB
    78905051982FREMONTCAC


    Thank you!

    For the first query

    1) insert into EMP_DETAILS_DISTINCT select * from EMP_DETAIL where rowid in (select min (rowid) of the EMP_DETAIL group by date of birth, CITY, STATE);

    For the second query

    (2) insert into select EMP_DETAILS_DUPLICATE * from EMP_DETAIL where rowid not in (select min (rowid) of the Group EMP_DETAIL by DOD, CITY, STATE)

    Hope this will help you.

    Good day.

  • best way to create a table based on another table

    Hello
    I am trying to create a table based on another table with all the data in it. It contains important data.

    create table < tablename > select * from table1.

    Is the best way to do it, or is there another way. Please advice.

    Thank you

    Insert / * + append * / in as select * from ;

    It should be->

    insert /*+ append */ into 
    select * from ;
    

    Kind regards.

    LOULOU.

  • How can I do a summation of a table summarizing several points once, leaving me with another table?

    Hello, I tried to find a way to do the summation of a table, the sum of 19 points at a time, leaving me with another table.  I feel like this has a simple solution, but I'm not sure how.

    Thank you.

    A time loop that contains the subset of the table can do.

    Lynn

  • change the order of a table with another table

    I want to change the order of a 1 d table based on another table 1 d that specifies the order.  For example, I have a table including the following items: 12, 13, 14, 15, 16.  And I have another 1 d array that specifies the order of 3, 4, 0, 1, 2.  I want the table resulting in 15, 16, 12, 13, 14.  How can I do this?  It must be really easy.  Another example, I give myself a table in the order following 1,2,3,4,5,6,7 and I an order specifying the array containing the 0,6,1,5,2,3,4.  Therefore, the resulting table must be 1,7,2,6,3,4,5.  ???

    It is, in fact, quite easy.  Put an "Array Index" inside a loop and thread the two tables in it.  Disabled automatic indexing on the input array.  Wire of the array element located on the border of the for loop, and you'll have the desired table.

  • Not how to show a part of online data in a table in another table with even no column?

    I need to display the data from certain rows in a table in another table with the same numbers of columns and main table must be disabled. Could someone advice how to do this?    Data in the table are from the microprocessor and is intended the user can see and edit only some data.

    If someone can show me some advice, it will be a great help.

    Kind regards

    Annemariehoeven

    Disable a table: SetInputMode (panelHandle, controlID, 0);  ('1' to re - activate).

    Hide a table: SetCtrlAttribute (panelHandle, controlID, ATTR_VISIBLE, 0); ('1' to show it again).

    These commands are valid for each type of control.

    To extract values from the table, you can just use GetTableCellVal or GetTableCellRangeVals: If the range of cells has the same data type, you can use the second command which is faster; If the cells are different (for example digital and channels) you must solve each of them individually. The use of the Clipboard doesn't have this limitation.

  • Relations reapper after adding another table

    Hello

    I have a problem that after using the option to hide some of the stranger, they keys reapper after making a few changes on the diagram (addition of a new table). More specific: on the schema relationship, there are many references to the table T1, I don't want to not show them in the because there are too many lines and it is not necessary to indicate all the. But when I hide them (objects-> show/hide foreign keys) and add another table to the diagram, all relationships are back. Can this be prevented somehow? DM, Version 4.1.0.881

    Hello

    Thanks for reporting the problem. I logged a bug.

    Can this be prevented somehow?

    You can add new tables to the diagram using drag & drop from the browser - then only FKs associated that tables appear on the diagram.

    Philippe

  • UPDATE to update trigger another table

    I am trying to write a trigger to the table (AFTER UPDATE) in which I want to update the same table in a different pattern. Notice that both tables has no unique or primary key constraint, so I am forced to compare the values in the column all the to the place where the condition.

    Update OTHERSCHEMA. T1

    the value =:NEW.c1 c1, c2 is:NEW.c2...

    where c1 =:OLD.c1

    AND c2 =:OLD.c2

    Problem is when a column is null, it would seem that it is not comparable. I even tried

    Update OTHERSCHEMA. T1

    the value =:NEW.c1 c1, c2 is:NEW.c2...

    where NVL (c1, NULL) = NVL (:OLD.c1, NULL)

    AND NVL (c2, NULL = NVL (:OLD.c2, NULL)

    Nothing helps. Can someone help me to write the correct statement?

    Hello

    eyap wrote:

    I am trying to write a trigger to the table (AFTER UPDATE) in which I want to update the same table in a different pattern. Notice that both tables has no unique or primary key constraint, so I am forced to compare the values in the column all the to the place where the condition.

    Update OTHERSCHEMA. T1

    the value =:NEW.c1 c1, c2 is:NEW.c2...

    where c1 =:OLD.c1

    AND c2 =:OLD.c2

    Problem is when a column is null, it would seem that it is not comparable. I even tried

    Update OTHERSCHEMA. T1

    the value =:NEW.c1 c1, c2 is:NEW.c2...

    where NVL (c1, NULL) = NVL (:OLD.c1, NULL)

    AND NVL (c2, NULL = NVL (:OLD.c2, NULL)

    Nothing helps.

    Naturally.  NVL (x, NULL) is always x, no matter what x is.

    Can someone help me to write the correct statement?

    x = is returns TRUE if (and only if) x and have the same value, and it returns FALSE if (and only if) x and have 2 different values.

    NULL is not a value; in fact, it's quite the opposite.  NULL means that there is no value.  If x or is NULL, then x = y returns UNKNOWN.

    DECODE allows to compare values or NULL values, so you can do something like

    Update OTHERSCHEMA. T1

    the value of c1 =: NEW.c1

    , c2 =: NEW.c2

    ,       ...

    where LESS (DECODE (c1,:OLD.c1, 1, 0)

    , DECODE (c2,:OLD.c2, 1, 0)

    )

    ;

    If you would care to a full test script so that I can reproduce the problem, then I could test this.

    Triggers often indicate a bad table design.  Why do you need to replicate the data in another table?

    As you do, why not add a primary key?

  • Copy the result of a join to another table

    Hi all

    I want to copy the join of two tables in another table. I tried the following approach, but I have error

           insert into new_copy  values (ID,name,na_name)   
           SELECT
             name
            FROM
              country u
            INNER JOIN
              (
                SELECT
                 na_name
                FROM
                  country2 st
              )
              s
            ON
              u.id = s.ID;
    
    1. insert into new_copy (ID, name, na_name)
    2. SELECT i.id, u.name, s.na_name
    3. COUNTRY u
    4. INNER JOIN s countries2 ON u.id = s.id

    must be done

  • Drag N Drop table lines do not move a table to another Table

    Hello

    I use 11.1.7 to develop the drag N drop rows in one table to another

    1. I create a table in the schema hr as a student (sName, brands, sId, grade) & inserting values.

    2. I create EO & three your based on Student table... only three your from wise rank as (GroupAVO, GroupBVO, GroupCVO)

    3. I create page & panelgridLayout (3 columns, 1 row), I drop these three instances of VO tabular...

    4 drag the component Source and Drop target in these 3 tables...

    Run the page... page contains perfectly with the wise group of 3 tables...

    but when I drag a line a table to another table, lines do not move...

    I check my DB too... changes there too...

    No error and exceptions in my journal...

    What is the problem? Can someone help me?

    See also - Ashish Awasthi (Jdev/ADF) Blog: adding Drag and Drop functionality for collections in the fragments of the page to create insert

    Thank you

  • Cannot add another Table of Interface

    Hi all

    Recently, we had to restructure our e planning application to create another application.

    After creating my planning application, we now want to configure a data source in EPM System Configurator to add another table of Interface.

    After searching for some subjects like:

    - http://John-Goodwin.blogspot.PT/2011/10/loading-to-EPMA-planning-applications_8223.html or

    - http://docs.Oracle.com/CD/E12825_01/EPM.111/epm_architect/frameset.htm?ch03s02s01.html

    We cannot option Foundation-> Performance Management architect-> Interface of Configuration of data source that you can not see the next image.

    We have no Integrator ODI.

    Is it possible to add our table of interface in another way?

    Untitled.png

    11.1.2.2 it is set from the workspace - Configuration of Interface Data Sources

    See you soon

    John

    http://John-Goodwin.blogspot.com/

  • I'm trying to create another table and insert data to practice... How can I insert multiple values?

    I created another table for practice on two tables queries now.

    That's what I have:

    Insert in the test

    (address, age, status, DriverID)

    values ("131 Shore Drive", "Edison, NJ, 08011 ', ' 55', m ', '2').

    ("' 62 central avenue", "Middletown, NJ 08011', ' 43 ', am ', ' 1'");

    ('98 main street', ' Bristol, PA 19116 ', ' 67', the of ', '3' ").

    ('15 wrong Way', ' Long Island, NY 10111 ', ' 60', 'W', '4' '),

    ("' Kevin 9 Place", "New York, NY 10111 ', ' 25', the of ', '5'");

    It says command SQL is not properly terminated.

    Like this:

    Insert into test (address, age, status, DriverID)

    values ("131 Shore Drive", "Edison, NJ, 08011 ', ' 55', m ', '2');

    Insert into test (address, age, status, DriverID)

    values ("62 Middle Avenue", "Middletown, NJ 08011', ' 43 ', am ', ' 1'");

    ...

  • trigger for insertion of a table to another table

    Hello again,

    I tried to write a trigger after insert or update will happen in table 1, it will move some values in another table, as shown below:

    Create or replace trigger Insert_Amount_Credit after insert or update on Reciept_Voucher

    Referencing NEW AS NEW OLD OLD FOR EACH LINE AS
    Start

    Insert into customer_Details (Transaction_Date, client_name, Description, credit) values (new. Rec_Date, new. Client_name, CONCAT (' receipt number:', again.) Rec_ID), new. Amount);

    End;

    /

    The trigger was created but with compilation error... and my question is:

    1. How do I write the code above in the best way?

    2. How can I enough the other table with a table concatenated as what I was trying to make above?

    any idea?

    Something like that?

    CREATE OR REPLACE TRIGGER trig_ins_testtrg2

    BEFORE INSERT OR UPDATE ON test_trg1

    FOR EACH LINE

    BEGIN

    INSERT INTO test_trg2 (curr_date,

    job_id,

    reason,

    credit)

    VALUES (SYSDATE,

    : NEW.id,.

    : NEW.receipt_no |:NEW.description,.

    (: NEW.amount);

    END;

  • [11g] ORA-22993 when extracted xmltype great values in the outbreak of the BIU as a CLOB in another table

    [I ask nicely for a few comments for this question.

    Someone else can reproduce it with the test below?

    Is my code invalid or false?

    Or what is the problem here?

    -Thank you

    Frank

    ]

    Hello

    Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production

    PL/SQL Release 11.2.0.3.0 - Production

    CORE Production 11.2.0.3.0

    AMT for Linux: Version 11.2.0.3.0 - Production

    NLSRTL Version 11.2.0.3.0 - Production

    Trigger Before Insert or Update to a table, I invoke a PL/SQL package function to check the size of an xmltype column (passing as IN OUT NOCOPY).

    PL/SQL functions retrieves the xmltype. GetClobVal(), check its size, and when it is beyond a limit, he tries to insert the data into another table (GTT - global temporary table).

    Finally, it changes the value of the value of the column of xmltype to the shorter XML (just by referring to the corresponding record in the TWG).

    But the Insert SQL in the TWG operation strike ORA-22993: specified input is greater than the amount actual source.

    I don't know why this happens. In the internet I only find references on importing files in lob/clob.

    Anyone have the same problem?

    I know that you prefer to have a sample program to demonstrate the problem - I'll try to post one, but it will take time.

    But maybe someone can help me based on the information above already.

    -Thanks a lot!

    Best regards

    Frank

    I have reproduced the issue.

    It must be a bug.

  • Validation form column against the value of another Table

    Hello

    I'm new to this forum, so please bear with me a bit!  I only have a small amount of writing PL/SQL experience, and I've never written Javascript or JQuery before.  I am an Oracle DBA and I coding experience C and PERL, so I have a strong technical background.  But I need some advice on the best way to approach a problem.

    I have an application of data base in Oracle Apex (version 4.2) with a tabular form on a table: Let's say that #1 with the conditions of licence 1 a, 1 b, and1C.  I have to make sure that the value entered in col B is not greater than the value of a column in another table (for example table #2 pass 2 (a).  From a conceptual point of view, the amount of money available is in the #2 table, and my tabular form lines are an act of spending money (such as orders or invoices), so I have to make sure that we spend more that we have.  Who is?

    Does anyone have tips for the best way to do it?  I'm figuring that the biggest problem here is perhaps to account for people who enter multiple lines in the form of tables at the same time, right?  So, if a person is entered 3/invoices, I need a total to ensure that they do not have spend more than we have in the #2 table.

    I really appreciate your help!

    Best regards

    Laurie Baublitz

    Ah, I was not totally with you on this charge then. My validation works overall, but it totals the amount for each line, regardless of the task. Okay - who was not totally my solution but more a demonstration of the technique that you can use to validate your tabular presentation in this way.

    You could solve this issue with a safe collection, or with a table plsql where you add an entry for each task name and keep the amount stored in there.

    Anyway, it would be better for you to spend a little time on playback on the plsql collections or collections apex!

    Remember, this is a sample and you will need to take stock of it. The best solutions are those where you need to experiment with 8)

    DECLARE
      TYPE tt_taskamount IS TABLE OF NUMBER INDEX BY VARCHAR2(20);
      t_taskamount tt_taskamount;
    
      l_task VARCHAR2(20);
      l_amount NUMBER;
      l_max NUMBER;
    BEGIN
      -- F02 is the taskname
      -- F03 is the amount
      -- adapt to your situation!
      FOR i IN 1..apex_application.g_f02.count
      LOOP
        l_task := apex_application.g_f02(i);
        l_amount := apex_application.g_f03(i);
        IF NOT t_taskamount.exists(l_task) THEN
          t_taskamount(l_task) := l_amount;
        ELSE
          t_taskamount(l_task) := t_taskamount(l_task) + l_amount;
        END IF;
    
        -- it's not the best idea to perform a select each time and could be
        -- done better but for the sake of the example it's fine
        -- not too bad either if the rowcount is small.
        SELECT maxamount
          INTO l_max
          FROM table2
         WHERE taskname = l_task;
    
        IF t_taskamount(l_task) > l_max THEN
          -- returning will stop further processing and throw an error message as soon as a budget has been overrun
          -- it might or might not be required behaviour but that's up to you
          RETURN 'The max amount ('||l_max||') for task ' || l_task ||' has been exceeded. Reduce the total amount on associated tasks!';
        END IF;
      END LOOP;
    END;
    

Maybe you are looking for