Update data in view
I created a view in program unit (procedure).
when new form instance I call this
and created a block base with this view
it has detail block
I have one column chk varchar2(1)
it is a check box
I need when I check this box chk will be 'Y'
I mean update the view . if I check the box 4 records all the records chk must be 'Y' in view
I write a code on-update trigger;
if :challan1_view.chk = 'Y' then
update challan_view
set chk ='Y';
end if;but not saving CHK ='Y'
Edited by: Kame on Aug 17, 2009 11:15 PM
Dear Francois
Answers: 1. this is a procedure
PROCEDURE so_view IS
BEGIN
---------- Creating First view----------------
declare
V_COMMAND varchar2(5000);
begin
V_COMMAND := 'Create or replace view Challan_view as
select qry1.dcno,qry1.dcdate,qry1.customername,qry1.perscode,qry1.persname,qry1.commission,qry1.netrate,
qry1.itemcode,qry1.itemname,qry1.itemunit,qry1.dcrate,qry1.dcqty,qry1.disc_pers,qry1.disc_amount,
qry1.tax_perc,qry1.tax_amount,qry1.netamount,qry1.chk,
qry2.idcqty, nvl(qry1.dcqty,0) - nvl(qry2.idcqty,0) Remaining
from
(select a.dcno,a.dcdate,a.customername,a.perscode,a.persname,a.commission,a.netrate,
b.itemcode,b.itemname,b.itemunit,b.dcrate,b.dcqty,b.disc_pers,b.disc_amount,
b.tax_perc,b.tax_amount,b.netamount,b.chk
from masterdc a , dc_detail b
where a.dcno = b.dcno) qry1,
(select b.dcno, b.dcdate,b.itemcode,b.itemname,
b.dcqty IDCQTY
from masterinv a , inv_detail b
where a.invno = b.invno) qry2
where qry1.dcno = qry2.dcno (+)
--and qry1.itemcode = qry2.itemcode(+)
and nvl(qry2.idcqty,0) < nvl(qry1.dcqty,0)';
FORMS_DDL(V_COMMAND);
end;
declare
V_COM varchar2(5000);
begin
V_COM := 'Create or replace view challan1_view as
select dcno,dcdate,customername,perscode,persname,commission,netrate from challan_view
group by dcno,dcdate,customername,perscode,persname,commission,netrate';
FORMS_DDL(V_COM);
end;
END;Answer 2:
I have check in list of table/views its created.
SQL> select * from tab;
TNAME TABTYPE CLUSTERID
CHALLAN1_VIEW VIEW
CHALLAN_VIEW VIEW
CITY TABLE
CUSTOMER TABLE
DEPT TABLE
DETAILDC_VIEW VIEW
DETAILSO_VIEW VIEW
ITEM TABLE
MASTERDC_VIEW VIEW
MASTERSO_VIEW VIEW
SOVIEW_DETAIL VIEW
USERS TABLE
SQL> after that I created a block from views.
Similar Messages
-
Fails to update data during view object test
Hi, I'm using:
Postgresql w/JDBC drivers
Jdeveloper 10g
I created entities and associations for my tables, and now I created a view object, assigned it to application module and run it.
It shows the data properly, but when I try to commit a change, it gives me:
Business Component Browser - oracle.jbo.DMLException
(oracle.jbo.DMLException) JBO-26041: Failed to post data to database during "Update": SQL Statement "UPDATE PUBLIC.SIGNON Signon SET username=? WHERE username=?".
----- LEVEL 1: DETAIL 0 -----
(java.sql.SQLException) ERROR: parser: parse error at or near "Signon" at character 22
Any idea what I'm doing wrong?You're hitting Bug# 3537056. Contact worldwide support and they have a one-off patch for this that they can supply for you. The issue is related to lack of support in your database for a table alias in the update statement.
-
Cannot display updated data in view
I am connect to Oracle 10gR2 using SQL Developer 1.2.1 Build Main-32.13
I have a table Table_A and a sample view View_A which is "select * from table_A".
Firstly, I open the Table_A and View_A in two tab.
After I update the record in Table_A using Data Tab (without clicking commit),
I cannot see the updated record in View_A (even I click the refresh in View_A Data tab).
Is is a bugs ? Because I think the two tab should share the same session.This is the current behaviour; the tab collects all updates until commit.
I'd like to see the changes posted upon leaving each row too (like Toad does). The only way to be able to rollback changes is not using the Data tab, only the worksheet. And without posting(/committing), there's no way of knowing the outcome of triggers.
Not a bug, just a missing feature.
I see 2 possible solutions: an Autopost Changes preference in Database - ObjectViewer Parameters, and/or a Post button next to the Commit and Rollback buttons in the Data tab.
Adding this to the Exchange in http://htmldb.oracle.com/pls/otn/f?p=42626:39:2374531395921602::NO::P39_ID:8901. Please go vote to get this implemented.
Thanks,
K. -
Can not insert/update data from table which is created from view
Hi all
I'm using Oracle database 11g
I've created table from view as the following command:
Create table table_new as select * from View_Old
I can insert/update data into table_new by command line.
But I can not Insert/update data of table_new by SI Oject Browser tool or Oracle SQL Developer tool .(read only)
Anybody tell me, what's happend? cause?
Thankyou
thiensu
Edited by: user8248216 on May 5, 2011 8:54 PM
Edited by: user8248216 on May 5, 2011 8:55 PMI can insert/update data into table_new by command line.
But I can not Insert/update data of table_new by SI Oject Browser tool or Oracle SQL Developer tool .(read only)so what is wrong with the GUI tools & why posting to DATABASE forum when that works OK? -
FRM-40602: Cannot insert into or update data in a view
Hi all!
I have a form based on a view and I want to get rid off this message.
I set the properties blocks query only but it still doesn't work.
Does someone met with this situation?
Many thanks!Hello
I've just been messing about with a similar problem. Basically, I have a view that involves a join across two tables, I have a data block in my form that's based on the view, and I've written an INSTEAD OF trigger to insert/update/delete from the two tables.
I was getting the error message 'Cannot insert or update data in a view', and it turned out that the error was happening because the join column between the two tables was the primary key on one of the tables, but the corresponding column on the join table had no unique key on it. This meant that Oracle couldn't establish a one-to-one relationship between rows in the view and rows in the underlying tables. The column on the join table was in fact unique on that table, and adding a unique constraint on that column in the database cured the problem.
Hope that's of use.
regards
Andrew
UK -
Want to update data in a view based on multiple tables
Hi
I am facing a problem i want to update data in tables using a view. As that view is based on multiple tables so i am unable to update data. i came to know we can update table from view only if view is based on single table. so if anyone knows any alternative please let me know.
Thanx
DevinderDevinder,
The table can be updated through a view based on multiple tables, if and only if the table is a "key preserved" table. Rather than explaining myself, i avoided the burden of typing by finding the material in Oracle Docs and pasting it for you :-)
If you want a join view to be updatable, all of the following conditions must be
true:
1. The DML statement must affect only one table underlying the join.
2. For an INSERT statement, the view must not be created WITH CHECK
OPTION, and all columns into which values are inserted must come from a
key-preserved table. A key-preserved table in one for which every primary
key or unique key value in the base table is also unique in the join view.
3. For an UPDATE statement, all columns updated must be extracted from a
key-preserved table. If the view was created WITH CHECK OPTION, join
columns and columns taken from tables that are referenced more than once
in the view must be shielded from UPDATE.
4. For a DELETE statement, the join can have one and only one key-preserved
table. That table can appear more than once in the join, unless the view was
created WITH CHECK OPTION.
HTH
Naveen -
Hi,
trying to update data from a view with:
- Company (table)
- Products (table)
In a form, the user wants to update
e.g: both products.product_name and Company.company_name.
Is there a way to update a view records built on 2 tables ?
Any idea will be really appreciated
ThksAn other question on INSTEAD OF Trigger:
Base Tables:
1.
SQL> desc pcs_companies;
Name Null? Type
COMPANY_ID NOT NULL NUMBER(12)
COUNTRY VARCHAR2(350)
COMPANY_NAME VARCHAR2(320)
COMPANY_PHONE VARCHAR2 (320)
COMPANY_FAX VARCHAR2(320)
COMPANY_URL VARCHAR2(150)
UPDATED_DATE DATE
2.
SQL> desc pcs_individuals;
Name Null? Type
INDIVIDUAL_ID NOT NULL NUMBER(12)
COMPANY_ID NUMBER(12)
FIRST_NAME VARCHAR2(320)
LAST_NAME VARCHAR2(320)
LOB VARCHAR2(300)
JOB_ROLE VARCHAR2(300)
TITLE VARCHAR2(300)
GENDER VARCHAR2(3)
EMAIL VARCHAR2(720)
FAX VARCHAR2(720)
PHONE_NO VARCHAR2(720)
UPDATED_DATE DATE
COUNTRY VARCHAR2(150)
ADDRESS_1 VARCHAR2(720)
ADDRESS_2 VARCHAR2(720)
ADDRESS_3 VARCHAR2(720)
CITY VARCHAR2(720)
3. pcs_individuals.COMPANY_ID = FK, ref pcs_companies.
4.
SQL> CREATE VIEW V_PCS_COMPANY_IND
AS
SELECT
i.INDIVIDUAL_ID,
c.company_id,
c.country,
c.Company_name,
c.company_phone,
i.Company_id indiv_company_id,
i.gender,
i.first_name,
i.last_name,
i.lob,
i.job_role,
i.title,
i.email_address,
i.fax,
i.phone_no ,
i.address_1,
i.address_2,
i.address_3,
i.city
FROM
pcs_individuals i,
pcs_companies c
WHERE
i.company_id = c.company_id
5.
CREATE OR REPLACE TRIGGER PCS_ADMIN.PCS_COMP_IND_UPDATE_TR
INSTEAD OF UPDATE ON PCMS_ADMIN.V_PCS_COMPANY_IND
FOR EACH ROW
begin
update PCS_COMPANIES
set
Company_name = nvl(:new.company_name,company_name),
company_phone = nvl(:new.company_phone,company_phone)
where company_id = :new.company_id;
update PCS_INDIVIDUALS
set
gender = nvl(:new.gender,gender),
first_name = nvl(:new.first_name,first_name),
last_name = nvl(:new.last_name,last_name),
lob = nvl(:new.lob,lob),
title = nvl(:new.title,title),
email_address = nvl(:new.email_address,email_address),
phone_no = nvl(:new.phone_no,phone_no),
fax = nvl(:new.fax,fax),
country = nvl(:new.country,country),
address_1 = nvl(:new.address_1,address_1),
address_2 = nvl(:new.address_2,address_2),
address_3 = nvl(:new.address_3,address_3),
city = nvl(:new.city,city)
where company_id = :new.company_id;
end PCMS_COMP_IND_UPDATE_TR;
6.
CREATE OR REPLACE TRIGGER PCS_ADMIN.NEW_COMPANY_ID_INSERT
INSTEAD OF INSERT ON PCS_ADMIN.V_PCS_COMPANY_IND
DECLARE
ID number;
BEGIN
INSERT INTO pcs_companies (org_id)
select v_pcs_comp_id_seq.nextval
into ID
from dual;
:new.company_id = ID;
INSERT INTO pcs_individuals (company_id)
select v_pcs_comp_id_seq.nextval
into ID
from dual;
:new.company_id = ID;
end;
My question
On point 6:
Assumption:
- Company_id is PK of pcs.Company and FK in pcs.individuals
- It should be feed by sequence (v_pcs_comp_id_seq)
Now how can i insert the same value for company_id (current.v_pcs_comp_id_seq) in both pcs_companies and pcs_individuals ? I've tested it in the above INSTEAD OF Trigger.It failed.
Thks for any advice,
lamine -
Inserting/updating data in control block based on view
Hi!
I`ve created a block based on a view to display data.
I want this block to be insertable and updateable, that is I will use a on-insert/update trigger to call an insert/update procedure located in the database.
When trying to change/insert a value in the block, the error message "Error: Can not insert into or update data in a view" pops up. I`ve tried to get rid of this error, without success.
How can I make a data block based on a view insertable and updateable?
My guess is that this have something to do with locking the records(there is no rowid in the view)... but I'm not sure.
Pls advise!!Morten
As well as on-update, on-insert, on-delete triggers you also need an on-lock,
(even though it might just contain null;) otherwise the form will try to lock the view and fail.
Actually your terminology is wrong, the block being based on a table or view is not a control block. A control block is not based on anything and has no default functionality for communicating with the database. If it was a control block, the on- triggers would not fire. -
Updating data throug a view in forms
Hi,
How is it possible to update data through a updateable view, when there is no rowids in a view? Can i define primary key some how to the form instead of rowid?
Regards Tarjayes, you can choose one (or more) item then set the PRIMARY KEY property to yes.
Francois -
Viewing the updated date in Address Book
Does anybody know a consistent way to view the "updated date" on an Address Book card if you have lengthy notes for every contact?
In Apple's desire to keep things beautiful instead of functional, they have placed a very light "updated date" status in the lower right-hand corner of each contact card in the Address Book.
However, if you have lengthy notes for that contact, you CAN'T SEE the updated date at all, because the notes obscure the updated date! The ONLY way that we have been able to figure out how to see the updated date is to select all of our notes for the card, CUT the notes to our clipboard, look at the updated date, and then PASTE the notes back into the contact card again.
Ridiculous, right?!
Any ideas on this? ALSO -- while we're on the topic -- does anybody know of a way to show the updated TIME in conjunction with the date?
Thanks,
ScottDoes anybody know a consistent way to view the "updated date" on an Address Book card if you have lengthy notes for every contact?
Other than expanding the size of the Address Book window, there is no way to accomplish that.
does anybody know of a way to show the updated TIME in conjunction with the date?
That cannot be done at the present time, though it's possible that Apple may add that feature or option in the future.
Mulder -
Avoid customizing TR while updating data of SAP standard view
Hi all,
I am preparing TC for view V_T093C_01. View is SAP view and Requirement is to avoid customizing TR while updating data. Please suggest how we shall do that.
Thanks,
Krishna.Hi Krishna,
There is an attribute stored in the table/view maintenance dialogs, which say if there's a standard or custom transport routine to transport. By indicating a custom one, but without defining it, the system won't ask any transport request.
But I don't advise you to change it because:
- Changing this field is considered as a modification of the standard.
- why is it important that the system does not ask for a transport request? It is harmless!
Or is it that you want to allow changing it in production, in that case I would give another answer (by defining the "current settings")
Sandra -
Update a maintenance view.
Hi ,
I want to update a maintenance view.
Data is coming from a text file which i am uplaoding.
Which function module should I use to update the maintenence view.
Thanks,
Ram.hi,
use this FM VIEW_MAINTENANCE_CALL
hope it will work.
use this code .
&----& Report Z_TEST_PROGRAM&--*& Demo program for blog http://abap-explorer.blogspot.com/&--
REPORT z_test_program.DATA:i_sellist TYPE STANDARD TABLE OF vimsellist INITIAL SIZE 0,i_header TYPE STANDARD TABLE OF vimdesc INITIAL SIZE 0,i_namtab TYPE STANDARD TABLE OF vimnamtab INITIAL SIZE 0.PARAMETERS: p_view TYPE viewname MATCHCODE OBJECT viewmaint OBLIGATORY.AT SELECTION-SCREEN.CALL FUNCTION 'VIEW_GET_DDIC_INFO' EXPORTING viewname = p_view VARIANT_FOR_SELECTION = ' ' TABLES sellist = i_sellist x_header = i_header x_namtab = i_namtabEXCEPTIONS no_tvdir_entry = 1 table_not_found = 2 OTHERS = 3 .IF sy-subrc <> 0. data: l_message type NATXT. CONCATENATE 'Table/View' p_view INTO l_message SEPARATED BY space. MESSAGE e001(00) WITH l_message ' not in the Dictonary'.ENDIF.START-OF-SELECTION.CALL FUNCTION 'VIEW_MAINTENANCE_CALL' EXPORTING action = 'S' view_name = p_viewEXCEPTIONS client_reference = 1 foreign_lock = 2 invalid_action = 3 no_clientindependent_auth = 4 no_database_function = 5 no_editor_function = 6 no_show_auth = 7 no_tvdir_entry = 8 no_upd_auth = 9 only_show_allowed = 10 system_failure = 11 unknown_field_in_dba_sellist = 12 view_not_found = 13 maintenance_prohibited = 14 OTHERS = 15 .IF sy-subrc <> 0. MESSAGE i001(00) WITH 'Error while calling the view'. LEAVE LIST-PROCESSING.ENDIF.
Edited by: katigiri linganna on Apr 20, 2009 4:31 PM -
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;
ThanksHi
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 -
Update data in r/3 from webdynpro using bapi
Hi ,
i am new to webdynpro.
i want to update data say sales order in r/3 backend from webdynpro.
can i have some links for the same.
i have seen previous forums in following link, but couldn't open.do i need to register to have some extra rights.
/thread/12846 [original link is broken]
thanks in advanceHi Satya
In order to update data in R/3 from web dynpro you need to use RFC or BAPI
The Adaptive Remote Function Call (Adaptive RFC) is a technology that enables the Web Dynpro application developer to use the business functions encapsulated in Business APIs (BAPIs) even after a structure modification, without having to provide the new data using a second back end or a new structure with subsequent regeneration of the proxies.
Procedure for Importing Adaptive RFC model is as follows
1. Choose the context menu entry Create Model on the Models node of the relevant Web Dynpro component.
2. In the model wizard, choose Import Adaptive RFC Model followed by Next.
3. Make the required entries for example, to specify where the generated RFC model instances and RFC metadata are to be stored.
4. In the next wizard window, you enter your user data for the SAP System that contains the BAPIs from which you want to generate the proxies. You use it to log on to the SAP System online.
To be able to log on to the SAP System, it must be entered in the logon group.
5. Next select the BAPIs for which you want to create Java proxies in a generation process. Then choose Next to proceed to the next wizard window.
6.The import log provides information about the generated model classes, properties, and model relations. Choose Finish to start the generation process.
Now add this model in "Used Model" for your application
Now for graphic display you create view,for the progarm control create controller and used this model to retrieve & update data.
For more information about web dynpro for Java refer
http://help.sap.com/saphelp_nw2004s/helpdata/en/14/c897427f18d06ae10000000a155106/frameset.htm
For information about RFC & BAPI
http://help.sap.com/saphelp_nw2004s/helpdata/en/22/042860488911d189490000e829fbbd/frameset.htm
Regards
Gauri -
How To Update A Table View From Client Side !!!!
Hi I would like to update a table view from the Client Side. So that the user can keep updating the relevent data on the client and when they have finally finished they can press Save so the entire page is then sent to the Server.
Does anyone know how to do this, I guess u have to use the EPCM, I have just started on it and would really appreciate some Help.
Thanks,
Emmanuel.This is what I found :-
There are a couple of ways to approach this.
1) load the excel spreadsheet into the database "as is". You can use interMedia
text to convert the .xls file into a .htm file (HTML) or use iFS (see
http://technet.oracle.com/
for
more info on that) to parse it as well. InterMedia text will convert your XLS
spreadsheet into a big HTML table (easy to parse out what you need at that
point)
2) Using OLE automation, a program you write can interact with Excel, request
data from a spreadsheet, and insert it. Oracle Forms is capable of doing this
for example as is other languages environments. In this fashion, you can remove
the "manual" and "sqlldr" parts -- your program can automatically insert the
data.
3) You can write a VB script that uses ODBC or Oracle Objects for OLE (OO4O) in
Excel. This VB script would be able to put selected data from the spreadsheet
into the database. We would recommend OO4O. It provides an In-Process COM
Automation Server that provides a set of COM Automation interfaces/objects for
connecting to Oracle database servers, executing queries and managing the
results. OO4O is available from
http://technet.oracle.com
Maybe you are looking for
-
Trying to access website but it says Adobe Flash Player not installed
www.caesars.com/thelinq live webcam I have Windows 7, 64 bit with IE 1,0 32 bit. Flash Player 11.9.900.170. Have been through the troubleshooting list several times but can't get this website to access Flash Player. FP seems to work everywhere else
-
HELP PLEASE! WIERD DESKTOP BACKGROUND BEHAVIOR
Hi, Occasionaly when I shutdown, pull the power plug, and restart my wallpaper changes itself to something which i hadn't used for a long time?!?! Strangely this normaly only happend when I move my computer around (something i do a lot) and especiall
-
Command-X (cut) doesn't work in finder
If I use "Finder" and I want to "cut" a file the shortcut (command X) doesn't work and in the menu(edit) "cut" is grey. I can only use drag&drop... in "textedit" it's possible to "cut" words! What's going wrong? Please help! regards soho
-
Please help me, how do I use Safari to browse the web, like eBay or Amazon?
-
Upgrading to SQL 2005 from 2000?
I have a very large database in 2000 and I'm thinking of requesting that it be moved to 2005. I've heard that 2005 is faster and I've seen the interface for it and it looks like it combines Query analyzer with the standard interface tools. Enterprise