Create the view with the dynamic from clause

Hi all

you might have some ideas to help me out of my problem I just "created myself" ;-)

I have an unknown quantity and not constant of the tables using the same structure of the table and I have a main table
that contains all the names of these table types. Now, I want to create a unique view that contains all the columns in each table
and an extra column name containing the name of the corresponding table.

I found a solution for this but only if I knew that all the table names while creating my view.

Here is what I currently have:

master_table:
TABLENAME ID
1 table_01
2 table_02


table_01:
ID NAME
1 eins
zwei 2
drei 3


table_02:
ID NAME
1 a
2 two
3 three


I think 'tab1tab2' on these 2 table looks like this:

ID NAME TABLENAME
1 table_01 eins
2 zwei table_01
3 drei table_01
1 a table_02
2 two table_02
3 three table_02


I have reached this point of view with:

CREATE OR REPLACE VIEW TAB1TAB2 ('ID', 'NAME', 'TABLENAME')
AS
SELECT id, name, 'table_01' AS table_01 FROM tablename
UNION
SELECT id, name, 'table_02' AS tablename FROM table_02;



Is it possible to create as many select statements and union that I entered (tablenames) into my master_table to achieve the same results as my opinion hard?

Thank you very much in advance for your help

Best regards

Majo

create or replace view v_alltables
Select * from v_all;

These two statement contradict each other in some way, Don't they?

path ID number name 'id', varchar2 (20) 'name' of the path) x;

the column names are case sensitive - try

  id number path 'ID' , name varchar2(20) path 'NAME' ) x;

assuming that the names of the columns are named like that.

Tags: Database

Similar Questions

  • create a view with the double data type

    I have Windows XP with 10g 10.2.0.1.0

    I need to create a view of the double and with the type of data, such as NUMBER (5.2), NUMBER or VARCHAR2 (20).
    such as:
    create see test (view_test varchar2 (20)) as (select view_test from double)


    Help, please. Thanks in advance.

    It seems a little strange, but you can do something like this with the CAST function:

    SQL> create view dual_view as
      2  select cast(null as number(5,2)) col1
      3        ,cast(null as date)    col2
      4        ,cast(null as varchar2(30)) col3
      5  from   dual;
    
    View created.
    
    SQL> desc dual_view
     Name                                      Null?    Type
     ----------------------------------------- -------- -------------------------
     COL1                                               NUMBER(5,2)
     COL2                                               DATE
     COL3                                               VARCHAR2(30)
    

    I used the NULL values, but you can use the actual values if you wish.

  • Trying to create the table using Clause any Union with Select multiple stmts

    The motion seeks to get the substring of the value to for example.
    If the value is * ASA 2 * then so do ASA
    where as if the value is * 1.5 TST * it sholud come as TST as wise for others too.
    I am trying to execute stmt SQL written but in error as below:

    * ' ORA-00998 must appoint this expression with the alias column 00998.00000 - must appoint this expression with the column alias. "

    CREATE TABLE TEST_CARE AS
    (
    SELECT row_id, old_care_lvl, SUBSTR(old_care_lvl,3), len test_care_lvl FROM
    WHERE LENGTH (old_care_lvl) = 5
    UNION ALL
    SELECT row_id, old_care_lvl, SUBSTR(old_care_lvl,3), len test_care_lvl FROM
    WHERE LENGTH (old_care_lvl) = 7
    UNION ALL
    SELECT row_id, old_care_lvl, SUBSTR(old_care_lvl,3), len test_care_lvl FROM
    WHERE LENGTH (old_care_lvl) = 14
    UNION ALL
    Row_id SELECT, old_care_lvl, SUBSTR (old_care_lvl, 3), LEN test_care_lvl
    WHERE LENGTH = 7 AND old_care_lvl (old_care_lvl) = "Regular."
    );

    I want to create the table using the above given the multiple selection by using the Union ALL clause, but trying to create run query error like "ORA-00998 must appoint this expression with the alias column 00998.00000 - must appoint this expression with the column alias.

    Please guide me how to approach to solve this problem.
    Thanks in advance.

    Try this->

    CREATE TABLE TEST_CARE
    AS
      select *
      from (
              SELECT row_id, old_care_lvl,SUBSTR(old_care_lvl,3), len FROM test_care_lvl
              WHERE LENGTH(old_care_lvl) =5
              UNION ALL
              SELECT row_id, old_care_lvl,SUBSTR(old_care_lvl,3), len FROM test_care_lvl
              WHERE LENGTH(old_care_lvl) =7
              UNION ALL
              SELECT row_id, old_care_lvl,SUBSTR(old_care_lvl,3), len FROM test_care_lvl
              WHERE LENGTH(old_care_lvl) =14
              UNION ALL
              SELECT row_id, old_care_lvl,SUBSTR(old_care_lvl,3),LEN FROM test_care_lvl
              WHERE LENGTH(old_care_lvl) =7 AND old_care_lvl ='Regular'
          );
    

    N.B.: Not tested...

    Kind regards.

    LOULOU.

  • How to create a view with "WITH CLAUSE"

    Hello

    I have one query with 'BY' ARTICLE, I need to create a view of this query. But I get the error message like

    ORA-32034: Unsupported sue clause.

    Please help me...!

    Please find below my request...!

    WITH RANGE
             AS (SELECT A.MASTERMACHINEID,
                        a.startdate,
                        a.enddate,
                        a.startdate - (1 / 3) + (lvl) * 1 / 3 SHIFT_ST_DT,
                        a.startdate + (lvl) * 1 / 3 AS SHIFT_END_DT,
                        a.quantity,
                        (LEAST ( enddate, TODATE) - GREATEST ( FROMDATE, startdate)) * 24 TOTAL_HRS,
                        (enddate - startdate) * 24 AVAIL,
                       todate,
                       fromdate
                  FROM OMP A,
                       (SELECT LEVEL lvl
                          FROM (SELECT MAX (enddate - startdate) AS diff FROM OMPWORKORDER)
                        CONNECT BY LEVEL <= (diff) * 3),
                       MASTER B
                 WHERE A.MASTERMACHINEID = B.MASTERMACHINEID 
                   AND lvl / 3 <=(enddate - startdate) + 1
                ORDER BY SHIFT_ST_DT)
       SELECT shift_date,
              shift_num,
              shift_hrs,
              DECODE (SIGN (SHUT_DWN_TIME), -1, 0, SHUT_DWN_TIME),
              8 - DECODE (SIGN (SHUT_DWN_TIME), -1, 0, SHUT_DWN_TIME) shift_avail_hrs,
              qty,
              total_qty
         FROM (SELECT TRUNC (SHIFT_ST_DT) shift_date,
                      ROW_NUMBER () OVER (PARTITION BY TRUNC (SHIFT_ST_DT) ORDER BY SHIFT_ST_DT) shift_num,
                      8 shift_hrs,
                      (LEAST ( SHIFT_END_DT, TODATE) - GREATEST ( FROMDATE, SHIFT_ST_DT)) * 24
                        SHUT_DWN_TIME,
                      quantity / (avail - TOTAL_HRS) qty,
                      round(((SHIFT_END_DT - SHIFT_ST_DT) * 24 - (LEAST (SHIFT_END_DT, TODATE) - GREATEST (FROMDATE, SHIFT_ST_DT)) * 24)  * QuantiTY / (AVAIL - TOTAL_HRS),2)
                         TOTAL_QTY
                 FROM RANGE A );
    Concerning
    KPR

    Published by: BluShadow on March 17, 2011 09:48
    addition of {noformat}
    {noformat} tags for readability                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            

    Try to create the view on the next request, if it helps you:

    SELECT shift_date,
        shift_num,
        shift_hrs,
        decode(SIGN(shut_dwn_time),     -1,     0,     shut_dwn_time),
        8 -decode(SIGN(shut_dwn_time),     -1,     0,     shut_dwn_time) shift_avail_hrs,
        qty,
        total_qty
    FROM
        (
            SELECT TRUNC(shift_st_dt) shift_date,
                 row_number() over(PARTITION BY TRUNC(shift_st_dt)
             ORDER BY shift_st_dt) shift_num,
                 8 shift_hrs,
                (least(shift_end_dt,      todate) -greatest(fromdate,      shift_st_dt)) *24 shut_dwn_time,
                 quantity /(avail -total_hrs) qty,
                 ROUND(((shift_end_dt -shift_st_dt) *24 -(least(shift_end_dt,      todate) -greatest(fromdate,      shift_st_dt)) *24) *quantity /(avail -total_hrs),      2) total_qty
             FROM
             (
                  SELECT a.mastermachineid,
                     a.startdate,
                     a.enddate,
                     a.startdate -(1 / 3) +(lvl) *1 / 3 shift_st_dt,
                     a.startdate +(lvl) *1 / 3 AS
                 shift_end_dt,
                     a.quantity,
                    (least(enddate,      todate) -greatest(fromdate,      startdate)) *24 total_hrs,
                    (enddate -startdate) *24 avail,
                     todate,
                     fromdate
                 FROM omp a,
                        (SELECT LEVEL lvl
                     FROM
                        (SELECT MAX(enddate -startdate) AS
                        diff
                         FROM ompworkorder)
                    CONNECT BY LEVEL <=(diff) *3),
                     master b
                 WHERE a.mastermachineid = b.mastermachineid
                 AND lvl / 3 <=(enddate -startdate) + 1
                 ORDER BY shift_st_dt
             ) a
         )
    ;
    

    Kind regards
    Dipali.l

  • How to create a view with columns from multiple lines

    I posted this in the SQL/PSL forum, but I hope that experts from the database in this group can give me ideas also, the necessity is also BI reports.

    I have a table, for example, project_milestones, that has these columns in order:

    PROJ_ID, milestone_name, actual_end_date

    with data:
    PROJ_ID, milestone_name, actual_end_date
    ===== ================ ==============
    1001, key approval, 2009-10-02
    1001, final synopsis, 2009-10-07
    1001, approved final Protocol, 2009-10-15
    1001, FPFV, 2010-01-10
    1001, LPFV, 2010-03-12
    ...
    1002, key approval, 2008-12-02
    1002, final synopsis, 2009-01-07
    1002, approved final Protocol, 2009-01-12
    1002, FPFV, 2009-03-30
    1002, LPFV, 2009-10-04
    ...
    There are about 10 steps in each project.
    I need to create a view for dish these data at the project level, looks like this:

    PROJ_ID, key_element_date, final_synopsis_date, final_protocol_approved_date, FPFV_date, LPFV_date, key_element_to_final_synopsis_days, final_synopsis_final_protocol_days...

    How can I do this?

    Thank you

    user9175541 wrote:
    I posted this in the SQL/PSL forum, but I hope that experts from the database in this group can give me ideas also, the necessity is also BI reports.

    I have a table, for example, project_milestones, that has these columns in order:

    PROJ_ID, milestone_name, actual_end_date

    with data:
    PROJ_ID, milestone_name, actual_end_date
    ===== ================ ==============
    1001, key approval, 2009-10-02
    1001, final synopsis, 2009-10-07
    1001, approved final Protocol, 2009-10-15
    1001, FPFV, 2010-01-10
    1001, LPFV, 2010-03-12
    ...
    1002, key approval, 2008-12-02
    1002, final synopsis, 2009-01-07
    1002, approved final Protocol, 2009-01-12
    1002, FPFV, 2009-03-30
    1002, LPFV, 2009-10-04
    ...
    There are about 10 steps in each project.
    I need to create a view for dish these data at the project level, looks like this:

    PROJ_ID, key_element_date, final_synopsis_date, final_protocol_approved_date, FPFV_date, LPFV_date, key_element_to_final_synopsis_days, final_synopsis_final_protocol_days...

    How can I do this?

    Thank you

    Create a PivotTable and put "milestone_name" in the columns, under the labels section.
    Put 'actual_end_date' in the section of measures and to change the rule of the aggregation of 'Max '.
    The rest of the attributes keep in the lines section.

  • Re-create the instance from the RMAN backup

    Gentlemen, subsequently... I'm simulating a recovery for a customer.
    The environment is Windows 2003 64-bit VMWare which is a backup of the VM production was scheduled to begin with a facilitator and a different IP network.

    I uninstalled all the binary Oracle (11g) and installed it again.
    I need to restore a recent backup (made with RMAN) and the body back to normal.

    Already created the password file:
    orapwd file = % ORACLE_HOME %------dbs-PWD % ORACLE_SID PASSWORD = password = 5%

    Already created the tnsnames:

    SAP =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP) (HOST = 10.9.140.30) (PORT = 1521))
    )
    (CONNECT_DATA =
    (SERVICE_NAME = SAP)
    )
    )

    LISTENER has already created the static method:

    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (GLOBAL_DBNAME = BMKSAP)
    (ORACLE_HOME = E:------Oracle_Bin------product------11.1.0------db_1)
    (SID_NAME = SAP)
    )
    )

    LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP) (HOST = 10.9.140.30) (PORT = 1521))
    (ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1521))
    )
    )



    But when it comes time to launch SQLPLUS to give NOMOUNT with STARTUP PFILE:


    C:-> set ORACLE_SID = sap

    C:-> set local = sap

    C:------> sqlplus "/ as sysdba".

    SQL * more: version 11.1.0.7.0 - Production on Tue Jul 8 16:35:49 2010

    Copyright © 1982, 2008, Oracle. All rights reserved.

    ERROR:
    ORA-12518: TNS: listener nπo can distribute the client connection


    Have uninstalled and installed the Oracle on 3 times, I have tried to change the host and the tnsnames LISTENER for the host name of the machine, I tried the LISTENER, but dynamic... nothing works.

    someone at - it revenue to climb?

    And how about this?

    oradim -new -sid SAP
    
  • How to re-create the database from the Complutense University of MADRID

    «I was able to change the connection DB from one to the other by changing the settings through the ' system properties '.» However, there are a few objects (tables) database created during installation of the Complutense University of MADRID. is there anyway that I can go to the new database and database get UCM objects re-created without re-installation of the UCM? It seems some sql scripts in the database directory, but I don't know how to operate, the order and setting are not clear for me.

    Thank you

    Hello

    One thing you can do to recreate the default tables and columns is to run the script all.sql on the DB that is specific for your db. If you want to just recreate a replica of the image then extract the ddl from your current database instructions and put it in a sql script that run directly on the another instance of db. In this case make sure you change instance specifc details in the extracted ddl script and replace with the instance details latest as the table space name, the user name will execute it and like wise.

    Another way would be to use archiver to create the batch file export for tables and then imported to the target instance. The way out for this is to go to Archiver Applet - create new Archive - Export - Tables and here and include any tables that are there in the content server.

    Hope this helps

    Thank you
    Srinath

  • How to create the dynamic list item in the designer of Site Studio?

    Hi all
    I installed the Site Studio Designer(10gR4). The dynamic list item that I added in the region of contributor runs a query to search and display all the files in a particular folder. In Contributor mode when I try to add/edit the dynamic list item, it gives an error saying:
    Cannot perform the action for the following reasons:
    [+] Failed to retrieve search results. Failed to retrieve search results. Failed to create the result set of query ' SELECT IdcColl2.dID, dDocName, dDocTitle, dDocType, dRevisionID, dSecurityGroup, dDocAuthor, dDocAccount, dRevLabel, dFormat, dOriginalName, venture, dWebExtension, dInDate, dOutDate, dCreateDate, dPublishType, dRendition1, dRendition2, VaultFileSize, WebFileSize, URL, dFullTextFormat, dFullTextCharset, DocMeta.* FROM IdcColl2, DocMeta WHERE IdcColl2.dID = DocMeta.dID AND (((xCollectionID > = 14 ET xCollectionID < = 14) AND NOT ((CONTAINS (xDontShowInListsForWebsites, '{DIPP_Sample}") > 0))) ORDER BY dDocTitle desc".) ORA-20000: Oracle text error: 10599-DRG: column is not indexed

    I activated the full text on the content server search and also included xWebsites and xWebsiteObjectType columns to be fully indexed in the fields Configuration.Is area it any other setting to do? Help, please.

    Thank you
    Nithya

    Hello

    Include the xDontShowInListsForWebsites also of the area filed and then update it. Then test it.

    It may be useful
    Srinath

  • create the user from the command line

    I use Windows 7, I don't have a password reset disk and don't remember the password. How to create a user account from the comand prompt I can change the passwords?

    This has not answered my question. I could not connect. I found the answer and was able to activiate the account administrator hidden and solved the problem in this way.

    Thank you

    I'm intrigued by your answer, and here's why:

    • The subject of your message is 'create the command line user '. The answer I gave you will certainly do so.
    • If you had stated that you were unable to connect while I gave you a method to solve this problem.
    • Find your own solution, but you chose to keep it to yourself, depriving other people who might read this thread for your answer.

    If this happens again, then I recommend using a topic as "you forgot my password, can not connect" as this could summarize your situation in a sentence. Create an account from a command prompt has no relevance in your case.

  • Create the script from another script using GUEST

    Oracle 11

    Instead of having to make a link to a different database, I want to create 2 scripts that are run from a shell script and run separately. Run Script1 in Database1 would create 2 Script using PROMPT to create the second script while entering a date of base1 to base2. I've almost got it but the problem is... Script2 using COPY FROM and I need to put a "-" at the end of each line that the GUEST takes as a literal instead of as part of the output.

    SCRIPT1:
    set pagesize 0
    set trimspool on
    set linesize 2000
    set echo off
    set verify off
    set feedback off
    set sqlblanklines on
    
    spool /home/michelle/sql_scripts/sl_dtc_copy2.sql
    
    PROMPT whenever sqlerror exit sql.sqlcode rollback
    PROMPT SET ARRAYSIZE 5000
    PROMPT SET COPYCOMMIT 20
    PROMPT set linesize 4000
    PROMPT 
    PROMPT COPY FROM {username}/{pswd}@{DB2}  TO {username}/{pswd}@{DB2}
    PROMPT CREATE SL_DTC_TMP USING SELECT DISTINCT 
    PROMPT col1, col2, col3
    PROMPT FROM dual
    PROMPT WHERE veh_data_elements_cd = 'ODO_READ'
    PROMPT and       dh.data_collected_timstm >=  
    select trunc(sysdate)-7 from dual; 
    PROMPT and       substr(vdh.vin,10,1) in ('A','B','C','D') 
    PROMPT /
    
    PROMPT spool off
    PROMPT exit
    
    spool off
    exit
    SCRIPT2 NOW:
    whenever sqlerror exit sql.sqlcode rollback
    SET ARRAYSIZE 5000
    SET COPYCOMMIT 20
    set linesize 4000
    
    COPY FROM {username}/{pswd}@{DB2}  TO {username}/{pswd}@{DB2}
    CREATE SL_DTC_TMP USING SELECT DISTINCT
    col1, col2, col3
    FROM dual
    WHERE veh_data_elements_cd = 'ODO_READ'
    and       dh.data_collected_timstm >=
    12-AUG-11
    and       substr(vdh.vin,10,1) in ('A','B','C','D')
    /
    spool off
    exit
    SCRIPT2 HOW IT SHOULD BE:
    -A [SPACE] AND a [-] at the end of each line
    -THE DATE MUST HAVE THE APOSTROPHES AND PREFERABLY AT THE END OF THE PREVIOUS LINE
    whenever sqlerror exit sql.sqlcode rollback
    SET ARRAYSIZE 5000
    SET COPYCOMMIT 20
    set linesize 4000
    
    COPY FROM {username}/{pswd}@{DB2}  TO {username}/{pswd}@{DB2} -
    CREATE SL_DTC_TMP USING SELECT DISTINCT -
    col1, col2, col3 -
    FROM dual -
    WHERE veh_data_elements_cd = 'ODO_READ' -
    and       dh.data_collected_timstm >= '12-AUG-11' -
    and       substr(vdh.vin,10,1) in ('A','B','C','D')
    /
    spool off
    exit
    Thank you

    Oops, sorry, I forgot to change the line.
    Must be double quotes to delimit the orignial:

    SELECT 'WHERE veh_data_elements_cd = ''ODO_READ'' -' from dual
    

    Kind regards
    Sylvie

  • create a view with subquery generating insufficient privileges!

    Hello
    I want to create a view by a DB user with DBA role, the view is based on a query that extracts data from 2 users, next to the query contains the subquery. When I run the query itself - without clause CREATE VIEW - it works and gets the data, but when I try to create a view based on this request, it generates ORA-01031: insufficient privileges pointing to the subquery.
    Any suggestion.

    Saad,

    Hello

    To use the table in a view, privileges must be granted directly to the owner of the view (or public). Privileges granted to a role are not enough to use the table in a view.

  • Error ORA-00911 create a view with PL/SQL

    Hello. Working with SQL Developer, I'm writing a procedure that creates a view.
    After a compilation successful, whenever I try to run it, I get an error ORA-00911 and I'm not able to find the reason.
    Here is my code. Thanks in advance.
      CREATE OR REPLACE PROCEDURE "DWH_STAR"."STORICO_DATA" (
      DATA_INPUT IN VARCHAR2
    )AS
    BEGIN
      EXECUTE IMMEDIATE '
        CREATE OR REPLACE FORCE VIEW DWH_STAR.V_PORT_STOR_DATA (DATA_DESC, CLIENTE_KEY, PRODOTTO_KEY, AGENTE_KEY, TIPOLOGIA_KEY, 
        NUM_ORDINE, NUM_UNITA, RICAVO_LORDO, RICAVO_NETTO, COSTO_STD_TOTALE, GROSS_PROFIT) AS 
        SELECT
          dt.DATA_DESC,
          fv.CLIENTE_KEY,
          fv.PRODOTTO_KEY,
          fv.AGENTE_KEY,
          fv.TIPOLOGIA_KEY,
          fv.NUM_ORDINE,
          SUM (NUM_UNITA) NUM_UNITA,
          SUM (RICAVO_LORDO) RICAVO_LORDO,
          SUM (RICAVO_NETTO) RICAVO_NETTO,
          SUM (COSTO_STD_TOTALE) COSTO_STD_TOTALE,
          SUM (GROSS_PROFIT) GROSS_PROFIT
        FROM
          F_VENDUTO fv, D_TEMPO dt
        WHERE
          fv.TEMPO_KEY = dt.TEMPO_KEY
          AND TO_NUMBER(TO_CHAR(dt.DATA_DESC,''YYYYMMDD'')) <=' || DATA_INPUT ||'
        GROUP BY
          fv.CLIENTE_KEY,
          fv.PRODOTTO_KEY,
          fv.AGENTE_KEY,
          fv.TIPOLOGIA_KEY,
          fv.NUM_ORDINE,
          dt.DATA_DESC
        ORDER BY 
          dt.DATA_DESC, 
          fv.CLIENTE_KEY,
          fv.PRODOTTO_KEY,
          fv.AGENTE_KEY,
          fv.TIPOLOGIA_KEY,
          fv.NUM_ORDINE;
        UNION
        SELECT
          dt.DATA_DESC,
          fs.CLIENTE_KEY,
          fs.PRODOTTO_KEY,
          fs.AGENTE_KEY,
          fs.TIPOLOGIA_KEY,
          fs.NUM_ORDINE,
          - SUM (NUM_UNITA) NUM_UNITA,
          - SUM (RICAVO_LORDO) RICAVO_LORDO,
          - SUM (RICAVO_NETTO) RICAVO_NETTO,
          - SUM (COSTO_STD_TOTALE) COSTO_STD_TOTALE,
          - SUM (GROSSO_PROFIT) GROSS_PROFIT
        FROM
          F_SPEDITO fs, D_TEMPO dt
        WHERE
          (fs.CAUSA_RESO_KEY = 0
           AND fs.TEMPO_KEY = dt.TEMPO_KEY
           AND TO_NUMBER(TO_CHAR(dt.DATA_DESC,''YYYYMMDD'')) <=' || DATA_INPUT ||'
           )
        GROUP BY
          fs.CLIENTE_KEY,
          fs.PRODOTTO_KEY,
          fs.AGENTE_KEY,
          fs.TIPOLOGIA_KEY,
          fs.NUM_ORDINE,
          dt.DATA_DESC
        ORDER BY 
          dt.DATA_DESC, 
          fs.CLIENTE_KEY,
          fs.PRODOTTO_KEY,
          fs.AGENTE_KEY,
          fs.TIPOLOGIA_KEY,
          fs.NUM_ORDINE
      '
      ;
    END;
    /
     

    delete the order and the semicolon (;) of the first select statement. I hope you know that the operator union the same set of columns to be selected.

    But try to avoid to create objects on the fly, unless and until it is absolutely necessary and inevitable.

    Concerning

    REDA

    Published by: R.Subramanian on June 21, 2010 07:52

    Published by: R.Subramanian on June 21, 2010 07:53

  • How to create Table View with even a column name but another Table?

    Hi all

    I have the problem to create a tableview with the same column name, but in the other table.

    Table I: -.

    Table - PAC051MPROFORMA

    Column - MNR, visitid

    Table - PAC051TPROFORMA
    Column - MNR, visitid

    Table - PAC052MTRANSBILL
    Column - MNR, visitid

    Then, I want to create a table for this table. It comes to my SQL

    Pacviewproforma CREATE VIEW (MNR, visitid, MNR, visitid, MNR, visitid)

    Like some PAC051MPROFORMA.mrn, PAC051MPROFORMA.visitid, PAC051TPROFORMA.mrn, PAC051TPROFORMA.visitid, PAC052MTRANSBILL.mrn, PAC052MTRANSBILL.visitid

    where

    * (a.PAC051MPROFORMA.mrn = PAC051TPROFORMA.mrn) *.
    and
    * (a.PAC051TPROFORMA.mrn = PAC052TRANSBILL.mrn) *.

    SQL return this error ORA-00957 =: duplicate column name

    Can I change this SQL for

    Pacviewproforma CREATE VIEW (MNR, visitid)

    Like some PAC051MPROFORMA.mrn, PAC051MPROFORMA.visitid, PAC051TPROFORMA.mrn, PAC051TPROFORMA.visitid, PAC052MTRANSBILL.mrn, PAC052MTRANSBILL.visitid

    where

    * (a.PAC051MPROFORMA.mrn = PAC051TPROFORMA.mrn) *.
    and
    * (a.PAC051TPROFORMA.mrn = PAC052TRANSBILL.mrn) *.
    This time this error return = ORA-01730: number of column names specified invalid

    What should I do?

    Thank you...

    Hello

    SQL> CREATE VIEW pacviewproforma (mrn,visitid,mrn,visitid,mrn,visitid)
      2  As Select
      3  PAC051MPROFORMA.mrn,
      4  PAC051MPROFORMA.visitid,
      5  PAC051TPROFORMA.mrn,
      6  PAC051TPROFORMA.visitid,
      7  PAC052MTRANSBILL.mrn,
      8  PAC052MTRANSBILL.visitid
      9  from PAC051MPROFORMA,PAC051TPROFORMA,PAC052MTRANSBILL
     10  where
     11  (PAC051MPROFORMA.mrn=PAC051TPROFORMA.mrn)
     12  and
     13  (PAC051TPROFORMA.mrn=PAC052MTRANSBILL.mrn);
    CREATE VIEW pacviewproforma (mrn,visitid,mrn,visitid,mrn,visitid)
                                             *
    ERROR at line 1:
    ORA-00957: duplicate column name
    

    Please give different names to each column.

    Something like that...

    SQL> CREATE OR REPLACE VIEW pacviewproforma (MPROFORMA_mrn,MPROFORMA_visitid,TPROFORMA_mrn,TPROFORMA
    _visitid,MTRANSBILL_mrn,MTRANSBILL_visitid)
      2  As Select
      3  PAC051MPROFORMA.mrn,
      4  PAC051MPROFORMA.visitid,
      5  PAC051TPROFORMA.mrn,
      6  PAC051TPROFORMA.visitid,
      7  PAC052MTRANSBILL.mrn,
      8  PAC052MTRANSBILL.visitid
      9  from PAC051MPROFORMA,PAC051TPROFORMA,PAC052MTRANSBILL
     10  where
     11  (PAC051MPROFORMA.mrn=PAC051TPROFORMA.mrn)
     12  and
     13  (PAC051TPROFORMA.mrn=PAC052MTRANSBILL.mrn);
    
    View created.
    
    SQL> DESC  pacviewproforma;
     Name                                      Null?    Type
     ----------------------------------------- -------- ----------------------------
     MPROFORMA_MRN                                      NUMBER
     MPROFORMA_VISITID                                  NUMBER
     TPROFORMA_MRN                                      NUMBER
     TPROFORMA_VISITID                                  NUMBER
     MTRANSBILL_MRN                                     NUMBER
     MTRANSBILL_VISITID                                 NUMBER
    

    ORA-01730: number of column names specified invalid

    The list of the nmae column you specified for the CREATE VIEW must correspond with the list of SELECTION in the view.

    Twinkle

  • Create a view of values separated from colon

    Hello

    I have a field that contains the data separated by colons as such:
    10:20:30:...

    I want to create a view that displays vertical data:
    10
    20
    30
    ..

    Any suggestions?

    Thanks in advance

    Like this...

    SQL> ed
    Wrote file afiedt.buf
    
      1  with t as (select 'aaaa:bbbb:cccc:dddd:eeee:ffff' as txt from dual)
      2  -- end of sample data
      3  select REGEXP_SUBSTR (txt, '[^:]+', 1, level)
      4  from t
      5* connect by level <= length(regexp_replace(txt,'[^:]*'))+1
    SQL> /
    
    REGEXP_SUBSTR(TXT,'[^:]+',1,L
    -----------------------------
    aaaa
    bbbb
    cccc
    dddd
    eeee
    ffff
    
    6 rows selected.
    
    SQL>
    
  • How I created the dynamic personalized stamps for the PDF stamp with?

    Trying to create a dynamic custom stamp, so that I can stamp PDF with either "reviewed" or "refused" to a given date and time

    Some tutorials

    https://acrobatusers.com/tutorials/filter/search&keywords=dynamic+stamp&channel=tutorials& category = 13 & tut_type = video + OnDemand + graphics + HTML.

    Be well...

Maybe you are looking for