Force view

Hello Guys,
Can you tell me what is the use of view when we create with FORCE option if underliying table is not available ?
CREATE OR REPLACE FORCE VIEW MY_VIEW AS SELECT * FROM EMP;
Now View My_View will be created even if the emp table is not available. But where we can use this view ?. What is the applicatin of My_View when we know that EMP table is not available ?.
Thanking you.

Simple demonstration...
SQL> create or replace view my_view as select * from empdept;
create or replace view my_view as select * from empdept
ERROR at line 1:
ORA-00942: table or view does not exist
SQL> create or replace force view my_view as select * from empdept;
Warning: View created with compilation errors.
SQL> select * from my_view;
select * from my_view
ERROR at line 1:
ORA-04063: view "SCOTT.MY_VIEW" has errors
SQL> create table empdept as select ename, deptno from emp;
Table created.
SQL> select * from my_view;
ENAME          DEPTNO
SMITH              20
ALLEN              30
WARD
JONES              20
MARTIN             30
BLAKE
CLARK              10
SCOTT              20
KING               10
TURNER             30
ADAMS              20
JAMES              30
FORD               20
MILLER             10
14 rows selected.
SQL>

Similar Messages

  • Reg: Force View

    Kindly let me know in what situation force view created apart from doesn't have base table

    http://tinyurl.com/yhp92vm

  • Wat is the advantage of force view?

    hello,
    only i know that it is created object in db and after tat we can create the table as per requirement.
    please tell me wat is the main advantage of Force View?
    Tks
    PM

    Hello PM,
    if you have mutual dependencies, e.g. between a package and a view, then you cannot create the view because of an invalid package and you cannot validate the package because the view does not exist.
    A workaround has been to create a dummy view, compile the package and create the actual view. Now you can force Oracle to create the view and then compile the package.
    Regards
    Marcus

  • Create or replace force view

    Back again - cleanup did not fix. Why am I getting 'missing keyword' error?
    Thanks for your eyes!
    Alexandra
    code
    CREATE OR REPLACE FORCE VIEW "DISC_AUTH_ECR_VW" ("DISC_AUTH_ID", "DISC_DT", "REQUESTOR", "BRANDING", "REASON", "WU_COST_DT", "DC_RECEIVED_DT", "RUNOUT_TYPE", "STOCK_DISPO", "INV_ADJ_CODE", "INVOICE_CUSTO", "INVOICE_CMNT", "CUST_BILLTO", "BILL_TO_STATUS", "CUST_NAME", "CUST_PHONE", "CUST_EMAIL", "FINAL_DISPO_DT", "CNTRLR_DT", "CNTRLR_SIG", "SM_DT", "SM_SIG", "RELEASE_TO_ECR", "REJECT_RSN", "SHELF_LIFE", "QTY_OH", "ITEM_COST", "FINAL_CUST_COST", "GRAND_TOT_CMPNTS_FG", "GRAND_TOT_FINAL_CUSTO", "ITEM_LVL_RI", "ITEM_LVL_PKG", "ITEM_LVL_BL", "ITEM_LVL_SUB_ASSY", "ITEM_LVL_FG", "RO_TYPE_SUMMARY", "DISCNO", "PL_NAME", "DTRMN_WO_DESCR", "CUST_OTHER_STREET", "CUST_OTHER_CITY", "CUST_OTHER_STATE", "CUST_OTHER_ZIP", "CURRENT_DISCNO", "ECR_FORM_ID", "ECRNO")
    select
    cast("DOC_DISC_AUTHORIZATION"."DISC_AUTH_ID" as number(6,0)) AS "DISC_AUTH_ID",
    cast("DOC_DISC_AUTHORIZATION"."DISC_DT" as varchar2(15)) AS "DISC_DT",
    cast("DOC_DISC_AUTHORIZATION"."REQUESTOR" as varchar2(30)) AS "REQUESTOR",
    cast("DOC_DISC_AUTHORIZATION"."BRANDING" as varchar2(30)) AS "BRANDING",
    cast("DOC_DISC_AUTHORIZATION"."REASON" as varchar2(1000)) AS "REASON",
    cast("DOC_DISC_AUTHORIZATION"."WU_COST_DT" as varchar2(15)) AS "WI_COST_DT",
    cast("DOC_DISC_AUTHORIZATION"."DC_RECEIVED_DT" as varchar2(15)) AS "DC_RECEIVED_DT",
    cast("DOC_DISC_AUTHORIZATION"."RUNOUT_TYPE" as varchar2(30) AS "RUNOUT_TYPE",
    cast("DOC_DISC_AUTHORIZATION"."STOCK_DISPO" as varchar2(30)) AS "STOCK_DISPO",
    cast("DOC_DISC_AUTHORIZATION"."INV_ADJ_CODE" as varchar2(30)) AS "INV_ADJ_CODE",
    cast("DOC_DISC_AUTHORIZATION"."INVOICE_CUSTO" as varchar2(30)) AS "INVOICE_CUSTO",
    cast("DOC_DISC_AUTHORIZATION"."INVOICE_CMNT" as varchar2(2000)) AS "INVOICE_CMNT",
    cast("DOC_DISC_AUTHORIZATION"."CUST_BILLTO" as varchar2(30)) AS "CUST_BILLTO",
    cast("DOC_DISC_AUTHORIZATION"."BILL_TO_STATUS" as varchar2(30)) AS "BILL_TO_STATUS",
    cast("DOC_DISC_AUTHORIZATION"."CUST_NAME" as varchar2(100)) AS "CUST_NAME",
    cast("DOC_DISC_AUTHORIZATION"."CUST_PHONE" as varchar2(30)) AS "CUST_PHONE",
    cast("DOC_DISC_AUTHORIZATION"."CUST_EMAIL" as varchar2(100)) AS "CUST_EMAIL",
    cast("DOC_DISC_AUTHORIZATION"."FINAL_DISPO_DT" as varchar2(15)) AS "FINAL_DISPO",
    cast("DOC_DISC_AUTHORIZATION"."CNTRLR_DT" as varchar2(15)) AS "CNTRLR_DT",
    cast("DOC_DISC_AUTHORIZATION"."CNTRLR_SIG" as varchar2(10)) AS "CNTRLR_SIG",
    cast("DOC_DISC_AUTHORIZATION"."SM_DT" as varchar2(15)) AS "SM_DT",
    cast("DOC_DISC_AUTHORIZATION"."SM_SIG" as varchar2(10)) AS "SM_SIG",
    cast("DOC_DISC_AUTHORIZATION"."RELEASE_TO_ECR" as varchar2(30)) AS "RELEASE_TO_ECR",
    cast("DOC_DISC_AUTHORIZATION"."REJECT_RSN" as varchar2(4000)) AS "REJECT_RSN",
    cast("DOC_DISC_AUTHORIZATION"."SHELF_LIFE" as varchar2(30)) AS "SHELF_LIFE",
    cast("DOC_DISC_AUTHORIZATION"."QTY_OH" as number(10,4)) AS "QTY_OH",
    cast("DOC_DISC_AUTHORIZATION"."ITEM_COST" as number(10,4)) AS "ITEM_COST",
    cast("DOC_DISC_AUTHORIZATION"."FINAL_CUST_COST" as number(10,4)) AS "FINAL_CUST_COST",
    cast("DOC_DISC_AUTHORIZATION"."GRAND_TOT_CMPNTS_FG" as number(10,4)) AS "GRAND_TOT_CMPNTS_FG",
    cast("DOC_DISC_AUTHORIZATION"."GRAND_TOT_FINAL_CUSTO" as number(10,4)) AS "GRAND_TOT_FINAL_CUSTO",
    cast("DOC_DISC_AUTHORIZATION"."ITEM_LVL_RI" as varchar2(30)) AS "ITEM_LVL_RI",
    cast("DOC_DISC_AUTHORIZATION"."ITEM_LVL_PKG" as varchar2(30)) AS "ITEM_LVL_PKG",
    cast("DOC_DISC_AUTHORIZATION"."ITEM_LVL_BL" as varchar2(30)) AS "ITEM_LVL_BL",
    cast("DOC_DISC_AUTHORIZATION"."ITEM_LVL_SUB_ASSY" as varchar2(30)) AS "ITEM_LVL_SUB_ASSY",
    cast("DOC_DISC_AUTHORIZATION"."ITEM_LVL_FG" as varchar2(30)) AS "ITEM_LVL_FG",
    cast("DOC_DISC_AUTHORIZATION"."RO_TYPE_SUMMARY" as varchar2(1000)) AS "RO_TYPE_SUMMARY",
    cast("DOC_DISC_AUTHORIZATION"."DISCNO" as varchar2(30)) AS "DISCNO",
    cast("DOC_DISC_AUTHORIZATION"."PL_NAME" as varchar2(100)) AS "PL_NAME",
    cast("DOC_DISC_AUTHORIZATION"."DTRMN_WO_DESCR" as varchar2(30)) AS "DTRMN_WO_DESCR",
    cast("DOC_DISC_AUTHORIZATION"."CUST_OTHER_STREET" as varchar2(100)) AS "CUST_OTHER_STREET",
    cast("DOC_DISC_AUTHORIZATION"."CUST_OTHER_CITY" as varchar2(30)) AS "CUST_OTHER_CITY",
    cast("DOC_DISC_AUTHORIZATION"."CUST_OTHER_STATE" as varchar2(10)) AS "CUST_OTHER_STATE",
    cast("DOC_DISC_AUTHORIZATION"."CUST_OTHER_ZIP" as varchar2(15)) AS "CUST_OTHER_ZIP",
    cast("DOC_DISC_AUTHORIZATION"."CURRENT_DISCNO" as varchar2(10)) AS "CURRENT_DISCNO",
    cast("DOC_ECR_FORM"."ECR_FORM_ID" as varchar2(10)) AS "ECR_FORM_ID",
    cast("DOC_ECR_FORM"."ECRNO" as varchar2(10)) AS "ECRNO"
    FROM "DOC_DISC_AUTHORIZATION" "DOC_DISC_AUTHORIZATION", "DOC_ECR_FORM" "DOC_ECR_FORM"
    WHERE "DOC_DISC_AUTHORIZATION"."ECR_FORM_ID" = "DOC_ECR_FORM"."ECR_FORM_ID"
    /code
    Edited by: userRRRYB on Aug 22, 2012 8:51 PM

    Here it is in full working form. It's always good to have a second set of eyes and a great boss.
    code/
    CREATE OR REPLACE FORCE VIEW "DISC_AUTH_ECR_VW" ("DISC_AUTH_ID", "DISC_DT", "REQUESTOR", "BRANDING", "REASON", "WU_COST_DT", "DC_RECEIVED_DT", "RUNOUT_TYPE", "STOCK_DISPO", "INV_ADJ_CODE", "INVOICE_CUSTO", "INVOICE_CMNT", "CUST_BILLTO", "BILL_TO_STATUS", "CUST_NAME", "CUST_PHONE", "CUST_EMAIL", "FINAL_DISPO_DT", "CNTRLR_DT", "CNTRLR_SIG", "SM_DT", "SM_SIG", "RELEASE_TO_ECR", "REJECT_RSN", "SHELF_LIFE", "QTY_OH", "ITEM_COST", "FINAL_CUST_COST", "GRAND_TOT_CMPNTS_FG", "GRAND_TOT_FINAL_CUSTO", "ITEM_LVL_RI", "ITEM_LVL_PKG", "ITEM_LVL_BL", "ITEM_LVL_SUB_ASSY", "ITEM_LVL_FG", "RO_TYPE_SUMMARY", "DISCNO", "PL_NAME", "DTRMN_WO_DESCR", "CUST_OTHER_STREET", "CUST_OTHER_CITY", "CUST_OTHER_STATE", "CUST_OTHER_ZIP", "CURRENT_DISCNO", "ECR_FORM_ID", "ECRNO") AS
    select
    cast("DOC_DISC_AUTHORIZATION"."DISC_AUTH_ID" as number(6,0)) AS "DISC_AUTH_ID",
    cast("DOC_DISC_AUTHORIZATION"."DISC_DT" as varchar2(15)) AS "DISC_DT",
    cast("DOC_DISC_AUTHORIZATION"."REQUESTOR" as varchar2(30)) AS "REQUESTOR",
    cast("DOC_DISC_AUTHORIZATION"."BRANDING" as varchar2(30)) AS "BRANDING",
    cast("DOC_DISC_AUTHORIZATION"."REASON" as varchar2(1000)) AS "REASON",
    cast("DOC_DISC_AUTHORIZATION"."WU_COST_DT" as varchar2(15)) AS "WI_COST_DT",
    cast("DOC_DISC_AUTHORIZATION"."DC_RECEIVED_DT" as varchar2(15)) AS "DC_RECEIVED_DT",
    cast("DOC_DISC_AUTHORIZATION"."RUNOUT_TYPE" as varchar2(30)) AS "RUNOUT_TYPE",
    cast("DOC_DISC_AUTHORIZATION"."STOCK_DISPO" as varchar2(30)) AS "STOCK_DISPO",
    cast("DOC_DISC_AUTHORIZATION"."INV_ADJ_CODE" as varchar2(30)) AS "INV_ADJ_CODE",
    cast("DOC_DISC_AUTHORIZATION"."INVOICE_CUSTO" as varchar2(30)) AS "INVOICE_CUSTO",
    cast("DOC_DISC_AUTHORIZATION"."INVOICE_CMNT" as varchar2(2000)) AS "INVOICE_CMNT",
    cast("DOC_DISC_AUTHORIZATION"."CUST_BILLTO" as varchar2(30)) AS "CUST_BILLTO",
    cast("DOC_DISC_AUTHORIZATION"."BILL_TO_STATUS" as varchar2(30)) AS "BILL_TO_STATUS",
    cast("DOC_DISC_AUTHORIZATION"."CUST_NAME" as varchar2(100)) AS "CUST_NAME",
    cast("DOC_DISC_AUTHORIZATION"."CUST_PHONE" as varchar2(30)) AS "CUST_PHONE",
    cast("DOC_DISC_AUTHORIZATION"."CUST_EMAIL" as varchar2(100)) AS "CUST_EMAIL",
    cast("DOC_DISC_AUTHORIZATION"."FINAL_DISPO_DT" as varchar2(15)) AS "FINAL_DISPO",
    cast("DOC_DISC_AUTHORIZATION"."CNTRLR_DT" as varchar2(15)) AS "CNTRLR_DT",
    cast("DOC_DISC_AUTHORIZATION"."CNTRLR_SIG" as varchar2(10)) AS "CNTRLR_SIG",
    cast("DOC_DISC_AUTHORIZATION"."SM_DT" as varchar2(15)) AS "SM_DT",
    cast("DOC_DISC_AUTHORIZATION"."SM_SIG" as varchar2(10)) AS "SM_SIG",
    cast("DOC_DISC_AUTHORIZATION"."RELEASE_TO_ECR" as varchar2(30)) AS "RELEASE_TO_ECR",
    cast("DOC_DISC_AUTHORIZATION"."REJECT_RSN" as varchar2(4000)) AS "REJECT_RSN",
    cast("DOC_DISC_AUTHORIZATION"."SHELF_LIFE" as varchar2(30)) AS "SHELF_LIFE",
    cast("DOC_DISC_AUTHORIZATION"."QTY_OH" as number(10,4)) AS "QTY_OH",
    cast("DOC_DISC_AUTHORIZATION"."ITEM_COST" as number(10,4)) AS "ITEM_COST",
    cast("DOC_DISC_AUTHORIZATION"."FINAL_CUST_COST" as number(10,4)) AS "FINAL_CUST_COST",
    cast("DOC_DISC_AUTHORIZATION"."GRAND_TOT_CMPNTS_FG" as number(10,4)) AS "GRAND_TOT_CMPNTS_FG",
    cast("DOC_DISC_AUTHORIZATION"."GRAND_TOT_FINAL_CUSTO" as number(10,4)) AS "GRAND_TOT_FINAL_CUSTO",
    cast("DOC_DISC_AUTHORIZATION"."ITEM_LVL_RI" as varchar2(30)) AS "ITEM_LVL_RI",
    cast("DOC_DISC_AUTHORIZATION"."ITEM_LVL_PKG" as varchar2(30)) AS "ITEM_LVL_PKG",
    cast("DOC_DISC_AUTHORIZATION"."ITEM_LVL_BL" as varchar2(30)) AS "ITEM_LVL_BL",
    cast("DOC_DISC_AUTHORIZATION"."ITEM_LVL_SUB_ASSY" as varchar2(30)) AS "ITEM_LVL_SUB_ASSY",
    cast("DOC_DISC_AUTHORIZATION"."ITEM_LVL_FG" as varchar2(30)) AS "ITEM_LVL_FG",
    cast("DOC_DISC_AUTHORIZATION"."RO_TYPE_SUMMARY" as varchar2(1000)) AS "RO_TYPE_SUMMARY",
    cast("DOC_DISC_AUTHORIZATION"."DISCNO" as varchar2(30)) AS "DISCNO",
    cast("DOC_DISC_AUTHORIZATION"."PL_NAME" as varchar2(100)) AS "PL_NAME",
    cast("DOC_DISC_AUTHORIZATION"."DTRMN_WO_DESCR" as varchar2(30)) AS "DTRMN_WO_DESCR",
    cast("DOC_DISC_AUTHORIZATION"."CUST_OTHER_STREET" as varchar2(100)) AS "CUST_OTHER_STREET",
    cast("DOC_DISC_AUTHORIZATION"."CUST_OTHER_CITY" as varchar2(30)) AS "CUST_OTHER_CITY",
    cast("DOC_DISC_AUTHORIZATION"."CUST_OTHER_STATE" as varchar2(10)) AS "CUST_OTHER_STATE",
    cast("DOC_DISC_AUTHORIZATION"."CUST_OTHER_ZIP" as varchar2(15)) AS "CUST_OTHER_ZIP",
    cast("DOC_DISC_AUTHORIZATION"."CURRENT_DISCNO" as varchar2(10)) AS "CURRENT_DISCNO",
    cast("DOC_ECR_FORM"."ECR_FORM_ID" as varchar2(10)) AS "ECR_FORM_ID",
    cast("DOC_ECR_FORM"."ECRNO" as varchar2(10)) AS "ECRNO"
    FROM "DOC_DISC_AUTHORIZATION" "DOC_DISC_AUTHORIZATION", "DOC_ECR_FORM" "DOC_ECR_FORM"
    WHERE "DOC_DISC_AUTHORIZATION"."ECR_FORM_ID" = "DOC_ECR_FORM"."ECR_FORM_ID"
    /code

  • Uses of force view

    Hi All,
    Can you tell me what are the uses of force view?
    Thanks in advance.

    It's relatively common to find in install scripts (and/or in import & export). If you're going to create dozens of different views which depend on various other views and/or tables, figuring out the proper order to drop and/or create each view and ensuring that the build script is updated with that information every time can be rather painful and tedious. It's much easier to FORCE the creation of the views in some human-reasonable order (i.e. alphabetically) and compile everything at the end.
    Justin

  • Create Force View

    Hi all,
    When I import the dumpfile I get the follwing errors...
    IMP-00041: Warning: object created with compilation warnings
    "CREATE FORCE VIEW "uni"."V_F_OFS_REQUEST_DETAIL" "
    " ("RECID","XMLRECORD","APPLICATION","NAPPLICATION","VERSION","NVERSION","F"
    "UNCTION","NFUNCTION","TRANS_REFERENCE","NTRANS_REFERENCE","USER_NAME","NUSE"
    "R_NAME","COMPANY","NCOMPANY","DATE_TIME_RECD","NDATE_TIME_RECD","DATE_TIME_"
    "QUEUE","NDATE_TIME_QUEUE","DATE_TIME_PROC","NDATE_TIME_PROC","STATUS","NSTA"
    "TUS","MSG_IN","NMSG_IN","MSG_OUT","NMSG_OUT","ACTION","NACTION","GTS_CONTRO"
    "L","NGTS_CONTROL","NO_OF_AUTH","NNO_OF_AUTH") AS "
    "SELECT x.RECID, x.XMLRECORD.getClobVal() "XMLRECORD""
    ",NVL(extractValue(x.xmlrecord,'/row/c1'),'^A') "APPLICATION",NVL(NUMCAST(ex"
    "tractValue(x.xmlrecord,'/row/c1')),0) "nAPPLICATION",NVL(extractValue(x.xml"
    "record,'/row/c2'),'^A') "VERSION",NVL(NUMCAST(extractValue(x.xmlrecord,'/ro"
    "w/c2')),0) "nVERSION",NVL(extractValue(x.xmlrecord,'/row/c3'),'^A') "FUNCTI"
    "ON",NVL(NUMCAST(extractValue(x.xmlrecord,'/row/c3')),0) "nFUNCTION",NVL(ext"
    "ractValue(x.xmlrecord,'/row/c4'),'^A') "TRANS_REFERENCE",NVL(NUMCAST(extrac"
    "tValue(x.xmlrecord,'/row/c4')),0) "nTRANS_REFERENCE",NVL(extractValue(x.xml"
    "record,'/row/c5'),'^A') "USER_NAME",NVL(NUMCAST(extractValue(x.xmlrecord,'/"
    "row/c5')),0) "nUSER_NAME",NVL(extractValue(x.xmlrecord,'/row/c6'),'^A') "CO"
    "MPANY",NVL(NUMCAST(extractValue(x.xmlrecord,'/row/c6')),0) "nCOMPANY",NVL(e"
    How to overcome this? and how to avoid this? Pls suggest me
    Thanks in advance..

    Yes, force view command never gives an error, its always a warning. And if you are getting this error during import, dont worry, view have been created in your schema by import command. This might happen when view is refers to any table that actually is not present. In your case it might be a case when view in the current schema refers table in another schema. So i think you should just try to query that view in the schema where you have just done the import.
    Also to verify that why error came, you can go to the source schema and check for the base table of the view under consideration. From there you can get useful information about the actual base table and why import showing up the warning.

  • Force view of UDF sidebar

    Hi.
    Can anyone tell me if it's possible to make modification in SAP B1 2007A that will force all users to view the UDF sidebar. We have AddOn running that require user to have the view of UDF sidebar set to 'ON' at all times. Sometimes the users forget or the settings change when upgrading B1.
    If anyone can suggest an approach to modify the B1 so that UDF sidebare is always showing, I would appreciate it a lot.
    Thanks and regards,
    Runar.

    Dear
    Plz kindly try the following codes in your addon,
    If pVal.MenuUID = "43528" Then
            If SBO_Application.Menus.Item("6913").Checked = False Then
                SBO_Application.SendKeys ("^+U")
            End If
        End If
    hope it helps.
    Best Regards,
    Xiaodan AN

  • Force view to measure itself

    I have some layout code that needs a view to measure itself before it runs.  I'm trying invalidateSize, validateNow on the view, but it's width and height are still 0 afterwards.  The measuredWidth and measuredHeight appear to be correct though.  What can I do to make this work?
    Cheers.

    There are a couple of options.  Rollover captions and rollover image objects are unable to trigger advanced actions on rollover, but you CAN do this with rollover slidelets.  So you could set up variables and advanced actions to track whether or not the user has viewed all rollovers at least once before showing a button that allows them to navigate to the next slide.  If you want to avoid rollover slidelets (due to all the issues they bring) you can use Event Handler widgets from Infosemantics.  Attach the widgets to the rollover caption or rollover images and this allows you to trigger advanced actions but with much more flexibility than with slidelets.
    One caveat.  None of these solutions work in HTML5.

  • Create View  with Force and No Force

    Can Anyone Tell me how to create view with force and no force i have very little idea about this

    This is the syntax.
    CREATE [OR REPLACE] FORCE VIEW view
    [(alias[, alias]...)]
    AS subquery
    [WITH CHECK OPTION [CONSTRAINT constraint]]
    [WITH READ ONLY [CONSTRAINT constraint]];You can see interesting threads about this topic here.
    Re: Creating view forcibly
    Creating View forcefully
    Cheers
    Sarma.

  • Not able to load data in view

    Hi All
    i had created one view based on four different tables.Now to enter the data in load i had successfully created INSTEAD OF TRIGGER on view.But data load into tables but when i try to see data in view then its shows me nothing.
    so why my data not load in view but lad into four diff tables.
    ---VIEW CODE
    CREATE OR REPLACE FORCE VIEW "VIEW_WELL_GENERATOR_FORM" ("WEL_PK", "STA_PK", "PER_PK", "FAC_PK", "WELL_TYPE", "WELL_TYPE_DATE", "OPER_STATUS", "STATUS_DATE", "CLASS", "SITE", "FAC_TYPE", "AUT_STATUS") AS
    select     "WELL"."WEL_PK" as "WEL_PK",
         "WELL_STATUS"."STA_PK" as "STA_PK",
         "PERMIT"."PER_PK" as "PER_PK",
         "FACILITY"."FAC_PK" as "FAC_PK",
         "WELL_STATUS"."WELL_TYPE" as "WELL_TYPE",
         "WELL_STATUS"."WELL_TYPE_DATE" as "WELL_TYPE_DATE",
         "WELL_STATUS"."OPER_STATUS" as "OPER_STATUS",
         "WELL_STATUS"."STATUS_DATE" as "STATUS_DATE",
         "WELL_STATUS"."CLASS" as "CLASS",
         "WELL"."SITE" as "SITE",
         "FACILITY"."FAC_TYPE" as "FAC_TYPE",
         "PERMIT"."AUT_STATUS" as "AUT_STATUS"
    from     "FACILITY" "FACILITY",
         "PERMIT" "PERMIT",
         "WELL_STATUS" "WELL_STATUS",
         "WELL" "WELL"
    where "WELL"."WEL_PK"="WELL_STATUS"."WEL_FK"
    and     "PERMIT"."WEL_FK"="WELL"."WEL_PK"
    and     "FACILITY"."FAC_PK"="WELL"."FAC_FK"
    ---INSTEAD OF TRIGGER CODE...
    CREATE OR REPLACE TRIGGER "WELL_GENERATOR_TRIGGER_1"
    INSTEAD OF INSERT ON VIEW_WELL_GENERATOR_FORM
    FOR EACH ROW
    DECLARE
    rowcnt number;
    BEGIN
    INSERT INTO facility (FAC_PK) VALUES (:NEW.FAC_PK);
    SELECT COUNT(*) INTO rowcnt FROM WELL WHERE WEL_PK = :NEW.WEL_PK;
    IF rowcnt = 0 THEN
    INSERT INTO WELL (SITE,FAC_FK) VALUES(:NEW.SITE,:NEW.FAC_PK);
    ELSE
    UPDATE WELL SET WELL.SITE = :NEW.SITE,
    WELL.FAC_FK = :NEW.FAC_PK
    WHERE WELL.WEL_PK = :NEW.WEL_PK;
    END IF;
    SELECT COUNT(*) INTO rowcnt FROM WELL_STATUS WHERE WELL_STATUS.STA_PK = :NEW.STA_PK;
    IF rowcnt = 0 THEN
    INSERT INTO WELL_STATUS (WELL_TYPE, WELL_TYPE_DATE, OPER_STATUS, CLASS,WEL_FK)
    VALUES(:NEW.WELL_TYPE, :NEW.WELL_TYPE_DATE, :NEW.OPER_STATUS, :NEW.CLASS,:NEW.WEL_PK);
    ELSE
    UPDATE WELL_STATUS SET WELL_STATUS.WELL_TYPE = :NEW.WELL_TYPE,
    WELL_STATUS.WELL_TYPE_DATE = :NEW.WELL_TYPE_DATE,
    WELL_STATUS.OPER_STATUS = :NEW.OPER_STATUS,
    WELL_STATUS.CLASS = :NEW.CLASS,
    WELL_STATUS.WEL_FK = :NEW.WEL_PK
    WHERE STA_PK = :NEW.STA_PK;
    END IF;
    SELECT COUNT(*) INTO rowcnt FROM PERMIT WHERE PERMIT.PER_PK = :NEW.PER_PK;
    IF rowcnt = 0 THEN
    INSERT INTO PERMIT (AUT_STATUS,WEL_FK) VALUES (:NEW.AUT_STATUS,:NEW.WEL_PK);
    ELSE
    UPDATE PERMIT SET PERMIT.AUT_STATUS = :NEW.AUT_STATUS,
    PERMIT.WEL_FK = :NEW.WEL_PK
    WHERE PERMIT.PER_PK = :NEW.PER_PK;
    END IF;
    Thanks

    Hi
    Thanks for your reply.here i am adescribing my code for the tables.
    CREATE TABLE "FACILITY"
    (     "FAC_PK" NUMBER(8,0),
         "FAC_STATE_UK" VARCHAR2(4),
         "DELFLAG" VARCHAR2(1),
         "FAC_TYPE" VARCHAR2(1),
         "FAC_NAME" VARCHAR2(80),
         "STREET1" VARCHAR2(50),
         "STREET2" VARCHAR2(50),
         "CITY" VARCHAR2(60),
         "SATE" VARCHAR2(2),
         "ZIP" VARCHAR2(14),
         "LABEL_STREET_1" VARCHAR2(30),
         "LABEL_STREET_2" VARCHAR2(30),
         "LABEL_CITY" VARCHAR2(15),
         "LABEL_COUNTY" VARCHAR2(10),
         "STATE_OR_TRIBE" VARCHAR2(3),
         "SIC_CODE" VARCHAR2(4),
         "NAICS_CODE" VARCHAR2(6),
         "PETIT_STATUS" VARCHAR2(2),
         "STATE_CONTACT_NAME" VARCHAR2(30),
         "TRIBAL_NAME" VARCHAR2(30),
         "TOTAL_WELLS" NUMBER(5,0),
         "LANDOWNER_TYPE" VARCHAR2(1),
         "LOC_IDENTITY" VARCHAR2(1),
         "PROJECT_STATUS" VARCHAR2(25),
         "TRIBE_YN" VARCHAR2(1),
         "INFO_SOURCE" VARCHAR2(35),
         "FAC_DESC" VARCHAR2(3),
         "FAC_LAT" NUMBER(10,8),
         "FAC_LONG" NUMBER(11,8),
         "FAC_ACC_VALUE" NUMBER(6,0),
         "FAC_HORIZ_DATUM" VARCHAR2(3),
         "FAC_METHOD" VARCHAR2(3),
         "FAC_POINT_LINE_AREA" VARCHAR2(3),
         "FAC_SOURCE_SCALE" VARCHAR2(2),
         "FAC_COUNTY" VARCHAR2(35),
         "FAC_HIST_LAT" VARCHAR2(100),
         "FAC_HIST_LONG" VARCHAR2(100),
         "HIST_NOTES_ACTDATE" DATE,
         "HIST_NOTES_ACTNEEDED" VARCHAR2(15),
         "HIST_SUBMITBY" VARCHAR2(35),
         "HIST_ENTRYDATE" DATE,
         "HIST_ID" VARCHAR2(64),
         "AUD_ACTION" VARCHAR2(10),
         "AUD_TIME" DATE,
         "AUD_BEFORE_VALUE" VARCHAR2(80),
         "AUD_AFTER_VALUE" VARCHAR2(80),
         "HIST_NAME" VARCHAR2(100),
         "HIST_CONTACT" VARCHAR2(80),
         "HIST_FULL_STREET" VARCHAR2(100),
         "HIST_FULL_FAC_NAME" VARCHAR2(200),
         "FORMER_FAC_NAME" VARCHAR2(100),
         "COMMENTS" VARCHAR2(300),
         "HIST_ORIGINATOR" VARCHAR2(20),
         "PHONE" VARCHAR2(15),
         "PHONE_EXT" VARCHAR2(8),
         "FAX" VARCHAR2(15),
         "EMAIL_ADDRESS" VARCHAR2(30),
         "EMAIL_ADDRESS_DOMAIN_NAME" VARCHAR2(30),
         "FAC_URL" VARCHAR2(60),
         "LAST_UPDATE_LOTUS_NOTES" DATE,
         "NUM_INSPECTIONS" NUMBER(6,0),
         "NUM_PERMITS" NUMBER(6,0),
         "NUM_CONVERSIONS" NUMBER(6,0),
         "LAST_UPDATE" DATE,
         "USERNAME" VARCHAR2(16),
         "CREATED_BY" VARCHAR2(16),
         "CREATED_ON" DATE,
         "EDITED_BY" VARCHAR2(16),
         CONSTRAINT "FACILITY_PK" PRIMARY KEY ("FAC_PK") ENABLE,
         CONSTRAINT "FACILITY_STATE_UK" UNIQUE ("FAC_STATE_UK") DISABLE
    CREATE OR REPLACE TRIGGER "BI_FACILITY"
    before insert on "FACILITY"
    for each row
    begin
    if :NEW."FAC_PK" is null then
    select "FACILITY_SEQ".nextval into :NEW."FAC_PK" from dual;
    end if;
    end;
    for the WELL table----
    CREATE TABLE "WELL"
    (     "WEL_PK" NUMBER(8,0) NOT NULL ENABLE,
         "FAC_FK" NUMBER(8,0),
         "CNT_FK" NUMBER(8,0),
         "GEO_FK" NUMBER(8,0),
         "WEL_STATE_UK" VARCHAR2(4) DEFAULT '09DI',
         "DELFLAG" VARCHAR2(1) DEFAULT 'N',
         "NAME" VARCHAR2(80) DEFAULT 'No data',
         "SITE" VARCHAR2(50) DEFAULT 'No data',
         "HIGH_PRIORITY_YN" VARCHAR2(1) DEFAULT ('N'),
         "AQUI_EXEMPT_YN" VARCHAR2(1) DEFAULT ('N'),
         "TOTAL_DEPTH" NUMBER(5,0),
         "WELL_IN_SWA" VARCHAR2(1) DEFAULT ('U'),
         "AUD_ACTION" VARCHAR2(10),
         "AUD_TIME" DATE,
         "AUD_BEFORE_VALUE" VARCHAR2(80),
         "AUD_AFTER_VALUE" VARCHAR2(80),
         "LAST_UPDATE" DATE DEFAULT sysdate,
         "USERNAME" VARCHAR2(16) DEFAULT user,
         CONSTRAINT "WEL_AQUI_EXEMPT_YN_CK" CHECK (AQUI_EXEMPT_YN IN ('Y', 'N', 'U' )) DEFERRABLE INITIALLY DEFERRED ENABLE,
         CONSTRAINT "WEL_HIGH_PRIORITY_YN_CK" CHECK (HIGH_PRIORITY_YN IN ('Y', 'N', 'U' )) DEFERRABLE INITIALLY DEFERRED ENABLE,
         CONSTRAINT "WEL_WELL_IN_SWA_CK" CHECK (WELL_IN_SWA IN ('Y', 'N', 'U' )) DEFERRABLE INITIALLY DEFERRED ENABLE,
         CONSTRAINT "WEL_WEL_STATE_UK_NN" CHECK (WEL_STATE_UK is not null) DEFERRABLE INITIALLY DEFERRED DISABLE,
         CONSTRAINT "WEL_WEL_STATE_UK_CK" CHECK (WEL_STATE_UK IN ('09DI', 'CAOC', 'GUEA', 'MPEQ', 'NVEP', 'NNUI' )) DEFERRABLE INITIALLY DEFERRED ENABLE,
         CONSTRAINT "WEL_PK" PRIMARY KEY ("WEL_PK") DEFERRABLE INITIALLY DEFERRED ENABLE
    ALTER TABLE "WELL" ADD CONSTRAINT "WELL_CON_FK" FOREIGN KEY ("FAC_FK")
         REFERENCES "FACILITY" ("FAC_PK") ON DELETE CASCADE ENABLE
    CREATE INDEX "WEL_PK" ON "WELL" ("WEL_PK")
    CREATE OR REPLACE TRIGGER "WEL_WEL_PK"
    BEFORE INSERT ON "WELL"
    FOR EACH ROW
    BEGIN
    SELECT "well_PK_seq".NEXTVAL INTO :NEW.wel_pk FROM DUAL;
    END;
    ALTER TRIGGER "WEL_WEL_PK" ENABLE
    FOR THE WELL_STATUS TABLE -----
    CREATE TABLE "WELL_STATUS"
    (     "STA_PK" NUMBER(8,0) NOT NULL ENABLE,
         "WEL_FK" NUMBER(8,0),
         "DELFLAG" VARCHAR2(1) DEFAULT 'N',
         "WELL_TYPE" VARCHAR2(12) DEFAULT '5X',
         "WELL_TYPE_DATE" DATE,
         "OPER_STATUS" VARCHAR2(2) DEFAULT 'AC',
         "STATUS_DATE" DATE DEFAULT sysdate,
         "CLASS" VARCHAR2(2) DEFAULT '5',
         "R9_WELL_TYPE" VARCHAR2(4),
         "LAST_UPDATE" DATE DEFAULT sysdate,
         "USERNAME" VARCHAR2(16) DEFAULT user,
         CONSTRAINT "STA_CLASS_CK" CHECK (CLASS IN ('0','1','2','3','4','5', 'CV')) DEFERRABLE INITIALLY DEFERRED ENABLE,
         CONSTRAINT "STA_CLASS_NN" CHECK (CLASS is not null) DEFERRABLE INITIALLY DEFERRED ENABLE,
         CONSTRAINT "STA_STATUS_DATE_NN" CHECK (STATUS_DATE is not null) DEFERRABLE INITIALLY DEFERRED ENABLE,
         CONSTRAINT "STA_OPER_STATUS_NN" CHECK (OPER_STATUS is not null) DEFERRABLE INITIALLY DEFERRED DISABLE,
         CONSTRAINT "STA_OPER_STATUS_CK" CHECK (OPER_STATUS IN ('AC','UC', 'TA', 'PA', 'AN', 'PW' )) DEFERRABLE INITIALLY DEFERRED DISABLE,
         CONSTRAINT "STA_WELL_TYPE_NN" CHECK (WELL_TYPE is not null) DEFERRABLE INITIALLY DEFERRED ENABLE,
         CONSTRAINT "STA_PK" PRIMARY KEY ("STA_PK") DEFERRABLE INITIALLY DEFERRED ENABLE
    ALTER TABLE "WELL_STATUS" ADD CONSTRAINT "WELL_STATUS_CON_FK" FOREIGN KEY ("WEL_FK")
         REFERENCES "WELL" ("WEL_PK") ON DELETE CASCADE ENABLE
    CREATE INDEX "STA_PK" ON "WELL_STATUS" ("STA_PK")
    CREATE OR REPLACE TRIGGER "WELL_STATUS_STA_PK"
    BEFORE INSERT ON "WELL_STATUS"
    FOR EACH ROW
    BEGIN
    SELECT "STA_PK_SEQ".NEXTVAL INTO :NEW.sta_pk FROM DUAL;
    END;
    ALTER TRIGGER "WELL_STATUS_STA_PK" ENABLE
    For the PERMIT table-----
    CREATE TABLE "PERMIT"
    (     "PER_PK" NUMBER(8,0) NOT NULL ENABLE,
         "WEL_FK" NUMBER(8,0),
         "DELFLAG" VARCHAR2(1) DEFAULT 'N',
         "NUM_AOR_WELL" NUMBER(6,0),
         "AUT_STATUS" VARCHAR2(2) DEFAULT 'RA',
         "AUT_STATUS_DATE" DATE DEFAULT sysdate,
         "OWNERSHIP_TYPE" VARCHAR2(2) DEFAULT 'PB',
         "SUBMISSION_DATE" DATE,
         "PER_STATE_UK" VARCHAR2(4) DEFAULT '09DI',
         "REQUIRED_YN" VARCHAR2(1) DEFAULT 'N',
         "LAST_UPDATE" DATE DEFAULT sysdate,
         "USERNAME" VARCHAR2(16) DEFAULT user,
         CONSTRAINT "PER_AUT_STATUS_CK" CHECK (AUT_STATUS IN ('IP', 'AP', 'GP', 'EP', 'RA', 'NO' )) DEFERRABLE INITIALLY DEFERRED ENABLE,
         CONSTRAINT "PER_AUT_STATUS_NN" CHECK (AUT_STATUS is not null) DEFERRABLE INITIALLY DEFERRED ENABLE,
         CONSTRAINT "PER_OWNERSHIP_TYPE_CK" CHECK (OWNERSHIP_TYPE IN ('PB', 'PN', 'PF','FG', 'OI','OS', 'OT', 'PV', 'OR' )) DEFERRABLE INITIALLY DEFERRED DISABLE,
         CONSTRAINT "PER_PER_STATE_UK_CK" CHECK (PER_STATE_UK IN ('09DI', 'CAOC', 'GUEA', 'MPEQ', 'NVEP', 'NNUI' )) DEFERRABLE INITIALLY DEFERRED DISABLE,
         CONSTRAINT "PER_PER_STATE_UK_NN" CHECK (PER_STATE_UK is not null) DEFERRABLE INITIALLY DEFERRED DISABLE,
         CONSTRAINT "PER_REQUIRED_YN_CK" CHECK (REQUIRED_YN IN ('Y', 'N')) DEFERRABLE INITIALLY DEFERRED DISABLE,
         CONSTRAINT "PER_REQUIRED_YN_NN" CHECK (REQUIRED_YN is not null) DEFERRABLE INITIALLY DEFERRED DISABLE,
         CONSTRAINT "PER_PK" PRIMARY KEY ("PER_PK") DEFERRABLE INITIALLY DEFERRED ENABLE
    ALTER TABLE "PERMIT" ADD CONSTRAINT "PERMIT_CON_FK" FOREIGN KEY ("WEL_FK")
         REFERENCES "WELL" ("WEL_PK") ON DELETE CASCADE ENABLE
    CREATE INDEX "PER_PK" ON "PERMIT" ("PER_PK")
    CREATE OR REPLACE TRIGGER "PERMIT_PER_PK"
    BEFORE INSERT ON "PERMIT"
    FOR EACH ROW
    BEGIN
    SELECT "PER_PK_seq".NEXTVAL INTO :NEW.per_pk FROM DUAL;
    END;
    ALTER TRIGGER "PERMIT_PER_PK" ENABLE
    THESE ALL ARE TABLE STRUCTURE

  • Errors when inserting and updating form using VIEW.

    Here's my view:
    CREATE OR REPLACE FORCE
    VIEW  "SH_ADD_EMPLOYEES_VW" ("EMP_ID", "DEPT_ID", "JOB_DESC_ID", "EMPNO", "EMP_FIRST", "EMP_LAST", "USER_NAME", "USER_INI", "DEPTNO", "DEPT_DESC", "ROLES_ID", "ADMIN", "CREATES", "APPROVES", "QUALITY", "CUST_SVC", "SH_LOCAL",
    "SH_OFFICE", "SYSTEM")
    AS
      select
    "SH_EMPLOYEES"."EMP_ID" as "EMP_ID",
    "SH_EMPLOYEES"."DEPT_ID" as "DEPT_ID",
    "SH_EMPLOYEES"."JOB_DESC_ID" as "JOB_DESC_ID",
    "SH_EMPLOYEES"."EMPNO"  as "EMPNO",
    "SH_EMPLOYEES"."EMP_FIRST" as "EMP_FIRST",
    "SH_EMPLOYEES"."EMP_LAST" as "EMP_LAST",
    "SH_EMPLOYEES"."USER_NAME" as "USER_NAME",
    "SH_EMPLOYEES"."USER_INI" as "USER_INI",
    "SH_EMPLOYEES"."DEPTNO" as "DEPTNO",
    "SH_EMPLOYEES"."DEPT_DESC" as "DEPT_DESC",
    "DOC_ROLES"."ROLES_ID" as "ROLES_ID",
    "DOC_ROLES"."ADMIN" as "ADMIN",
    "DOC_ROLES"."CREATES" as "CREATES",
    "DOC_ROLES"."APPROVES" as "APPROVES",
    "DOC_ROLES"."QUALITY" as "QUALITY",
    "DOC_ROLES"."CUST_SVC" as "CUST_SVC",
    "DOC_ROLES"."SH_LOCAL" as "SH_LOCAL",
    "DOC_ROLES"."SH_OFFICE" as "SH_OFFICE",
    "DOC_ROLES"."SYSTEM" as "SYSTEM"
    FROM "SH_EMPLOYEES" "SH_EMPLOYEES", "DOC_ROLES" "DOC_ROLES"
    where "SH_EMPLOYEES"."EMP_ID" = "DOC_ROLES"."EMP_ID"
    Here's my trigger (note - I am not using the EXCEPTION clause or (declaration of it)  because it throws an error on msg=>: 'This is my message.' Any help here would be great as well.)
    CREATE OR REPLACE TRIGGER bi_ADD_EMPLOYEES_VW
    INSTEAD OF insert ON SH_ADD_EMPLOYEES_vw
    for each row
    declare
    duplicate_info EXCEPTION;
    PRAGMA EXCEPTION_INIT(duplicate_info, -00001);
    begin
    insert into SH_EMPLOYEES
    (EMP_ID, DEPT_ID, JOB_DESC_ID, EMPNO, EMP_FIRST, EMP_LAST, USER_NAME, USER_INI, DEPTNO, DEPT_DESC)
    values
    (:new.EMP_ID, :new.DEPT_ID, :new.JOB_DESC_ID, :new.EMPNO, :new.EMP_FIRST, :new.EMP_LAST, :new.USER_NAME, :new.USER_INI, :new.DEPTNO, :new.DEPT_DESC);
    insert into DOC_ROLES
    (ROLES_ID, ADMIN, CREATES, APPROVES, QUALITY, CUST_SVC, SH_LOCAL, SH_OFFICE, SYSTEM)
    VALUES (
    :new.ROLES_ID, :new.ADMIN, :new.CREATES, :new.APPROVES, :new.QUALITY, :new.CUST_SVC, :new.SH_LOCAL, :new.SH_OFFICE, :new.SYSTEM);
    EXCEPTION
    WHEN duplicate_info THEN
      RAISE_APPLICATION_ERROR (
       num=> -20107
       msg=> 'Duplicate employee');
    END bi_ADD_EMPLOYEES_VW;
    ERROR ON UPDATE:
    ORA-20505: Error in DML: p_rowid=1001,
    p_alt_rowid=EMP_ID, p_rowid2=2, p_alt_rowid2=ROLES_ID. ORA-01779: cannot modify
    a column which maps to a non key-preserved table
    ERROR ON INSERT:
    ORA-01400: cannot insert NULL into
    ("SPICE_HUNTER1"."SH_EMPLOYEES"."EMP_ID") ORA-06512: at
    "SPICE_HUNTER1.BI_SH_ADD_EMPLOYEES_VW", line 3 ORA-04088: error during execution
    of trigger 'SPICE_HUNTER1.BI_SH_ADD_EMPLOYEES_VW' ORA-06512: at
    "SYS.WWV_DBMS_SQL", line 549 ORA-06512: at "APEX_040000.WWV_FLOW_DML", line 1121
    ORA-22816: unsupported feature with RETURNING clause
    Error Unable to process row on table SH_ADD_EMPLOYEES_VW

    From what I see you are not handling emp_id when it is null.. you need to assign it a value when null from sequence.. that column cannot be null, hence the error, and in order to "modify" a column in that table the DML needs that id to have a value.

  • Having a problem with creating/using a primary key on a view

    I have a problem with a primary key on a view
    I created the view and primary key as follows:
    CREATE OR REPLACE FORCE VIEW "MDD"."ROCK_LU" ("DESCRIPTION",
         UNIQUE ("DESCRIPTION") RELY DISABLE,
         CONSTRAINT "ROCK_LU_PK" PRIMARY KEY ("DESCRIPTION") RELY DISABLE) AS
    SELECT DESCRIPTION
    FROM MRMC_LU
    WHERE ROCK = 'T';
    The view with the primary key appears to have been created as there were no error messages. (The above was from the sql tab in sql developer.)
    When I try to create the foreign key on my mdd_hr table - I get an error
    /* hr_name - foreign key */
    ALTER TABLE mdd_hr add CONSTRAINT hr_name_fk FOREIGN KEY (hr_name) REFERENCES rock_lu(description);
    Error report:
    SQL Error: ORA-02270: no matching unique or primary key for this column-list.
    When I lookup the index in sql developer, rock_lu_pk is not there.
    All my other foreign keys work - but I don't understand what I am doing wrong with this one. Please help.
    glenn
    Background - as to why I want to use a view as a lookup table.
    The MRMC_LU table that the view is created from is structured like:
    DESCRIPTION - MINERAL - ROCK - MODIFIER - COMMODITY
    ANHYDRITE - T - T - T
    APLITE - T - - T
    GRAPHITE - T - - - T
    GREYWACKE - - T
    DESCRIPTION is a list of all names of minerals, rocks, modifiers and commodities. T is entered in each valid field. Often a description name is used for both a mineral and a rock or a mineral and a commodity or any other combination. Because this database is just starting up, it was more efficient to create one table that could be updated (and thereby automatically update the MINERAL_LU, ROCK_LU, MODIFIER_LY, COMMODITY_LU views) rather than create and maintain four separate but similar tables. A primary key cannot be generated for the MRMC_LU table as there are nulls in each column
    except DESCRIPTION.
    Perhaps there is a smarter way to do this?

    http://download-uk.oracle.com/docs/cd/B10501_01/server.920/a96540/statements_85a.htm#2065512
    You can specify constraints on views and object views. You define the constraint at the view level using the out_of_line_constraint clause. You define the constraint as part of column or attribute specification using the inline_constraint clause after the appropriate alias.
    Oracle does not enforce view constraints. However, operations on views are subject to the integrity constraints defined on the underlying base tables. This means that you can enforce constraints on views through constraints on base tables.
    Restrictions on View Constraints
    View constraints are a subset of table constraints and are subject to the following restrictions:
    You can specify only unique, primary key, and foreign key constraints on views. However, you can define the view using the WITH CHECK OPTION clause, which is equivalent to specifying a check constraint for the view.
    Because view constraints are not enforced directly, you cannot specify INITIALLY DEFERRED or DEFERRABLE.
    View constraints are supported only in DISABLE NOVALIDATE mode. You must specify the keywords DISABLE NOVALIDATE when you declare the view constraint, and you cannot specify any other mode.
    You cannot specify the using_index_clause, the exceptions_clause clause, or the ON DELETE clause of the references_clause.
    You cannot define view constraints on attributes of an object column.
    Rgds.

  • Problem 1 in my person form: hitting ora-1401 (view with check option).

    In an earlier stage I had a table PERSON and a table ENSEMBLE.
    At some stage I decided it was not handy I was storing performing musicians in two different tables.
    So I set up a supertype, CONTRIBUTOR. PERSON is now a view on CONTRIBUTOR.
    The attribute IS_NATURAL_PERSON makes the record listed in person.
    The view definition is
    CREATE OR REPLACE FORCE VIEW "PARTITUREN"."PERSON" ("ID", "FIRST_NAME",
      "MIDDLE_INIT", "LAST_NAME", "GIVEN_NAME", "SORT_KEY", "DISPLAY_VALUE",
      "GENDER", "DATE_OF_BIRTH", "DATE_OF_BIRTH_APPROX", "LOCATION_OF_BIRTH",
      "DECEASED", "DATE_OF_DEATH", "DATE_OF_DEATH_APPROX", "LOCATION_OF_DEATH",
      "NATIONALITY", "ANV_ID", "NUMBERING_SYSTEM", "OPUSNUMBERS", "PORTRAIT",
      "MIME_TYPE", "FILE_NAME", "IS_NATURAL_PERSON", "LWTIMEST", "CREATED_BY",
      "CREATED_TS", "UPDATED_BY", "UPDATED_TS")
    AS
      SELECT
        id,
        first_name,
        middle_init,
        last_name,
        given_name,
        sort_key,
        display_value,
        gender,
        date_of_birth,
        date_of_birth_approx,
        location_of_birth,
        deceased,
        date_of_death,
        date_of_death_approx,
        location_of_death,
        nationality,
        anv_id,
        numbering_system,
        opusnumbers,
        portrait,
        mime_type,
        file_name,
        is_natural_person,
        created_ts lwtimest,
        created_by,
        created_ts,
        updated_by,
        updated_ts
      FROM
        contributor
      WHERE
        is_natural_person='Y'
    WITH CHECK OPTION;When I enter a record in Apex, I have the is_natural_person attribute default to Y.
    However I always hit ora-1401.
    It works in sql*developer and sql*plus.
    I now always have to resort to non-Gui tools to enter someone. This is nasty.
    Oracle 11.2.0.1, Apex 4.0.0.0.46
    Sybrand Bakker
    Senior Oracle DBA

    Hello .
    Some NLS charsets (such as UTF8) require more than one byte to store accented characters like "Ȩ", "ȿ", "�", "�", "ȵ", "ȭ" in the database.
    For example, when a 10 character string is inserted into a varchar2(10) column, the above messages may be signaled if your string contains accentuated characters such as "Ȩ", "ȿ", "�", �", "ȵ", "ȭ". used in languages like German
    One solution
    If the UTF8 NLS charset is being used with French, German ... characters in an Oracle database, then the size of the target column length should be set accordingly.
    Set the NLS_LANGUAGE and NLS_CHARACTERSET database parameters.
    One approach is to change the Database settings as follows:
    ALTER DATABASE CHARACTER SET WE8ISO8859P1;
    SHUTDOWN IMMEDIATE
    Onother
    According to the Oracle documentation, column length semantics determine whether the length of a column is specified in bytes or in characters. You use BYTE to specify that the length is in bytes, and you use CHAR to specify that the length is in characters. CHAR length semantics is also known as codepoint length semantics.
    Because some character sets require more than one byte for each character, a specification of 10 BYTE for a column might actually store less than 10 characters for certain character sets, but a 10 CHAR specification ensures that the column can store 10 characters, regardless of the character set.
    You set the length semantics for an Oracle database using the NLS_LENGTH_SEMANTICS initialization parameter, and all VARCHAR2 and CHAR columns use the setting specified for this initialization parameter as the default. If this initialization parameter is not set, then the default setting is BYTE.
    Edited by: Mortus on Jun 28, 2011 2:57 PM

  • Do I need to create a view for this?

    Hi Ihave got 2 tables emp and project
    In emp tabe:
    emp_no
    family name
    given name
    In porgect table:
    emp_no
    status(assigned,unassigned)
    start_date
    end_date
    emp_no Family_name given_name
    1 Smith John
    In project table same employee can have many assigement eg
    emp_no status start_date end_date
    1 assigned 01-may-08 01-july-08
    1 assigned 01-sep-08 01-july-09
    1 unassigned 01-july-09 01-oct-09
    In the form:
    there are 2 querable fields "project ends between field1(date) and field2(date)" which is used to
    retrive records which have end date between field1 and field2.
    The following fields are needed to get from database:
    emp.family_name emp.given_name project.start_date project.end_date No.of time assigned
    Requirements:
    1. project.start_date and project.end_date must be the latest project_end_date for the same emp
    so in the above sample date
    2. No. of time assigned is a count of total of number records which have status='assign'
    So for the given sample data the record expected after query would be(field1=01-jun-08 field2=02-july-09)
    emp.family_name emp.given_name project.start_date project.end_date No.of time assigned
    Smith John 01-sep-08 01-july-09 2
    What is the best approach to get:
    1 The lastest project(latest end_date) for the emp
    2. get No.of time assigned.
    Do I need to create a view for this? If yes, any sample sql code this this?
    Thanks for your help

    Hi W1zard,
    Thanks for your reply. Could you clarify the following points for me:
    1.) you could create a master block basing on your emp table and a detail block basing on your project table with the relation over emp_no. set the default_where clause of your detail block programmatically using
    set_block_property('project', default_where, 'status = ''assigned'' and <your_date_criteria>');
    Q1: where I pit this code? in pre-query trigger in detail block?
    2.) Of course you could create a view to join both of your tables if you don't want to use master detail blocks; Also do the join over emp_no
    create or replace force view v_emp as
    select emp.family_name, emp.given_name, project.start_date, project.end_date
    from emp, project
    where emp.emp_no = project.emp_no
    Q2 As I mentioned before, there are multipal entries for the same emp in project table and we only need the maching record from project table which has latest end_date. So I think I need something like
    max(project.end_date) somewhere in create view to make sure only one record for one employee.
    Also is there possible to include the no. of assigned field(select count(*) from project where status='assigned' and emp=emp_no) into the view as well?
    Q3 All the fields mentioned above are diaplay-only. So Can I create a control block which has all the fields from emp and project. Then populate them with my sql. The question is
    where I put this customerised sql so when user click excute query. My sql will run and display one the form?
    REally appreciated your help!
    Michael

  • View creation Procedure

    Hi,
    I hav created a procedure to create a daily view with 62 tables somthing like this
    Create or replace Procedure View_Cre as
    ex_command LONG:= null;
    ex1_command LONG:= null;
    ex2_command LONG:= null;
    ex3_command LONG:= null;
    begin
    ex1_command :='CREATE VIEW VIEW_NAME AS '||chr(10)||'Select * from TAB_'||to_char(sysdate,'DD_MON_YY');
    ---dbms_output.put_line(ex1_command);
    for idx in 1..61 loop
    ex_command := ''||chr(10)||' union all'||chr(10)||' Select * from TAB_'||to_char(sysdate-idx,'DD_MON_YY');
    --execute immediate ex_command;
    --- dbms_output.put_line(ex_command);
    ex2_command:=ex1_command||ex_command;
    ex1_command:=' ';
    ex3_command:= trim(ex2_command);
    --dbms_output.put_line(ex2_command);
    execute immediate ex3_command;
    end loop;
    end View_Cre;
    However its not "*" there in select statement it contains large string like 30000 chars.
    dbms_output gives me correct output but exec immediate gives invalide sql statement,
    the output from dbms_output.put_line(ex2_command) creates view without errors when pasted on sql prompt.
    Please help.
    Thanks in advance.

    May be like this ..
    declare
      ex_command  LONG := null;
      ex1_command LONG := null;
      ex2_command LONG := null;
      ex3_command LONG := null;
    begin
      ex1_command := 'CREATE FORCE VIEW VIEW_NAME AS ' || chr(10) ||
                     'Select * from TAB_' || to_char(sysdate, 'DD_MON_YY');
      ---dbms_output.put_line(ex1_command);
      for idx in 1 .. 61 loop
        ex_command := '' || chr(10) || ' union all' || chr(10) ||
                      ' Select * from TAB_' ||
                      to_char(sysdate - idx, 'DD_MON_YY');
        --execute immediate ex_command;
        --- dbms_output.put_line(ex_command);
        ex2_command := ex1_command || ex_command;
        ex1_command := ' ';
        ex3_command := ex3_command || trim(ex2_command);
        --dbms_output.put_line(ex2_command);
      --dbms_output.put_line(ex3_command);
      --dbms_output.put_line(ex3_command);
      end loop;
      --dbms_output.put_line(ex3_command);
      execute immediate ex3_command;
    end;Although, I must say that it is not a good design. You may want to look at your requirement again and see whether it is really required to create a view with dynamic SQL.
    Also, you may want to look at the short comings of using LONG in PL/SQL and supported data type in EXECUTE IMMEDIATE with length restriction.

Maybe you are looking for

  • When I click on a link within a Web page, Firefox just spins until I reload the new page.

    When I enter a new URL or select a bookmark, Firefox loads the page promptly. When I click on a link within that page to go to another page, the Firefox tab green spinner often just spins and spins. It either takes a very long time to load (2 or more

  • YouTube app problem: Same file formats, cannot view some videos

    This is weird. I uploaded several videos to YouTube with the same file format (.mkv) that YouTube supports. I have two Playlists. Only the videos in one of those Playlists are playable on my touch. But the videos in the other Playlist are not support

  • Scripts for starting/stopping managed servers

    All, Could someone provide me with some sample scripts for starting/stopping managed Weblogic servers?  I'm specifically looking for ways to start/stop them WITHOUT starting the AdminServer.  I'm running WLS 10.3.6 on Windows Server 2003, and I have

  • Connect mac 10.8.4 to server 2012 print

    Hi I work as a printersupporter. We have a customer who has an office hotel (e.g tenants rent a table or room for a specific time). This enviroment consist of 150 individual users. Theese users has a variation of Windows and Mac. We've setup a printe

  • Equalizer options not showing in Lumia 520

    Hi, I can't able to see any options under Settings/Audio options. Please help me to solve the isse. Thanks in advance Lokesh  Attachments: wp_ss_20130509_0001[1].png ‏22 KB