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

Tags: Database

Similar Questions

  • Refresh the result table or rerun the query

    I have a requirement, simple but stuck somewhere.

    Jdev 11.1.1.17 Expert level: Mid-Senior

    I have a form of application and the associated result table. It works great and no problems.

    My requirement is that I have a commandlink on one of the column. Clicking on that will open a popup with an editable filed. OK will commit and Cancel will close the pop-up window.

    After that the popup is dismissed with partial trigger, my table refreshes but data is identical to the front. But if I click the Find (Search) button on the query, it shows the data with the results updated which are changed in the pop-up window above.

    How do I update table which re - runs the query and then refreshes the table after the popup is dismissed, or when the user clicks the OK button in the pop-up window.

    Get on the viewObject of this table and call the executeQuery method that

    Write this method in the method AMImpl and then call it in bean managed using the OperationBinding at the click on the Ok button of the dialog box

    ViewObject vo = this.getViewObjectName ();

    vo.executeQuery ();

    Ashish

  • Filter the table display of the query object (it can a bug in jdev 12)

    Hello:

    I found an error/bug possible in jdeveloper 12 c when I migrate my application of jdev 11g.

    To test this issue, I did the same test request in jdeveloper 11g and jdeveloper 12 c (to avoid to migrate the process).

    Project template

    -Create a display of the query object. Code:

    SELECT 1 CODE, 100 DESCRIPTION
      FROM DUAL
    UNION ALL
    SELECT 2 CODE, 200 DESCRIPTION
      FROM DUAL
    

    -Create a Module of the Application, and then drag this point of view in.

    ViewController project

    -Create a page and drag in the criteria named 'All searchable attributes' of the previous ViewObject as "ADF table filtered.

    -Run the application

    Results:

    On jdeveloper 11g, however it makes the filter above the table box in jdev not 12 c.

    Is this a bug or I need to select something in jdev12c to get the same functionality?

    Yes, known bug 17279781.  It is currently scheduled for a 12.1.4 fix.  If this issue is crucial to you, please file an SR, mentioning the bug number and indicate your reasons for wanting a fix as soon as possible.

    Note there is a solution:

    To work around the problem, you can configure the filter yourself by adding an af:inputText

    facet filter columns and bind the inputText property value to the EL

    #{vs.filterCriteria. }. The page to rerun the filter for

    the column look and work.

    CM.

  • Get the columns returned by the query without running

    I have a table that stores SELECT queries in a column. I developed a .net application where the interesting thing for the user is what columns of the following SELECT statement returns. Currently, I load the sql as an OracleCommand object CommandText and fill a DataTable using an OracleDataAdapter object. I then read the names of the columns of the table filled. The data is not fully used. Requests can take up to 15 seconds to run. Because I do not used the data, I was hoping to eliminate the actual recovery of data and reduce the time needed to retrieve the records. Is it possible to analyze the statement for the colunm names with it makes the request for enforcement? Thank you.

    I imagine that there is a way you can search in the data dictionary, but you can also try to add 'WHERE 1 = 0' If you want the metadata.

    It will be useful,
    Greg

  • When no rows returned in the query loop, replace Null - need help

    Hello

    I have a requirement where I have a request in the loop for and based on the results of the query, I do some operations.

    But even if the query does not match, I should get back something like 'No Data'.

    My loop is:

    FOR V_SL IN)
    SELECT ID, CATEGORY, DI_CD, REV_CD, SL_ID
    OF SB, SLOT_2001 S2 SLOT_DATA WHERE
    PBM BENEFIT_ID = S2. BENEFIT_ID AND
    REV_CD = IN_REV_CD AND
    (PROC_CD IS NULL OR PROC_CD = IN_PROC_CD)
    ORDER OF DIAGCODE, PROCEDURECODE)
    LOOP
    END LOOP;

    I do some operations inside the loop for. I want the loop to run even if the query returns no rows.

    Can someone help me out here.

    Thank you
    Rambeau

    Frank. I am really surprised to see this coming from you. A slider to not find all the lines loop does not cause an exception no_data_found.

  • Returns a record with a 0 if no row is returned by the query

    Hello

    I use oracle 10g.

    Please forgive me if this is a crazy question
    select null ltd, 'aig' company from dual
    where sysdate  = to_date('6/13/2011','mm/dd/yyyy')
    Is it possible to get the following result
    ltd                       company
    null                         aig
    or the following
    ltd           company
    0                aig
    Thanks in advance

    You can use UNION ALL and add line if the query returns nothing.

    WITH T
         AS (SELECT NULL ltd, 'aig' company
               FROM DUAL
              WHERE SYSDATE = TO_DATE ( '6/13/2011', 'mm/dd/yyyy'))
    SELECT * FROM T
    UNION ALL
    SELECT 0 ltd, 'aig' company
      FROM DUAL
     WHERE NOT EXISTS (SELECT * FROM T)
    

    G.

  • Bind the Variable Table name in the query of VO

    I have a VO that must have its clause defined dynamically at run time.  I have a string bind variable defined with a default value that is referenced in the query of the VO.  However, JDeveloper allow me to leave the definition of the query of the view object when the from clause is a variable binding, even if the binding variable has the default value.

    For example.

    Select

    « X »

    Of

    : TABLE

    where

    1 = 1

    The variable binding TABLE is defined as a string with a default value of the 'double '.  Did I miss something in the definition of the VO?

    Thank you

    Hello

    I suggest you to dynamically set the query of the view object.  This does not meet your requirements.

    xxVo.setQuery ();

  • Return of the query classification

    This sounds like it should be simple. I want to be able to classify data in a query in return. Currently I have:

    SELECT salesID, sale
    Of allmembers
    ORDER BY sales DESC
    < cfset salesRank = 0 >
    < cfoutput >
    < cfset salesRank = #salesRank # + 1 >
    < cfquery >
    INSERT INTO rankings (salesID, salesRank)
    VALUES (' #salesID #', #salesRank #)
    < / cfquery >

    This places the seller ID and access to his rank in the League table. My question is how can I manipulate links? If two people or more have the same value of sale I would like that they all have the same rank. Then the person after them would have its correct classification.

    example of
    John has a rank of 1. Bob, Chris, and Tom all related and have not 2 but 4 rankings. Then the next person after them would have a rating of 5 (unless there's another link.

    How can code in search for links and classify correctly. It is similar to how the tournament golfers are classified.


    Here is an example that determines rank according to my previous post:

  • Dynamically read the table name in the query update

    Hi all

    I am trying to run the updated sql query where the name of the table should be read dynamically from another table below.

    Please let me what wrong with my request.

    setting a day (select CONCAT('T',schemaid) from outline, which the name = 'Analyzer') set c7 = 99;

    "outline" is a table that contains two columns name and schemaid.

    all the table created in our database with the prefix 't' T4345 for example.

    I did as suggested by you

    No, you didn't.  I did not any package creation code in my example, in order to better that you you point the finger.

    Your syntax is invalid for creating a package with the code like this, please read on creating packages and procedures within them if that's what you want to do.

    In addition, your package creation statement is to create a package specification, but you put in the code which must be in a package body, not a notebook loads.

    It should be something like (untested since I don't have your tables)...

    create or replace package my_packg as
    procedure dowhatever.
    end;
    /

    create or replace package body my_packg as
    dowhatever procedure is
    TBL varchar2 (30);
    Start
    Select 't' | SchemaId
    in tbl
    of outline
    where name = 'Analyzer ';
    run immediately 'Update'. "TBL |' set c7 = 99;
    end;
    end my_packg;
    /

    and then call this procedure by calling my_packg.dowhatever ();

  • Disable the generation of report when there are no returned by the query

    I would like to write a preliminary report trigger that disables reports generation when my main query in my data model will return no data. If possible, I would like to reuse the same query in the data model from the writing of a motion to double again.

    Thank you all

    Create a view for the main request. In this case, you just have to do it in the front trigger of the report:

    select count(*)
    into my_var
    from my_view
    where ...;
    
    if my_var =  0 then
       return false;
    else
       return true;
    end if;
    

    In where clause you can use the same settings as in your main report query.

  • Need help to write a MySQL query that returns only the peer matching records

    Because I don't know how to explain it easily, I use the table below as an example.

    I want to create a MySQL query that returns only the records that match counterparts where 'col1' = 'ABC '.

    Notice the ' ABC / GHI' record does not have a Counter-match ' GHI / ABC' record. This record must not be returned because there is no Counter-Party correspondent. With this table, the ' ABC / GHI' record should be the one returned in the query.

    How can I create a query that will do it?


    ID | col1 | col2
    --------------------
    1. ABC | DEF
    2. DEF | ABC
    3. ABC | IGS
    4. DEF | IGS
    5. IGS | DEF


    * Please let me know if you have no idea of what I'm trying to explain.

    I wanted to just the results where col1 = ABC, but I already got the answer I needed on another forum. Thank you anyway.

    SELECT a.col1,
    a.col2
    FROM table_name AS a
    LEFT OUTER
    Table_name JOIN b
    ON b.col1 = a.col2
    AND a.col1 = b.col2
    WHERE b.col1 IS NOT NULL AND a.col1 = 'ABC '.

  • By comparing the two records and return only the differences

    Hi all!

    Assume the records as follows:
    USERID     USERNAME   STREET   CITY   PHONE        
    ---------- ---------- -------- ------ -------------
             1 John Smith Street 1 City 1              
             1 John Smith Street 1 City 1 (31) 234-1234
    UserID is PK on this table. Imagine that this application represents two versions of the same record on a table. This recording was 'day' and the phone field changed from null to "(31) 234-1234'.»

    What I´d like to do is to retrieve only (or fields) that changed between these 2 versions of the same record. The idea is to call this query (or process PLSQL) a trigger and save these data on a table. The data returned by the query (or process), on the example above, should be something like:
           USERID     USERNAME STREET CITY PHONE        
    ---------- -------- ------ ---- -------------
             1                      (31) 234-1234
    1 row selected.
    If two columns have been modified, (Eg., City column also changed "City 1' to 'city 12'), the return value should be:
    USERID     USERNAME STREET CITY   PHONE        
    ---------- -------- ------ ------ -------------
             1                 City12 (31) 234-1234
    1 row selected.
    Any idea?
    Thank you very much for your attention.

    Hello

    What I´d like to do is to retrieve only (or fields) that changed between these 2 versions of the same record. The idea is to call this query (or process PLSQL) a trigger and save these data on a table.

    Looks like you're simply wanting a trigger?

    Something like:

    CREATE OR REPLACE TRIGGER audit_trg
      AFTER UPDATE ON your_table
      FOR EACH ROW
    BEGIN
    
     INSERT INTO audit_table(userid, username, street, city, phone)
     VALUES(
       :new.userid,
       nullif(:new.username, :old.username),
       nullif(:new.street, :old.street),
       nullif(:new.city, :old.city),
       nullif(:new.phone, :old.phone)
     );
    
    END;
    /
    
  • catch the collection returned by the function in a SQL statement

    I have a select like query: (I need all the values returned by the function in the select list)

    Select t1.col1, t2.col2, (by selecting t.a, t.b., t.c in fn (t2.col3) t)
    Of
    T1, t2
    where t1.col1 = t2.col2;



    My function is like:

    FN (T2.col3) returns an array in format of the object



    Here, I was able to select only one value from the table returned by the funcation both. If I select all of the values as above, she gave too much error vales.
    Please someone help me in this

    user13044793 wrote:
    I have a select like query: (I need all the values returned by the function in the select list)

    Select t1.col1, t2.col2, (by selecting t.a, t.b., t.c in fn (t2.col3) t)
    Of
    T1, t2
    where t1.col1 = t2.col2;

    No specific reason for this? It adds additional complexity to the projection of SQL, and there are additional costs of failover for the motor of PL/SQL (per line) of context. Overall - not your typical approach and one that should have sound justification.

    With regard to the basic method - the SQL multiset() function should be used to create a collection. Here is an example of the approach:

    SQL> create or replace type TFoo as object(
      2          id      number,
      3          bar     varchar2(5)
      4  );
      5  /
    
    Type created.
    
    SQL>
    SQL> create or replace type TFooSet as table of TFoo;
      2  /
    
    Type created.
    
    SQL>
    SQL> create or replace function GetSomeFoo( n number ) return TFooSet is
      2          foo     TFooSet;
      3  begin
      4          foo := new TFooSet();
      5          foo.Extend( 5 );
      6
      7          for i in 1..5
      8          loop
      9                  foo(i) := new TFoo( n+i-1, to_char(i-1,'0000') );
     10          end loop;
     11
     12          return( foo );
     13  end;
     14  /
    
    Function created.
    
    SQL>
    SQL> select
      2          object_id,
      3          object_name,
      4          cast(
      5                  multiset( select * from table(GetSomeFoo(object_id)) ) as TFooSet
      6          )       as FOO
      7  from       all_objects
      8  where      owner = 'SYS'
      9  and        rownum <= 5;
    
     OBJECT_ID OBJECT_NAME                    FOO(ID, BAR)
    ---------- ------------------------------ --------------------------------------------------
         27538 /1000e8d1_LinkedHashMapValueIt TFOOSET(TFOO(27538, ' 0000'), TFOO(27539, ' 0001')
                                              , TFOO(27540, ' 0002'), TFOO(27541, ' 0003'), TFOO
                                              (27542, ' 0004'))
    
         28544 /1005bd30_LnkdConstant         TFOOSET(TFOO(28544, ' 0000'), TFOO(28545, ' 0001')
                                              , TFOO(28546, ' 0002'), TFOO(28547, ' 0003'), TFOO
                                              (28548, ' 0004'))
    
         11718 /10076b23_OraCustomDatumClosur TFOOSET(TFOO(11718, ' 0000'), TFOO(11719, ' 0001')
                                              , TFOO(11720, ' 0002'), TFOO(11721, ' 0003'), TFOO
                                              (11722, ' 0004'))
    
         30094 /100c1606_StandardMidiFileRead TFOOSET(TFOO(30094, ' 0000'), TFOO(30095, ' 0001')
                                              , TFOO(30096, ' 0002'), TFOO(30097, ' 0003'), TFOO
                                              (30098, ' 0004'))
    
        684122 /1023e902_OraCharsetUTFE       TFOOSET(TFOO(684122, ' 0000'), TFOO(684123, ' 0001
                                              '), TFOO(684124, ' 0002'), TFOO(684125, ' 0003'),
                                              TFOO(684126, ' 0004'))
    
    SQL>
    SQL> with dataset as(
      2          select
      3                  object_id,
      4                  object_name,
      5                  cast(
      6                          multiset( select * from table(GetSomeFoo(object_id)) ) as TFooSet
      7                  )                as FOO
      8          from    all_objects
      9          where   owner = 'SYS'
     10          and     rownum <= 5
     11  )
     12  select
     13          d.object_id,
     14          d.object_name,
     15          f.id,
     16          f.bar
     17  from   dataset d,
     18          table(d.foo) f
     19  /
    
     OBJECT_ID OBJECT_NAME                            ID BAR
    ---------- ------------------------------ ---------- ---------------
           217 DUAL                                  217  0000
           217 DUAL                                  218  0001
           217 DUAL                                  219  0002
           217 DUAL                                  220  0003
           217 DUAL                                  221  0004
           268 SYSTEM_PRIVILEGE_MAP                  268  0000
           268 SYSTEM_PRIVILEGE_MAP                  269  0001
           268 SYSTEM_PRIVILEGE_MAP                  270  0002
           268 SYSTEM_PRIVILEGE_MAP                  271  0003
           268 SYSTEM_PRIVILEGE_MAP                  272  0004
           271 TABLE_PRIVILEGE_MAP                   271  0000
           271 TABLE_PRIVILEGE_MAP                   272  0001
           271 TABLE_PRIVILEGE_MAP                   273  0002
           271 TABLE_PRIVILEGE_MAP                   274  0003
           271 TABLE_PRIVILEGE_MAP                   275  0004
           274 STMT_AUDIT_OPTION_MAP                 274  0000
           274 STMT_AUDIT_OPTION_MAP                 275  0001
           274 STMT_AUDIT_OPTION_MAP                 276  0002
           274 STMT_AUDIT_OPTION_MAP                 277  0003
           274 STMT_AUDIT_OPTION_MAP                 278  0004
           815 RE$NV_LIST                            815  0000
           815 RE$NV_LIST                            816  0001
           815 RE$NV_LIST                            817  0002
           815 RE$NV_LIST                            818  0003
           815 RE$NV_LIST                            819  0004
    
    25 rows selected.
    
    SQL>
    
  • attempts to display the query results in 2 columns

    I'm trying to change someone elses existing of code to display the results of a query in 2 columns on a web page.

    The result of the existing code can be seen
    here

    Here is the code I am trying to change

    < table width = "95%" border = "0" align = "center" cellpadding = "4" cellspacing = "2" >
    < cfoutput query = "News" StartRowOptional = "" #StartRow_News # "LignesMax =" #MaxRows_News #">"
    < tr align = "center" class = "TEXTnormal" >
    < class nowrap = "style1 TEXTnormal" td >... < table >
    < /tr >
    < class tr = "TEXTnormal" >
    < td > < table width = "100%" border = "0" cellpadding = "0" cellspacing = "0" class = "TEXTnormal" >
    < b >
    < td > < cfif News.ImageNameThumb gt 0 >
    "< a href =" news_view.cfm? recordID = #News.ID #"> < img src =" "uploadedimages / #News.ImageNameThumb #" alt = "#News.ImageCaption #" hspace = "8" hspace = "0" border = "0" align = "left" > < / has >
    < cfelse >

    < / cfif > < table >
    < td > < a href = "" news_view.cfm? recordID = #News.ID # "class ="TEXThighlight"> #News.Title # < /a > - #News.Day #. #News.Month #. #News.Year # < br >"
    #News.Summary # < table >
    < /tr >
    < / table > < table >
    < /tr >
    < / cfoutput >
    < /table >

    I changed the above code to

    < table width = "95%" border = "0" align = "center" cellpadding = "4" cellspacing = "2" >
    < cfset LoopEndRow = CEILING(#EndRow_News#/2) >
    < cfloop
    index = "row".
    from = "#StartRow_News #
    to = "#LoopEndRow #
    step = "1" >
    < class tr = "TEXTnormal" >
    < cfset breaker = 0 >
    < cfloop
    index = "column".
    from = '0 '.
    to = '2 '.
    step = "1" >
    < cfoutput query = "News1" StartRowOptional = "" #StartRow_News # "LignesMax =" #MaxRows_News #">"
    < td width = "50%" >
    < table width = "100%" border = "0" cellpadding = "0" cellspacing = "0" class = "TEXTnormal" >
    < b >
    < td > < cfif News1.ImageNameThumb gt 0 >
    "< a href =" news_view.cfm? recordID = #News1.ID #"> < img src =" "uploadedimages / #News1.ImageNameThumb #" alt = "#News1.ImageCaption #" hspace = "8" hspace = "0" border = "0" align = "left" > < / has >
    < cfelse >

    < / cfif > < table >
    < td > < a href = "" news_view.cfm? recordID = #News1.ID # "class ="TEXThighlight"> #News1.Title # < /a > - #News1.Day #. #News1.Month #. #News1.Year # < br >"
    #News1.Summary # < table >
    < /tr >
    < / table > < table >
    < cfset breaker breaker + 1 = >
    < cfif breaker EQUAL 2 >
    < cfbreak >
    < / cfif >
    < / cfoutput >
    < / cfloop >
    < /tr >
    < / cfloop >
    < /table >

    The results of this code change can be see here

    as you can see what I did gives the number of columns (2)
    and the correct number of lines for the amount of data (3)
    However, each line shows the first 2 pieces of data returned by the query

    Can I change the output query so that it returns the data SET by the amount of data already out items?
    If so, how?



    #data #.




    closing tags

  • Function returning the query takes longer to run in Apex4.0

    Hi all

    I've created a report using the function returns the query. The function returns the query based on parameters that returns the dynamic columns. When I run the query in sql developer the query generates and returns the result in 3mins. But in the apex, it takes 35 minutes maximum to return.

    The query returns about 10000 lines.

    What a performance problem in the query or Apex? can someone help plz

    Concerning
    REDA

    No it's just the first tranche of 500. You can run it in good old SQL * more and the total time of the time (be patient however)

Maybe you are looking for

  • Cannot start my ipod touch 2G, need help?

    I got the ipod touch 2 G Sin 2014. But I was tired by dec.15. And now I need to start my ipod so, when I put in charge for the first time the low battery symbol came and I leave him in charge. I downloaded the latest version of itunes in my computer

  • Plug-and-play driver needed

    Hello have some problems with the plug-and-play driver - can not update, as it "works fine and any updates do not need" according to windows. But is that the plug-and-play driver problem is the reason for sound, webcam and some other functions do not

  • Can't open Skype due to the error

    Hello, I have this problem everytime I try to open Skype or Skype tries to open at startup of windows, it gives me an error: EInvalidPointer Exception in module Skype.exe 00005D 89. Invalid pointer operation. I'll attach a dxdiag here, because I knew

  • When I try to access iTunes and App store I get a (OSStatus

    When I try to access iTunes and App store on my dock, I get an (error code OSStatus 28) Please help?

  • EtherCAT slaves

    Hello. I don't know whether or not I've navigated to the correct location. What I want to know is, what is the index of protection of modules OR slave that interface with a master of EthernetCAT? I don't have an exact part number. I was told that the