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.

Tags: Database

Similar Questions

  • CREATE a USER Oracle 12 c fails with ORA-01031 (insufficient privileges)

    I work with a client to start the test 12 c with an application.

    User logged into the database by using both "/ as sysdba" and "xxxxxxx/sys as sysdba.

    However, doing so CREATE USER someuser IDENTIFIED BY somepass;

    insufficient privileges ORA-01031 auto fails.

    I don't see an obvious reason why this does not work, and it works on my own system. Any ideas are appreciated.

    He said he was using a traditional database (no plug-in) wrong after previously created a pluggable.

    Daryl

    by chance, do you have database Vault (figure DVSYS) installed in your database? According to default manual installation program prevents you to create the user if data vault is configured.

    http://docs.Oracle.com/CD/B28359_01/server.111/b31222/DB_objects.htm

    Oracle Database Vault | Oracle database | Oracle

    Oracle Database Vault allows customers to avoid excesses in controlling the use of commands such as ALTER SYSTEM, ALTER USER, DROP USER, CREATE USER, etc.

    In addition, check this box

    "Create a user" gives ORA-01031: not sufficient privileges to user sys

  • Create the view with the Unique ID column

    I need to create a view.
    The view is created using unions on 4 tables.
    The problem is that I need to create a unique id column in the view that I use in an Oracle Apex application and need to drill down to each line.

    Any help appreciated

    Gus

    You cannot use oracle sequences directly in the query that is connected with other queries using Union or INTERSECT or less cluses.

    Other cases where you cannot use a sequence are:
    -In a WHERE clause
    -In a GROUP BY or ORDER BY clause
    -In a SEPARATE clause
    -Along with a UNION or INTERSECT or LESS
    -In a subquery

    In order to better you will love

    Select seqname.nextval, col1, col2
    Of
    (

    Union

    ..
    ..
    )

    as mentioned in one of the previous answer by the other members of the community...

    Alternatively, you can use rownum speed of sequence to a unique number as below examle:

    Select rownum, col1, col2
    Of
    (

    Union

    ..
    ..
    )

    Kind regards
    Lifexisxnotxsoxbeautiful...

  • View with subquery loss precision and scale

    Hello

    Is it possible to preserve (or force somehow) precision number of column in a view with a subquery? Seem CAST does not work in the subquery with NUMBER type...

    I was following the situation (10 g 2):

    create or replace view abc as
    Select cast (1 as number (2)) C1, "A" C2, (select cast (1 as number (2)) from dual) as c3
    Double;



    SQL > desc abc
    Name Null? Type
    ----------------------------------------- -------- ----------------------------
    C1 NUMBER (2)
    C2 CHAR (1)
    C3 NUMBER

    SQL >

    CAST does not seem to work in C3.

    Thank you.

    Pass the cast outside the subquery.

    ME_XE?create or replace view abc as
      2  select
      3     cast(1 as number(2)) as c1,
      4     'A' as c2,
      5     cast((select 1 from dual) as number(2)) as c3
      6  from dual;
    
    View created.
    
    Elapsed: 00:00:00.21
    ME_XE?desc abc
     Name                                                  Null?    Type
     ----------------------------------------------------- -------- ------------------
     C1                                                             NUMBER(2)
     C2                                                             CHAR(1)
     C3                                                             NUMBER(2)
    
    ME_XE?
    
  • Creating master repository error: ORA-01031: insufficient privileges

    Hello

    I try to install ODI in my VM.

    I did the installation and creating master repository, I am getting following error:

    ORA-01031: insufficient privileges

    I'm using Oracle & created as ODI_MASTER user with administrator privileges.
    I will use it to load the metadata on planning (Version 11.1.2)

    Am I missing out on.

    Jitendra.

    Seems missing grants on the user that you use to create the master repository.

    you use Oracle... Grant connect, resource to . These two rolesa have sufficient access to db to create the master repository.

    execuute the sql code of the sys user

    Kind regards
    Amit

    Published by: amitgupta1202 on August 20, 2009 22:42

  • Syntax to create the view with 2 inline tables

    Hello

    If I run this SQL, I can compile a view without error:

    CREATE OR REPLACE FORCE VIEW APPS.XX_TEST
    (
        period_name
      , ytd
    )
    AS
    with tbl_data AS
    (
    SELECT '1314-03:OCT' period_name, -100 YTD FROM DUAL UNION ALL
    SELECT '1314-03:OCT' period_name, -1250 YTD FROM DUAL UNION ALL
    SELECT '1314-03:OCT' period_name, 10922 YTD FROM DUAL UNION ALL
    SELECT '1314-02:SEP' period_name, -100 YTD FROM DUAL UNION ALL
    SELECT '1314-01:AUG' period_name, 0 YTD FROM DUAL UNION ALL
    SELECT '1314-00:OBL' period_name, 0 YTD FROM DUAL UNION ALL
    SELECT '1213-14:CBL' period_name, -350 YTD FROM DUAL UNION ALL
    SELECT '1213-13:ADJ' period_name, -350 YTD FROM DUAL UNION ALL
    SELECT '1213-12:JUL' period_name, -100 YTD FROM DUAL
    )    SELECT  period_name
               , ytd
            FROM tbl_data;
    

    I need to create a view that includes the 2 tables inline (sorry if this is the incorrect terminology), using this SQL:

    CREATE OR REPLACE FORCE VIEW APPS.XX_TEST2
    (
        period_name
      , ytd
    )
    AS
    with tbl_data AS
    (
    SELECT '1314-03:OCT' period_name, -100 YTD FROM DUAL UNION ALL
    SELECT '1314-03:OCT' period_name, -1250 YTD FROM DUAL UNION ALL
    SELECT '1314-03:OCT' period_name, 10922 YTD FROM DUAL UNION ALL
    SELECT '1314-02:SEP' period_name, -100 YTD FROM DUAL UNION ALL
    SELECT '1314-01:AUG' period_name, 0 YTD FROM DUAL UNION ALL
    SELECT '1314-00:OBL' period_name, 0 YTD FROM DUAL UNION ALL
    SELECT '1213-14:CBL' period_name, -350 YTD FROM DUAL UNION ALL
    SELECT '1213-13:ADJ' period_name, -350 YTD FROM DUAL UNION ALL
    SELECT '1213-12:JUL' period_name, -100 YTD FROM DUAL
    ), got_analytics AS
        (
            SELECT  
                period_name,
                ytd,
                ROW_NUMBER () OVER (ORDER BY  period_name)  AS a_num,
                ROW_NUMBER () OVER (ORDER BY  period_name  DESC)  AS d_num,
                FIRST_VALUE (ytd) OVER (ORDER BY  period_name) - FIRST_VALUE (ytd) OVER (ORDER BY  period_name  DESC) AS dif
        FROM    tbl_data
        )
        SELECT  *
           FROM got_analytics;
    

    I get this message:

    ORA-24344: success with compilation error

    There are no other errors but to provide additional information. I am using TOAD.

    I was wondering if it is not possible to create a view in this way, or if I'm missing something?

    I had a peek here:

    ORA-24344: success with Compilation error

    I'm using TOAD, trying to SHOW the ERRORS immediately after the code above only returned 'No Errors'.

    I also looked here:

    ORA-24344: success with compilation error

    Ran the same code SQL/Plus, but "Show Errors" or "see the err" also returned "No. Errors."

    Any advice would be much appreciated.

    Thank you very much.

    Hello

    Try this

      CREATE OR REPLACE FORCE VIEW  APPS.XX_TEST2
        (
            period_name
          , ytd
          ,  a_num    -- because you select * you need all rows
          ,  d_num
          ,  dif
        )
        AS  ...
    

    concerning
    Kay

  • 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

  • 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.

  • 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.

  • 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.

  • 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 with a column change journal

    Hello

    I have the following table:

    create table test1)

    number of site_number

    date of change_date,

    number of area_ha);

    insert into test1 values (1, TO_DATE('1/1/2007','DD/MM/RRRR'), 20);

    insert into test1 values (1, TO_DATE('1/1/2008','DD/MM/RRRR'), 30);

    insert into test1 values (1, TO_DATE('1/1/2009','DD/MM/RRRR'), 25);

    insert into test1 values (2, TO_DATE('1/1/2007','DD/MM/RRRR'), 50);

    insert into test1 values (2, TO_DATE('1/1/2008','DD/MM/RRRR'), 60);

    insert into test1 values (2, TO_DATE('1/1/2009','DD/MM/RRRR'), 60);

    insert into test1 values (3, TO_DATE('1/1/2007','DD/MM/RRRR'), 20);

    insert into test1 values (3, TO_DATE('1/1/2008','DD/MM/RRRR'), 25);

    insert into test1 values (3, TO_DATE('1/1/2009','DD/MM/RRRR'), 30);

    What I want to do is to have a view based on the table above which includes a column of change (change_log below) based on the anterior surface (area_ha) for each specific site_number. For example in the first line site_number 1 has increased the area of 20 hectares on the 01/01/2007 to 30 hectares on the next change_date for this site that 01/01/2008. How this could be done?

    SITE_NUMBER CHANGE_DATE AREA_HA CHANGE_LOG
    101/01/200720NO CHANGE
    101/01/200830ADDED SPACE
    101/01/200925DELETED DOMAIN
    201/01/200750NO CHANGE
    201/01/200860ADDED SPACE
    201/01/200960NO CHANGE
    301/01/200720NO CHANGE
    301/01/200825ADDED SPACE
    301/01/200930ADDED SPACE

    I am using oracle 11g R2

    Select site_number,

    change_date,

    area_ha,

    sign of case (area_ha - lag(area_ha,1,area_ha) over (partition by order of change_date site_number))

    When 1 "AREA ADDED.

    When-1 then "ZONE DELETED."

    Another 'NO CHANGE'

    end change_log

    of test1

    order of site_number,

    change_date

    /

    SITE_NUMBER CHANGE_DA AREA_HA CHANGE_LOG
    ----------- --------- ---------- ------------
    1 1 JANUARY 07 20 NO CHANGE
    1 1 JANUARY 08-30 ADDED SPACE
    1 1 JANUARY 09 25 DELETED AREA
    2 1 JANUARY 07 50 NO. CHANGE
    2 1 JANUARY 08 60 ADDED SECTOR
    2 1 JANUARY 09 60 NO. CHANGE
    3 1ST JANUARY 07 20 NO. CHANGE
    3 AREA 1 JANUARY 08 25 ADDED
    3 1ST JANUARY 09 30 ADDED AREA

    9 selected lines.

    SQL >

    SY.

  • Create the view with the CLOB of TABLE data type with the LONG data type

    Please need support to create the table view
    Source table: (itemid varchar2, longrec)
    need to create the table view Source
    (itemid varchar2, CLOBrec)

    A BUSINESS object must have a storage in the database, so you can't have a CLOB column in a view by pointing to a not lob data column.

    Max
    [My Italian blog Oracle | http://oracleitalia.wordpress.com/2010/01/17/supporto-di-xml-schema-in-oracle-xmldb/]

  • Create view with different schemas

    Hello

    I would like to create a view using data on different patterns.

    For example, user A has a table1 and user B has also a table1.
    On the schema user C, I would make a union of two table in the same point of view as:

    If user C is running:

    Select * from A.table1
    Union
    Select * from B.table1

    It's ok, but when I try:

    CREATE or REPLACE view view_table1 AS FORCE
    Select * from A.table1
    Union
    Select * from B.table1

    It returns the ERROR at line 0: ORA-01031: insufficient privileges

    But the C user has SELECT ANY TABLE, update ANY TABLE, DELETE ANY TABLE,... rights

    Someone has an idea?

    Thank you!

    Published by: bushi893 on August 30, 2010 19:53

    When you create a view containing the object of different owners, the other owners have to grant "with grant option" to the owner of the view. Thus, the view owner can grant to other users or patterns...

    Example: The latter is the owner of a table called mine_a User_b is the owner of a table called yours_b

    Let's say user_b want to create a view with a join of mine_a and yours_b

    To see it working properly, it must give "grant select on mine_a to user_b with grant option.

    Then user_b may grant select on this point of view to everyone.

Maybe you are looking for

  • Satellite Pro A200GE and WXP - can I use the PSAE7 drivers or it won't work?

    The performance of Vista business makes me crazy, I need to go back to XP + sv pack 2.If I format my machine (A200GE) and install XP. can I use the drivers for the PSAE7? (or that the A200GE is PSAE7E this solution will not work?) Also do I need to c

  • Conversion of IBIS to SPICE

    Hello I would like to convert spindle IBIS models to patterns of behavior SPICE I can import in multisim. I then combine these models of PIN with others built in components to make a simulation of end to end. I tried the free converter of Intusoft an

  • Pavilion dv6000: System disabled code 03709

    How can I work around this error. I deleted just the system password when then suddenly when start the guest always ask password and then up to 3 attempts 03709 error. PLS HELP.

  • Download Outlook Express on my new computer with Windows 7?

    Download outlook express on my new computer using windows 7? How? Original title: outlook express & windows 7

  • 14 HP v021tu Notebook (Gen 4: upgrading ram)

    Hai I'm thing to add 4 GB of additional ram for my existing ram 4 GB 14 HP v021tu Notebook (4th Gen Ci3 / 4 GB/1 TB / Win8.1) so one help me what kind of ram should we support as is the type of housing need which is the clock speed and something else