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

Tags: Database

Similar Questions

  • error ORA-00942 table or view does not gv$ session s, v$ sql

    Hello

    I used it after request for package gives error ORA-00942 table or view does not exist but I run same query in sql plsql developer command run successfully.

    SELECT sid, serial #.
    in V_SID, V_SERIAL
    GV $ session s, v$ sql v
    WHERE username = "USER1".
    and s.SQL_ID = v.SQL_ID


    Kind regards
    Vaibhav
    grant select on gv_$session to ;
    grant select on v_$sql to ;
    

    Note If you are using GV$ SESSION then you must also use GV$ SQL and join with INST_ID column select.

  • Error ORA-20987 creating users with apex_util.create_user.

    Hello. I need to copy users from one summit to the other.

    @apex4 is a DBlink apex 4 initial installation, I need to create users on a new server apex4, where I am loged and run this script:


    declare
    users of cursor is
    Select *.
    of apex_040100.wwv_flow_fnd_user@apex4
    where user_name <>'ADMIN ';
    Start
    for you in a loop users
    (. Create_user) APEX_UTIL
    p_user_id = > u.user_id,.
    p_user_name = > u.user_name,
    p_first_name = > u.first_name,
    p_last_name = > u.last_name,
    p_description = > u.description,
    p_email_address = > u.email_address,
    p_web_password = > '1234'.
    p_web_password_format = > 'CLEAR_TEXT');
    end loop;
    end;

    I tried to connect with apex_public_user and sys as sysadmin, but I still get the same error:

    ORA-20987: APEX - unauthorized access (package for the undefined security group variable). -Contact your administrator of the application.
    ORA-06512: en "APEX_040100.WWV_FLOW_ERROR", line 704
    ORA-06512: en "APEX_040100.WWV_FLOW_ERROR", line 1008
    ORA-06512: en "APEX_040100.WWV_FLOW_FND_USER_API", line 24
    ORA-06512: en "APEX_040100.WWV_FLOW_FND_USER_API", line 617
    ORA-06512: en "APEX_040100.HTMLDB_UTIL", linea 1395
    ORA-06512: in linea 8

    Thanks in advance and sorry for my English.

    Published by: Andres Vilallave on 2012-ene-31 12:48

    Published by: Andres Vilallave on 31-ene-2012 12:49

    Hello

    When you run this code?
    If you run this code in SQL client like SQL * Plus or SQL Developer this post might help
    Re: installation of the runtime: how to create users?

    Kind regards
    Jari

    http://dbswh.webhop.NET/dbswh/f?p=blog:Home:0

  • DBUM target Recon - java.sql.SQLSyntaxErrorException error: ORA-00942: table or view does not exist

    Hello

    When I run DBUM Targer user reconciliation (recon Filtered) I get the error in the log below.

    We have created an account with privileges below target. y at - it all permisssions more necessary for execution of the reconciliation of the target.

    [2015-10 - 09T 10: 47:45.717 - 07:00] [oimext_server1] [NOTIFICATION] [] [oracle.iam.scheduler.vo] [tid: OIMQuartzScheduler_Worker-4] [username: oiminternal] [ecid: 77744a889dde03de:-265ee4b8:15049ac7206: - 8000-0000000000000004, 1:18393] [APP: IOM #11.1.2.0.0] details executeJob DBUM Oracle user target reconciliation method

    [2015-10 - 09T 10: 47:45.842 - 07:00] [oimext_server1] [WARNING] [] [ORG. IDENTITYCONNECTORS. DBUM. DBUMCONNECTOR] [tid: Thread-276] [username: oiminternal] [ecid: 77744a889dde03de:-265ee4b8:15049ac7206: - 8000 - 1:18558 0000000000000004,] [APP: IOM #11.1.2.0.0] org.identityconnectors.dbum.DBUMConnector: parseConnectionProperties: no connection properties

    [2015-10 - 09T 10: 47:45.878 - 07:00] [oimext_server1] [WARNING] [] [ORG. IDENTITYCONNECTORS. DBUM. DBUMCONNECTOR] [tid: Thread-276] [username: oiminternal] [ecid: 77744a889dde03de:-265ee4b8:15049ac7206: - 8000-0000000000000004, 1:18558] [APP: IOM #11.1.2.0.0] org.identityconnectors.dbum.DBUMConnector: dropUnusedSearchAttributes: fall tmpQuota

    [2015-10 - 09T 10: 47:45.879 - 07:00] [oimext_server1] [WARNING] [] [ORG. IDENTITYCONNECTORS. DBUM. DBUMCONNECTOR] [tid: Thread-276] [username: oiminternal] [ecid: 77744a889dde03de:-265ee4b8:15049ac7206: - 8000-0000000000000004, 1:18558] [APP: IOM #11.1.2.0.0] org.identityconnectors.dbum.DBUMConnector: dropUnusedSearchAttributes: fall tmpQuota

    [2015-10 - 09T 10: 47:45.881 - 07:00] [oimext_server1] [ERROR] [] [ORG. IDENTITYCONNECTORS. DBUM. SQLEXECUTIONHANDLER] [tid: Thread-276] [username: oiminternal] [ecid: 77744a889dde03de:-265ee4b8:15049ac7206: - 8000-0000000000000004, 1:18558] [APP: IOM #11.1.2.0.0] org.identityconnectors.dbum.SQLExecutionHandler: executeAccountSearch: error when searching for user records [[ ]]

    java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist

    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:462)

    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:405)

    at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:931)

    at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:481)

    at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:205)

    at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:548)

    at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:217)

    at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:947)

    at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1283)

    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1441)

    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3769)

    at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3823)

    at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1671)

    at org.identityconnectors.dbum.SQLExecutionHandler.searchAccounts(SQLExecutionHandler.java:287)

    at org.identityconnectors.dbum.SQLExecutionHandler.executeAccountSearch(SQLExecutionHandler.java:95)

    at org.identityconnectors.dbum.DBUMConnector.executeQuery(DBUMConnector.java:199)

    at org.identityconnectors.dbum.DBUMConnector.executeQuery(DBUMConnector.java:74)

    at org.identityconnectors.framework.impl.api.local.operations.SearchImpl.rawSearch(SearchImpl.java:118)

    at org.identityconnectors.framework.impl.api.local.operations.SearchImpl.search(SearchImpl.java:82)

    at sun.reflect.GeneratedMethodAccessor5776.invoke (unknown Source)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

    at java.lang.reflect.Method.invoke(Method.java:597)

    at org.identityconnectors.framework.impl.api.local.operations.ConnectorAPIOperationRunnerProxy.invoke(ConnectorAPIOperationRunnerProxy.java:93)

    to com.sun.proxy. $Proxy575.search (unknown Source)

    at sun.reflect.GeneratedMethodAccessor5776.invoke (unknown Source)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

    at java.lang.reflect.Method.invoke(Method.java:597)

    at org.identityconnectors.framework.impl.api.local.operations.ThreadClassLoaderManagerProxy.invoke(ThreadClassLoaderManagerProxy.java:107)

    to com.sun.proxy. $Proxy575.search (unknown Source)

    at sun.reflect.GeneratedMethodAccessor5776.invoke (unknown Source)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

    at java.lang.reflect.Method.invoke(Method.java:597)

    to org.identityconnectors.framework.impl.api.BufferedResultsProxy$ BufferedResultsHandler.run (BufferedResultsProxy.java:162)

    ]]

    [2015-10 - 09T 10: 47:45.892 - 07:00] [oimext_server1] [NOTIFICATION] [] [oracle.iam.scheduler.impl.quartz] [tid: OIMQuartzScheduler_Worker-4] [userId: oiminternal] [ecid: 77744a889dde03de:-265ee4b8:15049ac7206: - 8000-0000000000000004, 1:18393] [APP: #11.1.2.0.0 IOM] Job listener, Job was performed QuartzJobListener.jobWasExecuted Description DEFAULT null FullName. DBUM Oracle DBUM Oracle target reconciliation user name reconciliation target user

    [2015-10 - 09T 10: 47:46.116 - 07:00] [oimext_server1] [ERROR] [] [] [tid: [ASSETS].] [ExecuteThread: '6' for queue: "(self-adjusting) weblogic.kernel.Default"] [username: xelsysadm] [ecid: 77744a889dde03de:-265ee4b8:15049ac7206 :-8000-0000000000010 c 79, 0] [APP: IOM #11.1.2.0.0] [IDDM: 0000L1Dd4upEoIs6wjyWMG1M5jJP00000S] could not communicate with one of the server access set up, make sure it is running.

    [2015-10 - 09T 10: 47:46.517 - 07:00] [oimext_server1] [ERROR] [] [] [tid: Watcher] [username: < anonymous >] [ecid: 0000L19f77uEoIs6wjyWMG1M5jJP000000, 1:18404] error receive challenge server hacked

    [2015-10 - 09T 10: 47:49.271 - 07:00] [oimext_server1] [ERROR] [] [] [tid: [ASSETS].] [ExecuteThread: '12' to the queue: "(self-adjusting) weblogic.kernel.Default"] [username: xelsysadm] [ecid: 77744a889dde03de:-265ee4b8:15049ac7206:-8000-0000000000010c7c, 0] [APP: IOM #11.1.2.0.0] [IDDM: 0000L1Dd4upEoIs6wjyWMG1M5jJP00000S] could not communicate with one of the server access set up, make sure it is running.

    [2015-10 - 09T 10: 47:49.718 - 07:00] [oimext_server1] [ERROR] [] [] [tid: [ASSETS].] [ExecuteThread: '21' for queue: "(self-adjusting) weblogic.kernel.Default"] [username: xelsysadm] [ecid: 77744a889dde03de:-265ee4b8:15049ac7206:-8000-0000000000010c7e, 0] [APP: IOM #11.1.2.0.0] [IDDM: 0000L1Dd4upEoIs6wjyWMG1M5jJP00000S] could not communicate with one of the server access set up, make sure it is running.

    Thank you

    After changing the logging level for 32 track, filled with the SQL log file.

    The application consisted of a JOIN with two or three tables table (dba_users and dba_quota_tablespaces).

    After providing privileges select on the quota table, I was able to learn from the user.

    Thank you

  • 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

  • 30002 error/ORA-00942 table or view does not exist

    Hello

    We are running on a Windows 2008 R2 machine RoboServer 9 with Tomcat 7. The database, that we strive to connect is an Oracle 11 g on a Linux x86_64 host server. I connect using the Oracle through ODBC drivers. When I click "test connection" of the ODBC Administrator or application configuration, I get the message 'successful connection '. That is the problem.

    When you try to run our reports, especially "Frequently consulted CSH" or "Frequently viewed Topics", we get the following error.

    Error..JPG

    Check the localhost.log in Tomcat, we get this:

    Journal of the org.apache.catalina.core.ApplicationContext 10:37:41 28 March 2013

    SEVERE: java.sql.SQLException: [Oracle] [ODBC] [Ora] ORA-00942: table or view does not exist

    java.sql.SQLException: [Oracle] [ODBC] [Ora] ORA-00942: table or view does not exist

    at sun.jdbc.odbc.JdbcOdbc.createSQLException (unknown Source)

    at sun.jdbc.odbc.JdbcOdbc.standardError (unknown Source)

    at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect (unknown Source)

    at sun.jdbc.odbc.JdbcOdbcStatement.execute (unknown Source)

    at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery (unknown Source)

    at adobe.robohelp.server.FlexReports.AreasReqHelpReport.SetData(AreasReqHelpReport.java:84)

    at adobe.robohelp.server.FlexReports.Report.ProcessReport(Report.java:295)

    at adobe.robohelp.server.ReportManager.doCommand(ReportManager.java:395)

    at adobe.robohelp.server.RoboHelpServer.doGet(RoboHelpServer.java:144)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.j ava: 290)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)

    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:470)

    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)

    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)

    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)

    at org.apache.coyote.http11.Http11Protocol$ Http11ConnectionHandler.process (Http11Protocol.ja goes: 602)

    to org.apache.tomcat.util.net.JIoEndpoint$ Worker.run (JIoEndpoint.java:489)

    at java.lang.Thread.run (unknown Source)

    Looks like all tables exist in the database - this is what we have:

    TEST:

    ROBOTST4 > select object_name from dba_objects where type_objet = 'TABLE' and owner = 'MCVICKER;

    OBJECT_NAME

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

    TACTIONTYPE

    TERRORTYPE

    THELPPROJECT

    THELPSPACEERROR

    TUSER

    TPROBLEM

    TSOLUTIONACTION

    THELPTOPICS

    TUSERPREFS

    TSETTING

    TSESSION

    TACCESSTYPE

    TROBOGROUPS

    TROBOUSER

    TROBOUSERGROUPS

    TLDAPUSERGROUPS

    TGROUPPERMISSIONS

    TLDAPGROUPS

    TCOMMENTS

    TDELETEDCOMMENTS

    TUSERTOPICRATING

    TAVGTOPICRATING

    22 selected lines.


    I think that we have set. Here's the deal.

    For some reason, the database put in place all the tables but not views initially. My DBA views manually created using definitions of the included database. In Access, if you go in queries, then right-click on the table, select "design mode".  Right-click on the design mode, select "SQL Mode" and you can view the SQL statements used to define the view.  You should see something like this:

    She has slightly modified the - here's what she created:

    Created to MCVICKER's point of view in ROBOTST.

    create or replace view mcvicker. VSolutionAction

    SELECT

    TSolutionAction.sa_SolutionActionID,

    TSolutionAction.sa_Time,

    TSolutionAction.se_SessionID,

    TSolutionAction.pb_ProblemID,

    TSolutionAction.sq_SequenceID,

    TSolutionAction.hp_HelpProjectID,

    TSolutionAction.at_ActionTypeID,

    TSolutionAction.sa_SortData,

    LTRIM(sa_DisplayName,255) AS sa_GroupDisplayName,

    -Left $([sa_DisplayName],255) AS sa_GroupDisplayName,

    TSolutionAction.sa_DisplayName,

    TSolutionAction.sa_NumericData,

    LTRIM(sa_StringData,255) AS sa_GroupStringData,

    -Left $([sa_StringData],255) AS sa_GroupStringData,

    TSolutionAction.sa_StringData,

    TSolutionAction.sa_ExtraData,

    TSolutionAction.sa_ProblemSolved,

    TSolutionAction.ha_AreaName

    OF TSolutionAction;

    create or replace view mcvicker. VHelpProject

    as

    SELECT

    THelpProject.hp_HelpProjectID,

    LTRIM(hp_Name,255) AS hp_GroupName,

    -Left $([hp_Name],255) AS hp_GroupName,

    THelpProject.hp_Name,

    THelpProject.ha_AreaName

    OF mcvicker. THelpProject;

    create or replace view mcvicker. VProblem

    as

    SELECT

    TProblem.pb_ProblemID,

    TProblem.se_SessionID,

    TProblem.pb_InitiationTime,

    LTRIM(pb_ReferringURL,255) AS pb_GroupReferringURL,

    -Left $([pb_ReferringURL],255) AS pb_GroupReferringURL,

    TProblem.pb_ReferringURL,

    LTRIM(pb_ReferringParams,255) AS pb_GroupReferringParams,

    -Left $([pb_ReferringParams],255) AS pb_GroupReferringParams,

    TProblem.pb_ReferringParams,

    LTRIM(pb_RequestedTopic,255) AS pb_GroupRequestedTopic,

    -Left $([pb_RequestedTopic],255) AS pb_GroupRequestedTopic,

    TProblem.pb_RequestedTopic,

    TProblem.pb_ExternTransactionID,

    TProblem.pb_ExternUserID,

    TProblem.pb_AppData,

    TProblem.pb_ProblemSolved,

    TProblem.ha_AreaName

    OF mcvicker. TProblem;

    I hope this helps someone.

    My questions are pending: what the app actually creates tables and views? This work to restart tomcat? According to a timetable? It seems that when I set up the connection and leave the things the next day they work. Is there some sort of scheduled task that the database maintenance? Can we make it a little more transparent in future versions?

    Thank you.

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

  • The AUDIT command in, oracle apex (version 4.2.5.00.08), error "ORA-00911: invalid character '.

    I am trying to run

    "AUDIT INSERT, UPDATE, DELETE on emp BY ACCESS WHENEVER SUCCESSFUL;"

    in "SQL commands" on oracle-apex (version 4.2.5.00.08).

    I get the error message ' ORA-00911: invalid character '.

    Can someone tell me the solution for this?

    Apex environment we need to set the database AUDIT_TRAIL to TRUE for the control

    "AUDIT INSERT, UPDATE, DELETE on emp BY ACCESS WHENEVER SUCCESSFUL;"  to work.

    By their Summit, to be able to change the setting of database AUDIT_TRAIL we have to log-in as a DBA from the link "SQL workshop--> utilities--> on the database.

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

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

  • Form trigger error ORA-22816: feature not supported with RETURNING clause

    Hi Apex developers.

    I created the form to the poster with the INSTEAD of trigger. Everything works very well for the UPDATE and DELETE. But to INSERT the "automatic line (DML) treatment" trigger ORA-22816: feature not supported with RETURNING clause. When I disable the INSTEAD OF trigger it start work very well too. But I have to use INSTEAD OF trigger for safety reasons.

    Meet someone too the question?

    What is workaroud for the question?

    Thank you very much.

    Michaud

    Hi Martin,

    MMH, it beats me. You could try with tracing active sql (add & ptrace = YES to your URL), see what actually running.

    Cordially Jens

Maybe you are looking for