The result of sort set return per EXTRACT for XMLTYPE

What is the best way to order the output return by extract?

My SELECT statement:
SELECT
regexp_replace (regexp_replace (Extract (XmlType (t.message_xml), ' / / event '), '< Event >', "),' < / event > ',',')
OF SUB_XML T

Output current: EVT_B3_TRAN, EVT_B3_PROD, EVT_B3_FX, EVT_B3_ACC, EVT_B3_PRICE
Required output: EVT_B3_ACC, EVT_B3_FX, EVT_B3_PROD, EVT_B3_PRICE, EVT_B3_TRAN

Publish your data in the example so that people can help you.

You'd better to extract the contents of the XML file by using the XMLTABLE feature rather than an excerpt with regexp_replace string functions.  Process the XML in XML format, not as strings.

Example:

SQL > ed
A written file afiedt.buf

1 with t as (select xmltype ('))
2 EVT_B3_TRAN
3 EVT_B3_PROD
4 EVT_B3_FX
5 EVT_B3_ACC
6 EVT_B3_PRICE
7
") in XML of the double)"
8  --
9. end of XML example
10-
11. Select listagg (event, ',') the Group (order by rn) as events
12 years of)
13. Select x.event
14, row_number() (x.event order): the nurse
15 t
16, xmltable ('/ event/XML ')
17 passage t.xml
path of 18 columns event varchar2 (20) '.'
19                       ) x
20*      )
SQL > /.

EVENTS
----------------------------------------------------------------------
EVT_B3_ACC, EVT_B3_FX, EVT_B3_PRICE, EVT_B3_PROD, EVT_B3_TRAN

Tags: Database

Similar Questions

  • Select the event to add (or subtract) per day for a date field

    I have a form that gives me a little trouble. I want to be able to enter a start date in a field, and then enter a number of days in another field and then have it calculate a date that is the number of days from the start date. The form is actually work very well most of the time, but there are a few problems I encounter.

    1 end date does not immediately calculate out the number of days. You need to tab all the way back to the start and date only when you leave that field does calculate the end date I need to calculate when you leave the number of days.

    2. I added a small (+) and (-) button to increase or decrease the date by one day. It works, but the problem is, I want to do it in the background. Which means, I want the calculated date to change, but the number of days field not change.

    Tell me if I go on 01/12/2010 to the start date. Then I go 1 in the # of days field. When I tab to the calculated date field, it must immediately change to 02/12/2010. So, if I click on the (+), the date calculated field should go up to 03/12/2010, but the number of days field should stay at 1.

    I downloaded a sample of what I've understood so far:

    https://Acrobat.com/#d=v4c4KKdj0hesicxO8yO1pw

    Thanks a lot for any help I can get on it!

    JO

    I think that's what you're after. I moved the logic to calculate the date event deadline and added a numeric field to store the result of the addition/subtraction (called 'delta').

    Form1. #subform [0]. date2::calculate - (FormCalc, client)

    var date1 = Date2Num(date1.formattedValue,"MM/DD/YYYY")

    $.rawValue = Num2Date(date1+days+delta,"MM/DD/YYYY")

    You could do 'delta' hidden.

    Steve

  • Reference Dell 2400 will start when the power cord connected to the mains, or after restoring power. Is the result of a setting on the computer?

    The computer is turned off.  If the electricity is off, the computer will automatically start once power is restored.

    I guess it's a desktop pc that is a few years old and yes some early atx power supplies will do it, creepy when there was an interruption of the power supply when you are out and go home to find the pc on.

  • How to pass parameter in the function extract (for XMLTYPE)

    I have a table with XMLTYPE field xml_column PROBLEMXML. In this column, there are many deffinitions for the problem. There is no amount deffinitions max and there can be no definition at all. I need to return all the definitions of all the problems a string wirh separate definitions by '; '.

    Query
    SELECT extract (prob. Def,'/definitions/definition[1]/@var'). ';'|| excerpt (prob. Def,'/definitions/definition[2]/@var')
    OF PROBLEMXML j.
    XMLTABLE)
    "/ problem.
    PASSAGE j.xml_column
    Probid VARCHAR COLUMNS (31) PATH ' / problem/@id',
    Prob def XMLTYPE PATH ' / problem/definitions ")
    where PROBLEM_ID = 1;
    Returns exactly what I want one; m.
    But
    declare
    my_variable varchar2 (2000): = null;
    number of N1;
    number of N2;
    Start
    N1: = 1;
    N2: = 2;
    SELECT extract (prob. Def,'/definitions/definition[N1]/@var'). '|'|| excerpt (prob. Def,'/definitions/definition[N2]/@var') in my_variable
    OF ETL_PROBLEMXML_STG_T j.
    XMLTABLE)
    "/ problem.
    PASSAGE j.xml_column
    Probid VARCHAR COLUMNS (31) PATH ' / problem/@id',
    Prob def XMLTYPE PATH ' / problem/definitions ")
    where PROBLEM_ID = 1;
    dbms_output.put_line ($my_var);
    end;
    Returns null.
    Is there a way to switch the setting to extract the function?

    You have string literal death of n1 and n2. Note the change to select it.

    DECLARE
      my_var VARCHAR2(2000) := NULL;
      n1     NUMBER;
      n2     NUMBER;
    BEGIN
      n1 := 1;
      n2 := 2;
      SELECT extract(prob.def, '/Definitions/Definition[' || n1 || ']/@var') || '|' ||
             extract(prob.def, '/Definitions/Definition[' || n2 || ']/@var')
        INTO my_var
        FROM etl_problemxml_stg_t j,
             xmltable('/problem' passing j.xml_column columns probid VARCHAR(31) path '/problem/@id',
                      def xmltype path '/problem/Definitions') prob
       WHERE problem_id = 1;
      dbms_output.put_line(my_var);
    END;
    

    Published by: RPuttagunta on December 13, 2010 09:18

  • Photosmart 6510 - Windows 7 - I need to the Port ID to set up my modem for wireless connection

    Printer: PhotoSmart 6510

    Operating systems: Windows 7

    Modem: Huwawei E586

    The printer configured easily to the modem for wireless connection.

    The problem I have is that my laptop cannot see the IP address of the printer when I try to configure a wireless connection.

    I am trying to add the IP address of the printer to the virtual server from the modem list.

    What is the PORT ID required by the printer?

    This information is not in the installation notes.

    I found it. It is Port 9100

  • Reinstall the C4180 with disc - set up of stops for administrator privileges

    Running a printer uninstalled C4100 Win Vista Home Prem 2007 32-bit software and use the original CD to reinstall.  System requirement message: newspaper and then as a user with administrator privileges.  Don't know what that means.

    Looks like you hit a problem with the installation of the printer. Here is a link to direct downloads driver:

    http://h20000.www2.HP.com/bizsupport/TechSupport/ProductList.jsp?cc=us&prodSeriesId=1142450&TaskID=135

    In addition, in General, this message indicates that the account you are using is not an administrator account and that it doesn't have sufficient permission to perform this action. Make sure that you use an administrator account.

    Let me know what happens and I'll get right back with you!

    -Spencer

    PS: Have a wonderful day!

  • How can I find the aim or the result of an event of photoshop?

    Hi all

    Is there a method of extracting information about the results of a trial of Photoshop? For example, after can a delete event ("Dlt") I get any information on what has been deleted?

    Specifically, my current needs are to find which layer has been removed after a delete event.

    The relevant js in my project code is:

    function registerPSEvent( typeIDs, clear ){
      // unregisters an even before adding it - prevents double events
      var regUnreg = null;
      if( clear ){
      console.log( 'Unregistering ' + typeIDs );
      regUnreg = 'PhotoshopUnRegisterEvent';
      } else {
      console.log( 'Registering ' + typeIDs );
      regUnreg = 'PhotoshopRegisterEvent';
      }
    
      var e = new CSEvent(
      'com.adobe.' + regUnreg,
      'APPLICATION',
      csInterface.getApplicationID(),
      csInterface.getExtensionID()
      );
      e.data = typeIDs;
      csInterface.dispatchEvent(e);
    }
    
    // s2t is simply an abbreviation of stringIDToTypeID
    function addPSEventListener( typeStrings, callback, target ) {
      csInterface.evalScript( "s2t('"+typeStrings+"')", function(r){
      registerPSEvent( r, true );
      registerPSEvent( r );
      csInterface.addEventListener( 'PhotoshopCallback', callback.bind(target) );
      } );
    }
    
    addPSEventListener( 'delete', delLayerEventHandler, this );
    
    delLayerEventHandler = function(e) {
      console.log(e);
      // here i would like to be able to get what was deleted
    }
    
    

    Thank you

    Tom

    I just discovered that, when an event is received event.data holds 2 ints.

    I thought that these 2 numbers were due to me using stringIDToTypeID rather than charIDToTypeID. However, the second number is a way to access all the attributes of the event. So I now use the function below to get info about the event:

    function get_event_descriptor (id) {}

    var / / desc = new ActionDescriptor();

    try {}

    desc.fromID (id);

    Aref var = desc.getReference (s2t ('null'));

    var aref_obj = {}

    DCLASS: t2s (aref.getDesiredClass (s2t ('null'))),

    name: aref.getName (),.

    ID: aref.getContainer () .getName)

    };

    return JSON.stringify (aref_obj);

    } catch (e) {}

    Returns false;

    return JSON.stringify (e.message);

    }

    }

    ID is the 2nd int returned in event.data.

    Currently, I just dug around enough to make sure that the class of event parameter is returned correctly but cela is sufficient for my current needs.

  • JavaScript Confirm box depends on the results of query

    Hello

    I use Apex version 3.2.1 and I'm looking for a way to do the following, any help much appreciated:

    A javascript confirm will appear when the user sends a page if the result of a query returns something, the query should look like this...

    SELECT * FROM LINKEDPROJECTS
    WHERE ENV_ID =: P18_ENV_ID
    AND ID_COMP =: P18_COMP_ID
    AND DATE_FROM < = to_date (: P18_DATE_TO, 'DD-MON-YY')
    AND DATE_TO > = to_date (: P18_DATE_FROM, 'DD-MON-YY')

    If it returns no data page will present as usual, if it does not return the data from the confirmation box will appear, and the message will be also the result of a query-driven.

    If the message would be something like...

    Project (s) + "select the NAME OF PROJECTS WHERE ID IN (SELECT PROJ_ID FROM LINKEDPROJECTS WHERE ENV_ID =: P18_ENV_ID +)"
    + AND IDENTIFIANT_COMPOSANT =: P18_COMP_ID +.
    + AND DATE_FROM < = to_date(:P18_DATE_TO, 'DD-MON-YY') +.
    + AND DATE_TO > = to_date (: P18_DATE_FROM, ' MON-JJ-AA "") "+ have this environment for the dates you selected.  Do you want to continue with the reservation?

    By selecting Yes submits the page, select no hands it to the page.

    Had this work now, if it can help someone else out there that's what looked like my javascript in the end...

  • call run params in the taskflow with the results of the previous run

    I have a requirement to call the executeParams on the object from a point of view after the execution of the executeparams on another display object in a taskflow. I'm able to pass the variable to the view object binding 1 of taskflow input parameters. But variables bind to the view of the second depends on the results (current line, it returns only one row) execution of view 1st in the taskflow.

    How to bind to the 2nd display performance variables in the taskflow according to the results of enforcement of 1 view. The second point of view expects 2 parameters of the current line of the 1st viewiterator.

    Taskflow definition:

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

    executeWithParams1stView-> executeParams2ndView-> .jsff


    The page definition for the second executewithParams with links, I configured. But the following returns no results of the 2nd iterator. But if I pass values hardcoded for the NDValue I get the correct results.


    < action IterBinding = "AgencyPoliciesIterator" id = "ExecuteWithParams" RequiresUpdateModel = "true" Action = "executeWithParams" >
    < NamedData NDName = "bPolicyNum".
    NDValue = "${data.renewal_policyterm_taskflow_renewal_policyterm_taskflow_ExecuteWithParamsPageDef.PolicyNum.inputValue}" "
    NDType="oracle.jbo.domain.Number"/ >
    < NamedData NDName = "bAgencyNum".
    NDValue = "${data.renewal_policyterm_taskflow_renewal_policyterm_taskflow_ExecuteWithParamsPageDef.AgencyNum.inputValue}" "
    NDType="oracle.jbo.domain.Number"/ >
    < / action >


    Thank you and best regards,

    S R Prasad

    Published by: oumar s Prasad on November 10, 2010 13:36

    Hello

    I don't know exactly what the problem with your application, but maybe you could try to create a method in the application module impl.
    If I understand correctly, you must run the firstVO as soon as the taskFlow is called and based on the line returned by one, run the secondVO.

    You can do this with a method in the ApplicationModuleImpl. I created an example:

    public void executeViewObjects(Number managerId){
        if(managerId!=null){
          getDepartments1().setNamedWhereClauseParam("inManagerId", managerId);
          getDepartments1().executeQuery();
          Row dep=getDepartments1().first();
          if(dep!=null){
            Number departmentId=(Number)dep.getAttribute("DepartmentId");
            getEmployees1().setNamedWhereClauseParam("inDepartmentId", departmentId);
            getEmployees1().executeQuery();
          }
        }
      }
    

    If you expose this method and drop in your taskFlow you can map it is the input of the taskFlow parameter input parameter.

    Gabriel.

  • Police in width fixed in the results tab

    I know how to change the font of the Code Editor for a fixed-width font. I really want to change the font of the results page and sets the data for a font to width tab. I can't find where I can change the default behavior.
    I want a string containing six spaces to be visually the same length of six characters in the result tabs. I can't believe that this is not possible, so I must be overlooking something.

    Kind regards
    Rob

    You're not overlooking what whatever - this is not yet implemented.
    You can vote on the request to http://apex.oracle.com/pls/otn/f?p=42626:39:239845519465032:NO:P39_ID:7001 to add weight for future implementation.
    Also, try to play with the +\sqldeveloper\system1.5.4.59.40\o.sqldeveloper.11.1.1.59.40\ide.properties+ file in your user profile. The current options inside are just for size, but maybe you can find a modifier for the police...

    BTW, management, this request is marked "in 1.1", but it is obviously not. Please update the State.

    Kind regards
    K.

  • Add the value of point two apex and display the result in another part of the apex

    Hello

    I need to make the addition of the two item values using apex.item.text and find the result in another apex.item.text.

    For example:
    SELECT
    apex_item. Text(1,null) ONE
    apex_item. Text(2,null) TWO
    apex_item. Text(3,null) RESULT
    FROM EMP
    please suggest me

    Thank you
    Sudhir

    >
    No it does not add the two values in the column, user key to enter the value, it must add the value of the item and displays the result in a dynamic way. Need a suggestion for using javascript
    >
    This requirement was not not clear in the op.

    See the demo of Denes Kubicek.

    This topic is discussed far too often. Have you tried to Oracle Application Express (APEX) and adapting one of the many examples of LoV cascading to your situation?

    See you soon,.

    PS: Tip:
    Look for the p_item_id and p_attributes of the APEX_ITEM API parameters.
    You can call JS functions for example using p_attribute

    APEX_ITEM.TEXT(...
    p_attributes => 'onchange="doTotal(this);"', /* doTotal being your JS Function */
    ...
    

    Published by: Dominic August 16, 2012 11:52

  • Find the archive logs generated per day (for 7.3.4 database)?

    I use a query like the one below to determine the average amount archives logs generated per day for a database for a month:

    Select sum (GB_USED_PER_DAY) count (GB_USED_PER_DAY) in (SELECT
    To_char(completion_time,'YYYY-mm-DD') completion_date,
    round (SUM (block_size *(blocks+1)) / 1024 / 1024 / 1024, 2) GB_USED_PER_DAY
    V $ archived_log
    WHEN TRUNC (completion_time) BETWEEN
    TRUNC(SYSDATE-30) AND TRUNC (SYSDATE)
    GROUP OF TO_CHAR(completion_time,'YYYY-MM-DD')
    order by 1 desc);

    This query does not work on Oracle 7.3.4 database. Anyone know how I can calculate average archive generation of newspapers per day for Oracle 7.3.4?

    Thanks in advance!

    Select substr(first_time,1,8), round (sum (bytes) /(1024*1024)) MB of v$ log group by substr (first_time, 1, 8);

  • How to test a procedure returns the result set

    Hello

    I have a following code:

    {color: #0000ff} create or replace the TYPES of PACKAGING
    AS
    type cursorType is ref cursor;
    end;

    create or replace PROCEDURE GetAllCategories (p_cursor in the Types.cursorType)
    AS
    Start
    Open p_cursor for SELECT * CATEGORY;
    end; {color}

    I would like to test the procedure of * {color: #000000} visualization output resultset {color} *. How can I do with SQL Developer?
    In fact, when select RUN in SQL Developer, I got the following code:

    DECLARE
    P_CURSOR types.cursorType;
    BEGIN

    GetAllCategories (P_CURSOR = & gt; P_CURSOR);
    END;

    When I run it, it is successful but there is no result set displayed. However if I execute SELECT * FROM category only in the SQL Editor, I see the result set in the grid. Then where the result set did when he went through the procedure?

    Thanks in advance for any help.

    Published by: CarbonFiber Sep 22, 2008 20:52

    Is a simple way with sqlplus

    SQL> create or replace package types
      2  as
      3     type cursortype is ref cursor;
      4  end;
      5  /
    
    Package created.
    
    SQL> create or replace procedure getallemp(p_cursor in out types.cursortype )
      2  as
      3  begin
      4     open p_cursor for select * from emp;
      5  end;
      6  /
    
    Procedure created.
    
    SQL> var lcursor refcursor
    SQL>
    SQL> exec getallemp(:lcursor)
    
    PL/SQL procedure successfully completed.
    
    SQL> print lcursor
    
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO        DIV
    ---------- ---------- --------- ---------- --------- ---------- ---------- ---------- ----------
          7369 SMITH      CLERK           7902 17-DEC-80        800                    20         10
          7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30         10
          7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30         10
          7566 JONES      MANAGER         7839 02-APR-81       2975                    20         10
          7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30         10
          7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30         10
          7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10         10
          7788 SCOTT      ANALYST         7566 19-APR-87       3000                    20         10
          7839 KING       PRESIDENT            17-NOV-81       5000                    10         10
          7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30         10
          7876 ADAMS      CLERK           7788 23-MAY-87       1100                    20         10
    
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO        DIV
    ---------- ---------- --------- ---------- --------- ---------- ---------- ---------- ----------
          7900 JAMES      CLERK           7698 03-DEC-81        950                    30         10
          7902 FORD       ANALYST         7566 03-DEC-81       3000                    20         10
          7934 MILLER     CLERK           7782 23-JAN-82       1300                    10         10
    
    14 rows selected.
    

    Thank you
    Knani.

  • Sort the results of interactive report in no data found message

    Hello

    I have an interactive report that returns results based on the: bind variable QUERY - I have a list of navigation on the side where all the elements to link to the current page with different values of request. The IR works fine until I try to sort the columns by clicking on the heading and selecting increasing / decreasing, how it returns no data available.

    It starts to work again if I change the last line of GOLD: REQUEST IS NOT NULL but this breaks the functionality of the report, I would like to return only selected articles or all if no query variable is present. I'm guessing that sort sets: ASK something temporarily and divides. My query is below, any ideas?
    SELECT   id,
             job_number,
             appt_start,
             domain,
             pwa,
             status,
             tstamp_created 
      FROM   fail_jobs 
      WHERE  (status = 'NEW' AND userid_created != 'SYSTEM' AND :REQUEST = 'ARD') 
         OR  (status = 'ATR' AND :REQUEST = 'ATR')
         OR  (status IN ('ERR','REV') AND :REQUEST = 'REV')
         OR  (status = 'COM' AND :REQUEST = 'COM')
         OR  (status IN ('PCD','PCA') AND :REQUEST = 'PCD')
         OR  :REQUEST IS NULL
    Thank you

    There are problems with interactive reports referencing known: DEMAND value, probably due to an internal logic that manages also simultaneously - potentially cause a malfunction or blockages.

    A workaround that I learned is to create a calculation to assign: APPLICATION to a temporary element (a PXX_REQUEST, for example) and reference it in the query, instead of: ASK. This has worked well for me in my experience.

    I would like to know if this helps - pls sign the thread as 'Useful' or 'Correct' if so, so more people can benefit.

    TKS,
    Kléber

  • Select a table returned in the result of the query

    Hi, I'm trying to find a way to query a table name that I'm back to a different query. I am doing this in pure SQL and PL/SQL, if I can.

    Here's the situation. I have a table called FILES, a table called TYPE and an unknown number of different reference tables with different names.

    Each entry in the FILE has a reference to a TYPE id, and each entry type is a varchar that contains the name of a table reference, such as PHOTO_INFORMATION, PDF_INFORMATION or XML_INFORMATION.

    I want to be able to extract the data from the reference table for any data file. So with a file id, I question TYPE to get the name of the reference table (IE, "PHOTO_INFORMATION" back) then the request it is at this table for all of its columns, using the reference id in the FILE table.

    The thing is that I wish it were generic, so that I can just add an entry to AA_TYPE and a new table for this type, and then I can ask her but I want, through the FILE table. The reason is that there are some data that is common for all files, and I would like to that data in one place.

    Here is my paintings, I have two reference tables of the sample to the bottom "AA_FILETYPE1" and "AA_FILETYPE_PHOTO".
    CREATE TABLE  "AA_FILES" 
       (     "FILE_ID" NUMBER, 
         "FILE_NAME" VARCHAR2(4000), 
         "FILE_TYPE" NUMBER, 
         "REFERENCE_ID" NUMBER, 
          CONSTRAINT "AA_TEST_FILE_PK" PRIMARY KEY ("FILE_ID") ENABLE
       )
    /
    
    CREATE TABLE  "AA_TYPE" 
       (     "TYPE_ID" NUMBER NOT NULL ENABLE, 
         "REFERENCE_TABLE" VARCHAR2(4000), 
          CONSTRAINT "AA_TYPE_PK" PRIMARY KEY ("TYPE_ID") ENABLE
       )
    /
    
    CREATE TABLE  "AA_FILETYPE1" 
       (     "REFERENCE_ID" NUMBER, 
         "DATE_MODIFIED" DATE, 
         "SUMMARY" VARCHAR2(4000), 
         "TOTAL_VALUE" NUMBER(5,2), 
          CONSTRAINT "AA_FILETYPE1_PK" PRIMARY KEY ("REFERENCE_ID") ENABLE
       )
    /
    
    CREATE TABLE  "AA_FILETYPE_PHOTO" 
       (     "REFERENCE_ID" NUMBER NOT NULL ENABLE, 
         "DATE_TAKEN" DATE, 
         "CAMERA_NUMBER" VARCHAR2(4000), 
         "WEATHER_CONDITIONS" VARCHAR2(4000), 
         "CONSULTANT_NAME" VARCHAR2(4000), 
          CONSTRAINT "AA_FILETYPE_PHOTO_PK" PRIMARY KEY ("REFERENCE_ID") ENABLE
       )
    /
    Here's an example query I would use:
    select * from (select REFERENCE_TABLE from AA_TYPE where TYPE_ID = AA_FILES.FILE_TYPE) where REFERENCE_ID = AA_FILES.REFERENCE_ID;
    So who withdrew all the columns in the reference given in AA_TYPE table based on an entry in AA_FILES.

    I'm not entirely sure how to do this, or if this is possible even without using PL/SQL.

    I'm open to suggestions on how to achieve what I want with a different design of table, I am a student and I'm not really experienced in database design. (My first design of database class isn't until next year!)

    Thank you very much!

    Hello

    [email protected] wrote:
    Sorry about the confusion about file_id = 3, I meant the insert in the third I've included. I did not indicate the id_fichier in my inserts since it is the main key and it auto increments.

    It is important to post of the CREATE TABLE and INSERT statements that work. All those who want to help you to will want to recreate the problem and test solutions. Also, do not use strings for all entries. If the column is a NUMBER, use a NUMBER in the INSERT statement. If the column is a DATE, use a DATE or a function that returns a DATE.
    So you should post something like:

    insert into AA_FILES(FILE_ID, FILE_NAME, FILE_TYPE, REFERENCE_ID) values (1, 'test-photo-1.jpg',  1,  1);
    insert into AA_FILES(FILE_ID, FILE_NAME, FILE_TYPE, REFERENCE_ID) values (2, 'test-xml-1.jpg',    2,  2);
    insert into AA_FILES(FILE_ID, FILE_NAME, FILE_TYPE, REFERENCE_ID) values (3, 'test-photo-2.jpg',  1,  2);
    -- The value file_type=1 immediately above was not in your original data, but seems to be what you meant.
    
    prompt =====  AA_TYPE Table:  =====
    
    insert into AA_TYPE(TYPE_ID, REFERENCE_TABLE) values (1, 'AA_FILETYPE_PHOTO');
    insert into AA_TYPE(TYPE_ID, REFERENCE_TABLE) values (2, 'AA_FILETYPE1');
    
    prompt =====  AA_FILETYPE1 Table:  =====
    
    insert into AA_FILETYPE1 (REFERENCE_ID, DATE_MODIFIED,                 SUMMARY,                                    TOTAL_VALUE)
           values           (1,           TO_DATE ('01-01-02', 'MM-DD-RR'), 'An XML file that has some information about something', '14');
    
    prompt =====  AA_FILETYPE_PHOTO Table:  =====
    
    insert into AA_FILETYPE_PHOTO (REFERENCE_ID, DATE_TAKEN,                 CAMERA_NUMBER, WEATHER_CONDITIONS, CONSULTANT_NAME)
                    values            (1,          TO_DATE ('01-01-01', 'MM-DD/RR'), 'abc123',      'rainy!',         'John Smith');
    insert into AA_FILETYPE_PHOTO (REFERENCE_ID, DATE_TAKEN,                 CAMERA_NUMBER, WEATHER_CONDITIONS, CONSULTANT_NAME)
                    values            (2,          TO_DATE ('01-01-02', 'MM-DD/RR'), 'def456',      'slightly cloudy',  'Jane Jones');
    commit;
    

    To give you my workplace, I'm applying in Application Express. A user has entered the number '3' the file_id (I'm not worried about the distinction between passing in the id_fichier and the name of the file, I just my application one application or the other).

    Now, run a query that will get related data which table it is stored in. I don't know the name of the table at design time, as that particular file may be of any type (each of which has a different table name). However, with a the file_id, I have a file_type (in aa_files) which refers to an entry in aa_type.

    I see. You could add even add new tables after this query is written. As long as the new table has a column named reference_id, and there is a line for the new table in aa_files, the following query should work.

    >

    select FILE_TYPE
    from AA_FILES
    where FILE_ID = 3
    

    I stored the name of the table, I need to ask for the rest of the data in aa_type at design time, so using the file_type value, I can get the name of reference_table:

    select REFERENCE_TABLE from AA_TYPE where FILE_TYPE = 1
    

    In the sample data, you have validated, Type_de_fichier = 2 on the 3rd row. I've changed that in my example 1 revised data.
    Be very careful that your explanation fits your data. You talk to people who know about your application, and it is very easy for them to be induced in error or confusion.

    Now the '1' is here that the first query would return. I would like to use a subquery to combine these two queries into a single (I think?). This second query would return "AA_FILETYPE_PHOTO", which is the reference table.

    So I have the reference table, which is a name of table to another table in my database. It contains the data that I'm actually looking for. I want it for this particular file (file_id 3), and in aa_files, I have a value of "reference_id", which refers to the respective line in the reference table. File_id 3, the reference_id is 2.

    select * from AA_FILETYPE_PHOTO
    where reference_id = 2
    

    If the above query gets me my final data.

    Now, I've been watching substitution values and bind variables, here's another way to explain what I want:

    Explanation step by step below is very useful. It would be more useful if each step uniquely and gavce movement results given the sample data and an example of setting (3 in this case)

    -- get the file_type from aa_files for the desired file
    EXEC :file_type := (select file_type from aa_files where file_id = 3);
    

    That we will call the step step (a) above.
    Step (a) sets: Type_de_fichier 1 (given my corrected sample data)

    -- get the reference table from aa_types using the file_type
    EXEC :reference_table := (select reference_table from aa_type where type_id = :file_type);
    

    That we will call the step step (b) above.
    (B) sets the stage: reference_table to 'AA_FILETYPE_PHOTO '.

    -- get the reference_id from aa_files for the desired file
    EXEC :reference_id := (select reference_id from aa_files where file_id = 3);
    

    That we will call the step step (c) above.
    (C) sets the stage: reference_id 2

    -- using the reference table and reference id for the desired file, get the rest of the data
    select * from :reference_table where reference_id = :reference_id;
    

    Not sure if this makes it more clear or not.

    Yes, it helps a lot.

    Basically I have a table full of table names. How do I write a query that pulls one of these table names and it then queries?

    You need SQL dynamic, because you can't hardcode a table name in the query that you normally would be.
    How dynamic SQL works normally (and the functioning of this example) are that the query is built by using a variable. In SQL * more (as shown below), you can simply use a variable substitution instead an identifier hardcoded, and that's what it takes to make the dynamic query from SQL * more resolves the substitution variables before sending the code for the compiler. I don't know much on the Apex, but I bet there's some way to do dynamic SQL in the Apex, too.
    So the dynamic part here should include step d, since you can't hardcode the name of the table in the query.
    Until we can step (d), then, did they to us to do the steps (a) and (b) to obtain this file name. In the example blelow, I used a separate, preliminary request to get the & table_name...
    Step (c) could be made in the main query, using a subquery or a join. However, I chose to step (c) in the preliminary motion, as well as steps (a) and (b), since it's the same table same step (a). In this way, step (d) must refer to a table.

    Here's (finally) how to make this work in SQL * more:

    ACCEPT     file_id     PROMPT     "Enter the file_id (a number, e.g. 3): "
    
    -- Preliminary Query, to set table_name
    
    COLUMN     reference_id_col     NEW_VALUE     reference_id
    COLUMN     table_name_col           NEW_VALUE     table_name
    
    SELECT  f.reference_id          AS reference_id_col
    ,     t.reference_table       AS table_name_col
    FROM      aa_files     f
    JOIN     aa_type          t     ON     f.file_type     = t.type_id
    WHERE     f.file_id     = &file_id
    ;
    
    --     Main Query
    
    SELECT  *
    FROM     &table_name
    WHERE      reference_id     = &reference_id
    ;
    

    The results, account required to the data from the sample I posted above, and the & file_id 3, are:

    `                      CAMERA_    WEATHER_        CONSULTANT_
    REFERENCE_ID DATE_TAKE NUMBER     CONDITIONS      NAME
    ------------ --------- ---------- --------------- ---------------
               2 01-JAN-02 def456     slightly cloudy Jane Jones
    

Maybe you are looking for

  • Update the Bios HP 6710 b CNU7371RXQ

    Hello! I'm looking for the bios update for my 6710 b but cannot be found in the drivers section this tool for Windows 7 Ultimate. Also the search in the support site does not find my model specifications when you enter the serial number? Sorry for my

  • Drag and drop files to the icon of the EXE

    I was wondering if there is a way for the user to drag and drop files on the .exe icon and it would launch the program to do something with these files automatically? For example: Some PDF convertor programs allow you to drag and drop documents, imag

  • with color predetermined waveform graph

    Hello I have a table of waveforms. Now, I want to view a graph of a waveform in a way that only two or three colors to be specified of waveforms. for example if my table consist of 150 wave forms, 50 first waveforms must be displayed with the color r

  • ATAPI - event ID:11 - the pilot detected an error on \Device\Ide\IdePort0 controller.

    I'm getting following error in my event log Watcher: Log name: SystemSource: atapiDate: 2009-11-01 01:18:38Event ID: 11Task category: noLevel: errorKeywords: ClassicUser: n/aComputer: hendrim-PCDescription:The driver has detected an error on \Device\

  • DVD rw drive no longer works, but he said fine in Device Manager

    my dvd player has been disabled, my Device Manager shows that it isn't. What must I do to make it work?