View using Union Query

All,
How to create a view using a union query in sql developer. I tried doing but when i check the syntax I got an error
"The SQL syntax is valid, however the query is invalid or uses functionality that is not supported.
Declarative query support does not currently include UNION, INTERSECT or MINUS"
Could some one help me out
Regards

792011 wrote:
All,
How to create a view using a union query in sql developer. I tried doing but when i check the syntax I got an error
"The SQL syntax is valid, however the query is invalid or uses functionality that is not supported.
Declarative query support does not currently include UNION, INTERSECT or MINUS"
Could some one help me outuse different/upgraded client since UNION is valid SQL

Similar Messages

  • How to retrieve Task Lists from All Subsites to the Parent Site and display in Grid view using CAML Query

    How to retrieve Task Lists from All Subsites to the Parent Site and display in  Grid view using CAML Query + object model

    do u just want task list or items under task list for all subsites
    for items use spsitedataquery ref
    http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spsitedataquery.aspx use recursive to get it from alll subsite under site collection
    for tasklist only u can a simply use a for loop to find in all subsite
    Manish Sati

  • Creating table or View using UNION Operator ???????

    Hi all
    please need some help ,i have created aquery using UNION operator
    (i.e
    select A,to_number(null),C from table1
    Union
    select A,B,To_number(null) from table2)
    it gives the output correctly and i need to make this output as View ot table
    eacg time i use
    Create or replace view v_1 ...........
    it gives me this error :: unknown command "UNION" - rest of line ignored.
    can any one pls tell me what to do
    Thanks

    Hi,
    I found there is no error in your sql
    create view x_v
    as
    select a from x
    union
    select to_number(null) from y;
    this works fine.
    in your sql check your right or left peranthesis
    regards
    Ripudaman

  • Alert Drill Down - DRAFT and ADDED Documnts - Using UNION Query

    Hi,
    I want to be able to send and alert that allows drill down when the alert includes DRAFT and ADDED doc's
    My alert query uses UNIONs for the draft table  and ADDED type documents, selecting a dummy draft number for ADDED doc.
    --EXTRACT
    select
    --For DRAFTs
    T0.DocEntry   as 'Draft_No',
    ''               as  'Doc_No',
    'Draft'       as 'Type', ---etc. etc.
    From ODRF 
    UNION
    ---For  ADDED
    select
    (select min(docentry) from ODRF) as 'Draft_No',
    T0.Docnum  as  'Doc_No',
    'ADDED'       as 'Type', -
    etc etc
    From ORDR
    Sample :DRAFT = 2 is dummy
    Draft_No Doc_No   Type     Draft Status Cust/Vend   Doc_Type             Line Type      Approval_Status
    2              121095   ADDED   N/A             NPO-PORT      Sales Order            Item                Approved
    811           0            Draft       Open          ADT               AP Invoice           Service        Approved     
    Thanks you for any help on this issue.
    Eric

    Hi Eric,
    This is impossible.  Simply because, once you are using Union, drill down will no longer work.
    Thanks,
    Gordon

  • Using union query to return a value to Oracle Type object in a view

    Hi All,
    I am using type objects inside a view to fetch data. For a particular type, in select statement when i use a "union all", it is throwing oracle error ora-03001 unimplemented feature. But it is working fine when it contains only select statement inside the type.
    Thanks in advance
    Sathish K

    Sathish,
    I think you'll find the answer here:
    http://www.jlcomp.demon.co.uk/ch_16.html
    Cheers,
    Colin

  • Creating logical view using sql query

    hi
    i'm new in OBIEE,
    would like to know if its possible to create a custom view (logical table) by writing a sql query (without use the existing tables in the business model).
    how can i do that? i didnt find the place where i can write the sql manually...
    thanks

    Not in BMM layer but you can achieve this in Physical layer.
    In physical layer --> Create New Physical Table --> select table type as Select

  • Creating view with union, what to do if a table is missing?

    Dear All,
    I have three schema in one DB, 11gR1 is the database and Linux is OS.
    Schema1
    Schema2
    Schema3
    Each schema contains almost the same structure, but different data.
    There are few tables that exists in one schema and may not exist in the other one.
    In another schema, i am creating consolidated views using union command.
    select * from schema1.table1
    union
    select * from schema2.table1
    union
    select * from schema2.table1
    If table1 do not exists in schema2, the view gives error.
    Is there any possibility that query somehow check if the table exists then select records otherwise skip? It has to be one query.
    I hope i am able to deliver through words what I mean.
    Your kind help is required on this.
    Regards, Imran

    So basically
    you want to have one view for all the tables with same name in different schemas
    and you don't want to check the existence of tables before creating the view.
    In that case you can create a script to generate the views by selecting from dba_tables like below
    select 'create or replace view v_'||table_name||' as select * from '||owner||'.'||table_name||' union bla bla bla' from dba_tables where table_name='table'
    you will probably end up doing this with a cursor and you need to be carefull about union clauses in case there is no bla bla part
    Coskan Gundogar
    Blog: http://coskan.wordpress.com
    Twitter: http://www.twitter.com/coskan
    Linkedin: http://uk.linkedin.com/in/coskan
    ---------

  • Using union

    I have these views using union
    create or replace view V_CONSULTATION_SUMMARY
    AS SELECT
    Consul_date "DATE",
    Consultation_No,
    TO_NUMBER(NULL) "RECEIPT_NO",
    Consultation_fee "CREDIT",
    TO_NUMBER(NULL) "AMOUNT_PAID"
    FROM consultation
    union select
    B.Receipt_Date "DATE",
    A.Consultation_No,
    B.Receipt_No "RECEIPT_NO",
    TO_NUMBER(NULL) "CREDIT",
    B.Amount_Paid "AMOUNT_PAID"
    FROM consultation A, Receipt B WHERE
    b.Consultation_No=A.Consultation_No
    ORDER BY "DATE", Consultation_No, RECEIPT_NO;
    create or replace view V_PATIENT_FINANCIAL_RECORDS
    AS SELECT
    A.PID,
    B.*
    FROM cONSULTATION A, V_CONSULTATION_SUMMARY B
    WHERE A.Consultation_No=B.Consultation_No;
    then I tried to access it from oracle forms using datablock wizard to access both views, and both of them failed. could some one tell me why. The error message is:
    FRM-40505: ORACLE error: unable to perform query
    thank's

    Why not?
    but, you should try it next time ->
    insert into <dest_table>
    select BKNO,BKNAME,AUTHORNAME,PUBLISHER,PRICE,STATUS
    from (
              select BKNO,BKNAME,AUTHORNAME,PUBLISHER,PRICE,STATUS
              from lib_bk_det
              union
              select BKNO,BKNAME,AUTHORNAME,PUBLISHER,PRICE,STATUS
              from lib_bk_det_20
          );N.b.: Not Tested...
    Regards.
    Satyaki de.

  • Using Union in popup LOV

    HI,
    I want to select data from 2 tables using Union in Popup LOV ,
    please help.
    I am getting a error message like
    "LOV query is invalid, a display and a return value are needed, the column names need to be different. If your query contains an in-line query, the first FROM clause in the SQL statement must not belong to the in-line query."
    when i use union query
    my query is like this
    select a from table 1
    union
    select b from table 2
    order by a;

    Hi,
    Three things -
    1) Remove the semi-colon from the end of your query (it can work without it, but you'll eventually run into problems some day by putting a semi-colon on the end, so better to get into the habit of not doing it).
    2) You need to provide 2 columns in your query, a display value and a return value (look at the error message you are getting). You are only returning a single column.
    3) Wrap your query inside another query to get it to work.
    Something like this should work -
    select * from (
      select 1 as r, 2 as d from dual
      union
      select 3 as r, 4 as d from dual)
    order by dObviously change the values/columns to suit your own purposes.
    Hope this helps,
    John.

  • Problems in creation of workbook using Change query local view.

    Hi Experts,
    I have created a Multiprovider by using union of two infocubes and created a Query based on Multiprovider.  I want to restrict one infocube in Change Query local view for creating new workbooks.  In Query global view we drag and drop the Infocube under Filters, but in the Query local view Filter panel is in disable mode. (My requirement is to create the workbooks using change query local view only)
    How can I restrict the one Infocube values in the workbooks by using Change query local view? 
    Thanks in advance.
    Venkat.

    Hi Venkat Prasad
    As you told that the query is on multi provider and the view is not allowing to declare/define filter value
    Just drag the infoprovider info object avilable under packet dimension to rows and right click on it restrict by selecting the name of the info provider when u right click it will show you the option of restrict once u click on it,it will takes to u a pop up where you can able to see the name of info providers and you specify according to it and finally in the display of results if you dont want to to display the info provider name then just right click on the 0infoprovider object under rows go to properties then choose hide option under display.
    Hope its clear a little..!
    Thanks
    K M R
    **Assigning points is the only way of saying thanks in SDN***
    >
    venkata prasad wrote:
    > Hi K M R,
    >
    > Thanks for ur quick response.  Most of the Infoobjects are common for both infocubes. I didn't understand this sentense "retrict the value with the infoprovider which values you are trying to view".
    > Please explian elaborately how to restrict the values speicfic to infoprovider under rows.

  • How to create olap cube using Named Query Table in Data source View

     I Create on OLAP Cube using Existing Tables Its Working Fine But When i Use Named Query Table with RelationShip To other Named query Table  It Not Working .So give me some deep Clarification On Olap Cube for Better Understanding
    Thanks

    Hi Pawan,
    What do you mean "It Not Working"? As Kamath said, please post the detail error message, so that we can make further analysis.
    In the Data Source View of a CUBE, we can define a named query. In a named query, you can specify an SQL expression to select rows and columns returned from one or more tables in one or more data sources. A named query is like any other table in a data source
    view (DSV) with rows and relationships, except that the named query is based on an expression.
    Reference:Define Named Queries in a Data Source View (Analysis Services)
    Regards,
    Charlie Liao
    TechNet Community Support

  • Query to create a view using the following tables

    Hi,
    I am struggling to write the proper query to create a view using three tables.
    I would really be thankful if anyone can help me.
    I am pasting the following script to create the required tables and also insert appropriate data in each of the table.
    create table HR.STUDENT_DETAILS (
    STUDENT_ID NUMBER(10),
    STUDENT_NAME VARCHAR2(50),
    DOB DATE,
    SEX CHAR(1),
    ACTIVE CHAR(1),
    CONTACT_NUMBER NUMBER(20),
    primary key(STUDENT_ID)
    create table HR.PAYMENT_HEADER (
    PAY_HEADER_ID NUMBER(10),
    DOC_NUM NUMBER(5),
    MONTH_NAME VARCHAR2(10),
    primary key(PAY_HEADER_ID)
    create table HR.PAYMENT_DETAILS (
    HEADER_ID NUMBER(10),
    LINE_ID NUMBER(10),
    STUDENT_ID NUMBER(10),
    CUM_AMOUNT NUMBER(10),
    primary key(HEADER_ID,LINE_ID)
    INSERT ALL
    INTO HR.STUDENT_DETAILS (STUDENT_ID,STUDENT_NAME,DOB,SEX,ACTIVE,CONTACT_NUMBER) VALUES (1112,'James','17-JUN-05','M','Y',23674378)
    INTO HR.STUDENT_DETAILS (STUDENT_ID,STUDENT_NAME,DOB,SEX,ACTIVE,CONTACT_NUMBER) VALUES (1113,'David','21-SEP-05','M','Y',24565457)
    INTO HR.STUDENT_DETAILS (STUDENT_ID,STUDENT_NAME,DOB,SEX,ACTIVE,CONTACT_NUMBER) VALUES (1114,'Michael','13-JAN-06','M','Y',25436784)
    INTO HR.STUDENT_DETAILS (STUDENT_ID,STUDENT_NAME,DOB,SEX,ACTIVE,CONTACT_NUMBER) VALUES (1115,'Joseph','03-JAN-06','M','Y',23435673)
    INTO HR.STUDENT_DETAILS (STUDENT_ID,STUDENT_NAME,DOB,SEX,ACTIVE,CONTACT_NUMBER) VALUES (1116,'Juliet','21-MAY-05','F','Y',23234527)
    INTO HR.STUDENT_DETAILS (STUDENT_ID,STUDENT_NAME,DOB,SEX,ACTIVE,CONTACT_NUMBER) VALUES (1117,'Monica','25-JUN-05','F','Y',24873245)
    INTO HR.STUDENT_DETAILS (STUDENT_ID,STUDENT_NAME,DOB,SEX,ACTIVE,CONTACT_NUMBER) VALUES (1118,'William','05-FEB-05','M','Y',23623245)
    INTO HR.STUDENT_DETAILS (STUDENT_ID,STUDENT_NAME,DOB,SEX,ACTIVE,CONTACT_NUMBER) VALUES (1119,'Karen','07-FEB-06','F','Y',26757543)
    INTO HR.STUDENT_DETAILS (STUDENT_ID,STUDENT_NAME,DOB,SEX,ACTIVE,CONTACT_NUMBER) VALUES (1120,'Erika','17-AUG-05','F','Y',25435465)
    INTO HR.STUDENT_DETAILS (STUDENT_ID,STUDENT_NAME,DOB,SEX,ACTIVE,CONTACT_NUMBER) VALUES (1121,'Noah','16-AUG-05','M','Y',23457645)
    INTO HR.STUDENT_DETAILS (STUDENT_ID,STUDENT_NAME,DOB,SEX,ACTIVE,CONTACT_NUMBER) VALUES (1122,'Angelina','28-SEP-05','F','Y',26456787)
    INTO HR.STUDENT_DETAILS (STUDENT_ID,STUDENT_NAME,DOB,SEX,ACTIVE,CONTACT_NUMBER) VALUES (1123,'Gabriela','30-SEP-05','F','Y',29767543)
    INTO HR.STUDENT_DETAILS (STUDENT_ID,STUDENT_NAME,DOB,SEX,ACTIVE,CONTACT_NUMBER) VALUES (1124,'Sofia','07-MAR-06','F','Y',27656578)
    SELECT * FROM DUAL;
    INSERT ALL
    INTO HR.PAYMENT_HEADER (PAY_HEADER_ID,DOC_NUM,MONTH_NAME) VALUES (305,1,'JAN')
    INTO HR.PAYMENT_HEADER (PAY_HEADER_ID,DOC_NUM,MONTH_NAME) VALUES (306,2,'FEB')
    INTO HR.PAYMENT_HEADER (PAY_HEADER_ID,DOC_NUM,MONTH_NAME) VALUES (307,3,'MAR')
    INTO HR.PAYMENT_HEADER (PAY_HEADER_ID,DOC_NUM,MONTH_NAME) VALUES (308,4,'APR')
    INTO HR.PAYMENT_HEADER (PAY_HEADER_ID,DOC_NUM,MONTH_NAME) VALUES (309,5,'MAY')
    SELECT * FROM DUAL;
    INSERT ALL
    INTO HR.PAYMENT_DETAILS (HEADER_ID,LINE_ID,STUDENT_ID,CUM_AMOUNT) VALUES (305,12,1112,40)
    INTO HR.PAYMENT_DETAILS (HEADER_ID,LINE_ID,STUDENT_ID,CUM_AMOUNT) VALUES (305,13,1113,40)
    INTO HR.PAYMENT_DETAILS (HEADER_ID,LINE_ID,STUDENT_ID,CUM_AMOUNT) VALUES (305,14,1114,40)
    INTO HR.PAYMENT_DETAILS (HEADER_ID,LINE_ID,STUDENT_ID,CUM_AMOUNT) VALUES (306,15,1112,80)
    INTO HR.PAYMENT_DETAILS (HEADER_ID,LINE_ID,STUDENT_ID,CUM_AMOUNT) VALUES (306,16,1113,80)
    INTO HR.PAYMENT_DETAILS (HEADER_ID,LINE_ID,STUDENT_ID,CUM_AMOUNT) VALUES (306,17,1114,80)
    INTO HR.PAYMENT_DETAILS (HEADER_ID,LINE_ID,STUDENT_ID,CUM_AMOUNT) VALUES (306,18,1115,40)
    INTO HR.PAYMENT_DETAILS (HEADER_ID,LINE_ID,STUDENT_ID,CUM_AMOUNT) VALUES (306,19,1116,40)
    INTO HR.PAYMENT_DETAILS (HEADER_ID,LINE_ID,STUDENT_ID,CUM_AMOUNT) VALUES (307,20,1112,120)
    INTO HR.PAYMENT_DETAILS (HEADER_ID,LINE_ID,STUDENT_ID,CUM_AMOUNT) VALUES (307,21,1113,120)
    INTO HR.PAYMENT_DETAILS (HEADER_ID,LINE_ID,STUDENT_ID,CUM_AMOUNT) VALUES (307,22,1114,120)
    INTO HR.PAYMENT_DETAILS (HEADER_ID,LINE_ID,STUDENT_ID,CUM_AMOUNT) VALUES (307,23,1115,80)
    INTO HR.PAYMENT_DETAILS (HEADER_ID,LINE_ID,STUDENT_ID,CUM_AMOUNT) VALUES (307,24,1116,80)
    INTO HR.PAYMENT_DETAILS (HEADER_ID,LINE_ID,STUDENT_ID,CUM_AMOUNT) VALUES (307,25,1117,40)
    INTO HR.PAYMENT_DETAILS (HEADER_ID,LINE_ID,STUDENT_ID,CUM_AMOUNT) VALUES (307,26,1118,40)
    SELECT * FROM DUAL;
    The above table STUDENT_DETAILS stores the details of all the students and each student has a unique student id.
    Another table PAYMENT_HEADER saves the payment details as a document for each month which has a header id.
    In the PAYMENT_DETAILS table, payment details are stored for the students (who made the payment for that month). This table does not save the data for a student if he has not paid on that month. This table is connected to the PAYMENT_HEADER table through a header Id.
    The view should be such that when I pass the document number, it shall show the names of all the students, but shall show payment amount only for those students who had paid under the selected document number, for other it should show null.
    I tried the following query:
    select * from (
    select sd.student_name,sd.DOB,sd.sex,sd.contact_number,pd.doc_num,pd.month_name,pd.cum_amount
    from hr.student_details sd left join
    (select hdr.doc_num,hdr.month_name,det.student_id,det.cum_amount
    from hr.payment_header hdr, hr.payment_details det
    where hdr.pay_header_id = det.header_id) pd on sd.student_id = pd.student_id)
    But when I pass the filtering values like document number, it does not show some students with null values.
    select * from (
    select sd.student_name,sd.DOB,sd.sex,sd.contact_number,pd.doc_num,pd.month_name,pd.cum_amount
    from hr.student_details sd left join
    (select hdr.doc_num,hdr.month_name,det.student_id,det.cum_amount
    from hr.payment_header hdr, hr.payment_details det
    where hdr.pay_header_id = det.header_id) pd on sd.student_id = pd.student_id)
    where doc_num = 1 or doc_num is null;
    My requirement is that, every time I use a document number in the where clause for the view it should show the paid amount against the student names who has paid on that month and for all other student it should null. Total student number is 13. So every time it should show 13 students only even when I pass document No 2 or 3.
    Seeking your help.
    Regards
    Hawker

    Hi Frank,
    as per your advice, I am omitting the 'DOB', 'GENDER','ACTIVE','CONTACT_NUMBER' fields from the 'STUDENT_DETAILS' table.
    I shall create separate tables and insert the desired output from the view for each where clause.
    First let us create three tables each for the desired out put:
    1) For the desired output I want to see when I pass doc_num as 1
    create table HR.SDT_PAY_DET_DOC_ONE (
    STUDENT_ID NUMBER(10),
    STUDENT_NAME VARCHAR2(50),
    DOC_NUM NUMBER(5),
    C_AMOUNT NUMBER(10),
    primary key(STUDENT_ID)
    2) For the desired output I want to see when I pass doc_num as 2
    create table HR.SDT_PAY_DET_DOC_TWO (
    STUDENT_ID NUMBER(10),
    STUDENT_NAME VARCHAR2(50),
    DOC_NUM NUMBER(5),
    C_AMOUNT NUMBER(10),
    primary key(STUDENT_ID)
    3) For the desired output I want to see when I pass doc_num as 3
    create table HR.SDT_PAY_DET_DOC_THREE (
    STUDENT_ID NUMBER(10),
    STUDENT_NAME VARCHAR2(50),
    DOC_NUM NUMBER(5),
    C_AMOUNT NUMBER(10),
    primary key(STUDENT_ID)
    Now I shall insert values in each of the above three tables:
    INSERT ALL
    INTO HR.SDT_PAY_DET_DOC_ONE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1112,'James',1,40)
    INTO HR.SDT_PAY_DET_DOC_ONE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1113,'David',1,40)
    INTO HR.SDT_PAY_DET_DOC_ONE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1114,'Michael',1,40)
    INTO HR.SDT_PAY_DET_DOC_ONE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1115,'Joseph',null,null)
    INTO HR.SDT_PAY_DET_DOC_ONE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1116,'Juliet',null,null)
    INTO HR.SDT_PAY_DET_DOC_ONE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1117,'Monica',null,null)
    INTO HR.SDT_PAY_DET_DOC_ONE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1118,'William',null,null)
    INTO HR.SDT_PAY_DET_DOC_ONE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1119,'Karen',null,null)
    INTO HR.SDT_PAY_DET_DOC_ONE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1120,'Erika',null,null)
    INTO HR.SDT_PAY_DET_DOC_ONE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1121,'Noah',null,null)
    INTO HR.SDT_PAY_DET_DOC_ONE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1122,'Angelina',null,null)
    INTO HR.SDT_PAY_DET_DOC_ONE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1123,'Gabriela',null,null)
    INTO HR.SDT_PAY_DET_DOC_ONE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1124,'Sofia',null,null)
    SELECT * FROM DUAL;
    INSERT ALL
    INTO HR.SDT_PAY_DET_DOC_TWO(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1112,'James',2,80)
    INTO HR.SDT_PAY_DET_DOC_TWO(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1113,'David',2,80)
    INTO HR.SDT_PAY_DET_DOC_TWO(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1114,'Michael',2,80)
    INTO HR.SDT_PAY_DET_DOC_TWO(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1115,'Joseph',2,40)
    INTO HR.SDT_PAY_DET_DOC_TWO(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1116,'Juliet',2,40)
    INTO HR.SDT_PAY_DET_DOC_TWO(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1117,'Monica',null,null)
    INTO HR.SDT_PAY_DET_DOC_TWO(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1118,'William',null,null)
    INTO HR.SDT_PAY_DET_DOC_TWO(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1119,'Karen',null,null)
    INTO HR.SDT_PAY_DET_DOC_TWO(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1120,'Erika',null,null)
    INTO HR.SDT_PAY_DET_DOC_TWO(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1121,'Noah',null,null)
    INTO HR.SDT_PAY_DET_DOC_TWO(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1122,'Angelina',null,null)
    INTO HR.SDT_PAY_DET_DOC_TWO(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1123,'Gabriela',null,null)
    INTO HR.SDT_PAY_DET_DOC_TWO(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1124,'Sofia',null,null)
    SELECT * FROM DUAL;
    INSERT ALL
    INTO HR.SDT_PAY_DET_DOC_THREE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1112,'James',3,120)
    INTO HR.SDT_PAY_DET_DOC_THREE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1113,'David',3,120)
    INTO HR.SDT_PAY_DET_DOC_THREE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1114,'Michael',3,120)
    INTO HR.SDT_PAY_DET_DOC_THREE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1115,'Joseph',3,80)
    INTO HR.SDT_PAY_DET_DOC_THREE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1116,'Juliet',3,80)
    INTO HR.SDT_PAY_DET_DOC_THREE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1117,'Monica',3,40)
    INTO HR.SDT_PAY_DET_DOC_THREE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1118,'William',3,40)
    INTO HR.SDT_PAY_DET_DOC_THREE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1119,'Karen',null,null)
    INTO HR.SDT_PAY_DET_DOC_THREE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1120,'Erika',null,null)
    INTO HR.SDT_PAY_DET_DOC_THREE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1121,'Noah',null,null)
    INTO HR.SDT_PAY_DET_DOC_THREE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1122,'Angelina',null,null)
    INTO HR.SDT_PAY_DET_DOC_THREE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1123,'Gabriela',null,null)
    INTO HR.SDT_PAY_DET_DOC_THREE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1124,'Sofia',null,null)
    SELECT * FROM DUAL;
    Thanks & Regards
    Hawker

  • Query takes long when using UNION

    Hi ,
    I habe a query as follows;
    SELECT
                        '9999' site_id,
                        m.ghi_prov_num provnum,
                           SUBSTR (l.seq_num, 1, 3)provloc,
                        t.dea_number dea,
                            t.license_number statelicensenumber ,
                            n.npi_num npi,
                            m.prefix prefixname,
                            m.lastname lastname,
                            m.firstname firstname,
                            t.middle_name middleinitial,
                            m.suffix suffixname,
                            null clinicname,
                            l.street1 addressline1,
                            l.street2 addressline2,
                            l.city city,
                            l.state state,
                            l.zip5 zip,
                            l.phone phoneprimary,
                            null ext,
                            null fax,
                            null email,
                            null alt_phone,
                            null alt_phone_ext
                     FROM provider m, LOCATION l, npi n,TEMP_VITAL_CACTUS t,test_provider_pin pin
                      WHERE m.ghi_prov_num=l.ghi_prov_num
                          and m.ghi_prov_num=n.ghi_prov_num(+)
                          and m.ghi_prov_num=t.ghi_prov_num(+)
                          and m.tax_id=pin.tax_id
         UNION
          SELECT   
                        '9999', m.ghi_prov_num ,
                            m.location provloc,
                           null  ,
                           null  ,
                            n.npi_num  ,
                            null ,
                            m.lastname ,
                            m.firstname  ,
                            null,
                            null  ,
                            null  ,
                            m.street1  ,
                            m.street2  ,
                            m.city ,
                            m.state  ,
                            m.zip5 ,
                            m.phone  ,
                            null  ,
                            null  ,
                            null  ,
                            null  ,
                            null
                           FROM dental_provider m, npi n,test_provider_pin pin
                       WHERE m.ghi_prov_num=n.tax_id(+)
                           and m.location=n.location(+)
                            and pin.tax_id=m.ghi_prov_num;The query takes for ever;
    But Individual query takes less than a sec to execute.Is there any way can i rewrite the query?
    Please help
    Hena.

    user11253970 wrote:
    But Individual query takes less than a sec to execute.Is there any way can i rewrite the query?Have a feeling you are using Toad/SQL Navigator or similar tool which returns data one screen at a time. If so, then it does not "takes less than a sec to execute" but rather to fetch first screen of rows. When you use UNION Oracle has to return distinct rows from both queries. Therefore it must fetch not just first screen but all rows. To verify, issue first query and in yiour GUI tool click on get last screen. Then you'll know how long whole select takes. Do the same for second query. Also, do you need distinct rows or akll rows? IF all rows, change UNION to UNION ALL.
    SY.

  • Using Power Query to import image files for Power View

    I am trying to use Power Query to import image data from a SQL Azure database for use in Power View.  I've selected both the source image table and the ?images table in the workbook query.  The files seem to load as binary data in the Power
    Query editor but when loaded to the data model with Power Pivot, the field becomes "text" type rather than binary.  Does anyone know the procedure to use  PowerQuery to load image files into PowerPivot?

    Hi,
    We currently do not support loading binary data from Power Query into the Power Pivot data model. This is something we'd like to address soon. For now, you will need to use the Power Pivot import capabilities if you want to achieve this.
    Sorry about the inconvenience - we will try to enable this feature over the coming months.
    Faisal Mohamood | Program Manager | Data Platform Group - Microsoft

  • Command Query using UNION

    Hello,
    I may be barking up the wrong tree and asking this question in the wrong forum so please accept my apologies if this is the case.
    I have access to a MYSql database through a ODBC connection and would like to create a report based on four tables (let's say A, B, C and D) where tables A & B hold biographical data and tables C & D  contain different attribute detail with identical column names (attrib_name and attrib_desc) that relate to A & B .
    The report I would like to create will list records from both A and B along with corresponding records from C and D merged into two columns attrib_name and attrib_desc.
    I have tried a couple of versions of a union query but I just cannot seem to get it to generate the correct output.
    Any help would be much appreciated.
    Thank you
    Paul

    hi Paul,
    Command objects are written in syntax specific to the database that you're using, so you may be best off looking at mysql forums instead. plus you haven't really stated what the issue is that you experiencing.
    given the above, here's a couple basic things about UNION syntax...
    1 the number of fields selected must be the same
    2 the corresponding fields should be in the same sequence
    3 the types (e.g. date, integer) must match
    4 in your SELECT statement use an AS 'name' for each field so that the field names match up in both sets in the query
    you may also wish to use a UNION ALL instead of a UNION as UNION ALL will ensure that all records are brought back as opposed to UNION which does a check on a virtual record set to ensure that there's no duplicates...this in turn can cause performance to suffer a bit.

Maybe you are looking for

  • Help how do I run pokerstars on a MAC?

    Sorry, but I am new and don't understand much about computers. Have a MAC that is new, and my husband wants to play on Pokerstars, but it is on windows. Is there anyway to run it on a Mac? Thanks...

  • How to post overhead costs in WBS object currency?

    I have a requirement to post the overhead costs (t.code CJ45) to the WBS elements in the respective WBS element object currency instead of the controlling area currency or the company code currency. How can i configure this?

  • Address Book, MS Entourage Contact Lists

    What is the easiest way to transfer/import a contact list from my PC (MS Outlook) to my new Mac (MS Entourage or Address Book)

  • Serial Composition with In/Out points

    I`ve asked that question a while back in the prerelease forum but did not made any progress since then so one more try. I would like to play a series of videos. For those videos i want to specify individual in and out points. So the first video shoul

  • NI-DAQ Select_Signal() arguments

    iStatus = Select_Signal(iDevice, ulGpctrOutput, ulGpctrOutput,ND_LOW_TO_HIGH); The above code appears in NI's example program "TIOgenSquareWave.c". I can find nothing in the documentation that refers to this arrangement of parameters. What's going on