DML Statements for a Form
Hello,
I have 3 Pages created with different widgets which are not based on Base Table. The form is not based on a Base table.
Form is divided into 3 Pages with Next/Cancel/Previous/Create Buttons.
When the user clicks on the Create button on the 3rd Page, the contents of the form/fields should be used to update the Table.
Where should the Update Statement/Insert Statement be written?.
Regards
Shivanand
Hello Sergio,
The insert statement you have provided has been transformed by me to handle our application specific insert which gives me an error message 'Cannot insert an Null into Column Title' when I use :Page9_Title (where :Page9 = Number of Page on which Item Title is present)
Regards
Shivanand
Statement Included:
INSERT INTO SURE_DOCUMENT (DOCUMENT_ID, DOCUMENT_TYPE, TITLE, STATUS, DISTRIBUTION, FOLDER_ID, TOPIC_ID, CREATED_BY, CREATED_DATE, CREATED_SITE, UPDATED_BY, UPDATED_DATE, UPDATED_SITE, CONTENT_TYPE, DELETED) VALUES ('89998.1', 'BULLETIN', :PAGE9_TITLE, 'UNDER_EDIT', 'INTERNAL', 13267.1, 2354, 'SKOPPALK.UK',TO_DATE(SYSDATE,'DD-MON-YYYY'), 'WEBIV', 'SKOPPALK.UK',TO_DATE(SYSDATE,'DD-MON-YYYY'), 'WEBIV','TEXT/PLAIN','N')
Similar Messages
-
How to trace every dml statement for a schema/ database
hi,
how to trace every dml statement for a schema/ database
PFile Entrie
init.ora Parameter Example event='1401 trace name errorstack, level 12';
tkprof orcl_ora_3632.trc b.txt
after these two steps I am not able to see the sql statements in trace ...
Please suggest.
Thanks & Regards,Hi,
Trace Event 1401 will create a trace file and dumps the information when ORA-01401 error occurs. This error occurs when "inserted value too large for column"
You will see the trace file getting populated only when you encounter ORA-01401 error.
Regards -
I am trying to use HTML directly in SQL statement for tabular form (see SQL below). When the tabular form runs it is not converting the HTML so it displays as this:
Manala<span style="color:blue;">pan</span>
Am I missing something?
select
"PK_ID",
"CODE",
decode(instr(upper(city_name),upper(:P3_SEARCH)),
0, city_name,
substr(city_name,1,
instr(upper(city_name),upper(:P3_SEARCH)) - 1)
|| '<span style="color:blue;">' ||
substr(city_name, instr(upper(city_name),upper(:P3_SEARCH)),
length (:P3_SEARCH))
|| '</span>' ||
substr(city_name, instr(upper(city_name),upper(:P3_SEARCH)) + length(:P3_SEARCH) )) "CITY_NAME",
"STATE_CODE"
from "#OWNER#"."ZIP"
where upper(city_name) like '%' || upper(:P3_SEARCH) || '%'Right. The HTML is correct but the only way it will display right is when I changed the field attribute to 'Standard Report Column'. Unfortunately, that removes the field from being a text field (input).
-
Auditing DDL and DML statements of selective IP addresses....
Hi all,
DB : 11.2.0.2 64 bit
OS : RHEL 5.7 64bit
Hi all,
I want to audit all DDL and DML statements for some selective IP Addresses or hostnames.
I read about Fine Grained Audit. I got the following code to enable auditing of nondatabase user's actions(Application users).
created policy for client identifier.......
BEGIN
DBMS_FGA.ADD_POLICY(OBJECT_SCHEMA => 'OE',
OBJECT_NAME => 'ORDERS',
POLICY_NAME => 'ORDERS_FGA_POL',
AUDIT_CONDITION => 'SYS_CONTEXT(''USERENV'', ''CLIENT_IDENTIFIER'') = ''Robert''',
HANDLER_SCHEMA => NULL,
HANDLER_MODULE => NULL,
ENABLE => True,
STATEMENT_TYPES => 'INSERT,UPDATE,DELETE,SELECT',
AUDIT_TRAIL => DBMS_FGA.DB + DBMS_FGA.EXTENDED,
AUDIT_COLUMN_OPTS => DBMS_FGA.ANY_COLUMNS);
END;
But I want to audit all DDL and DML statements for a particular schema say ABC from selective IP addresses or hostnames so how can I do this?
Pl suggest.....
Regards,
Andy.Hi,
You could :
1. create a function, say myfunction, returning 1 if you want to audit, 0 otherwise
This function would test sys_context('userenv','ip_address') within the desired IP address to be audited
2. create your fga on the objects you want to audit adding the clause audit_condition=>'myfunction=1'
Nicolas. -
How to save the session states for a tabular form WITHOUT using check boxs?
Greeting guys,
As you know that we can use collections to save the session states of a tabular forms, described in the how-to doc of manual tabular forms. However, what I am trying to do ( or have to do) is to provide a manual tabular form, and save the session states for validation, without using the check boxes. Because a user can put contents into some columns in a row without checking the corresponding checkbox, according to the requirements. So basically what I tried is to loop over all the rows and save Every entry into a collection. However, sometimes I got "no data found" error with unknown reasons.
My current solution is to use the "dirty" Retry button that gets back the history, which IMO is not a good workabout. So, I'd appreciate if somebody can shed some light on a better solution, especially if it is close to the one in that how-to doc.
Thanks in advance.
LucThe following is the first collection solutin I've tried:
htmldb_collection.create_or_truncate_collection('TEMP_TABLE');
for i in 1..p_row_num loop -- Loop on the whole form rows
if (htmldb_application.g_f01(i) is not null) or (htmldb_application.g_f05(i) <> 0)
--If either of them has some input values, the row should be saved into the colleciton.
then
htmldb_collection.add_member(
p_collection_name => 'TEMP_TABLE',
p_c001 => htmldb_application.g_f01(i),
p_c002 => htmldb_application.g_f03(i),
p_c003 => htmldb_application.g_f04(i),
p_c004 => htmldb_application.g_f05(i),
p_c005 => htmldb_application.g_f06(i),
p_c006 => htmldb_application.g_f08(i)
end if;
end loop;
Some of columns have null values, but I don't think that's the reason. Because once I clicked all the check boxes, there would be no error no matter what values were in other columns.
Another issue would be extract the values FROM the collection, which has been tried because I had problem to store the data into the collection. I used "decode" functions inside the SQL to build the tabular form. I am not sure whether it will be the same as a regular SQL for a tabular form, like the example in the How-to doc.
Also I didn't use the checksum, for it is not an issue at the current stage. I am not sure whether that's the reason which caused the NO DATA FOUND error. -
Create a new rule for printing form to use in time statement form
Hello,
we need to print an information on time statement form in dependence of a special substitution. Is there any possibility to create a new rule for printing form to use in time statement form? I can't find any information about this.
Thanks for your help.
Regards,
DanielaYes, I've tried this, but I get the error message:
Form class TEDT can only be displayed with this editor.
What am I doing wrong? Do I have to create a customer form class and assign a customer time statement form?
Thanks for your information.
Regards,
Daniela -
Insert Statement for Form on Table with Report
I'm using a 'getID' process On Load Before Header to make sure I get an ID for my form per suggestion from blarman here. The form has many fields from one table and four collections. If I let the process run as I think it should (when the ID is null) the link to the report does not fetch any field except the id. If I set the process to never run everything loads but my update process doesn't run. What am I doing wrong? Advance thanks...
Alexandra
Get ID Process
declare
new_id NUMBER; --gets the next sequence number for new record ID
begin
INSERT INTO DOC_INFO (DOC_INFO_ID,OWNER_ID,STATUS_ID, DOCNO, DOC_TITLE, REVISION, STATUS_DT,ISSUE_DT, REVIEW_DT, ECRNO, ECR_LINK, DOC_LINK, COMMENTS, KEYWORDS, DOC_TYPE, ASSOC_ITEMNO, FILE_TYPE, FILE_NAME, CHANGE_TYPE, NEW_DOCNO) values(new_id, 0, 0, '', '', '', '','', '', '', '', '', '', '', '', '', '', '', '','');
:P26_DOC_INFO_ID := new_id;
end;Update Process (On Submit/After Comp...)
Update DOC_INFO
SET
DOC_INFO_ID = :P26_DOC_INFO_ID,
OWNER_ID = :P26_OWNER_ID,
STATUS_ID = :P26_STATUS_ID,
DOCNO = :P26_DOCNO,
DOC_TITLE = :P26_DOC_TITLE,
REVISION = :P26_REVISION,
STATUS_DT = :P26_STATUS_DT,
ISSUE_DT = :P26_ISSUE_DT,
REVIEW_DT = :P26_REVIEW_DT,
ECRNO = :P26_ECRNO,
ECR_LINK = :P26_ECR_LINK,
DOC_LINK = :P26_DOC_LINK,
COMMENTS = :P26_COMMENTS,
KEYWORDS = :P26_KEYWORDS,
DOC_TYPE = :P26_DOC_TYPE,
ASSOC_ITEMNO = :P26_ASSOC_ITEMNO,
FILE_TYPE = :P26_FILE_TYPE,
FILE_NAME = :P26_FILE_NAME,
CHANGE_TYPE = :P26_CHANGE_TYPE,
NEW_DOCNO = :P26_NEW_DOCNO
WHERE DOC_INFO_ID = :P26_DOC_INFO_ID;Got it...I think it had to do with the use of my 'Create' and 'Apply Changes' buttons.
Thanks for your time anyway. -
Statement of Directions for Oracle Forms
there are two SoD for Forms available at http://www.oracle.com/technology/products/forms/index.html:
2005: Strategy for Oracle Forms:
http://www.oracle.com/technology/products/forms/pdf/10g/ToolsSOD.pdf
2007: Forms 10g Client Platform Support:
http://www.oracle.com/technology/products/forms/htdocs/10gr2/clientsod_forms10gr2.html
do we get a new SoD-Strategy when Forms 11g releases?There are none planned but that might change.
I am planning to make the client SOD version independent. That is, drop the 10gr2 in the name. -
Hi,
I have seen sometimes the queries which work in oracle sql*plus and Pl/Sql Developer,they dont work in Oracle forms, for example following query works in
Pl/sql developer,but not in oracle forms
select *
from tablea
where name in (variable)
so if variable contains 'AA','BB'
and records are there in table ,it will not fetch any records,whether variable is with quotes or not .........
whenever there is a dml statement involving variables ..behavior is somewhat different ....so to get that done ....i normally transfer them to database procedure or function .....then it works fine ..
Is it known bug or what.
Regards,
SSYou can use a FORMS_DDL or EXECUTE IMMEDIATE
select_dml := ' select * from tablea where name in ('||:variable||')';
FORMS_DDL ( select_dml);if variable contains 'AA','BB' -
Constructing Database Update DML Statements
This is a very common problem I am sure but want to know how others handle it. I am creating a web application via Servlets and JSPs. I am working with Oracle 10g.
Here's the problem/question.
When I present an html form to a user to update an existing record, how do I know what has changed in the record to create the dml statement? I could just update the entire record with the values supplied via the POST data on submit but that does not seem right since maybe only 1 out of 10 fields actually changed. This would also write needless audit and logging information to the database. I have thought about comparing the Request parameters sent with the post with the original java bean used to populate the form in the first place by adding it back to the request as an attribute. Is this the only way to do it or is there a better way?
Thanks everyone,
-BrianWhat database drivers are you using? I recall there being some bug in
sp2 that caused delayed transaction commits for a very specific
combination of transaction settings and database drivers.
I think it was third-party type II Oracle drivers and local
transactions, but I'm not sure.
In any case, I'd contact support as there is a patch available.
David
Gurjit wrote:
Hi all,
I have posted something of this sort earlier too. The problem is that
the database is not reflecting what has been updated using queries from the
application.
THe structure of the application is as follows.
DB = Oracel 8.1.6
Web Server = iPlanet 4.0
App Server = iPlanet 6.0 sp2
The database is connected to via the EJB's. No Database transactions are
being used except for Bean transactions which are container managed. The
setAutoCommit flag is set to true. Each query is a transaction. The jsp's
call these ejb's through wrapper classes. As stated earlier the database
updates (Inserts, update, delete statements) are not getting reflected in
the database immediately. The updates happen after a gap of about 7-10
minutes. Why is this sort of behaviour coming up. This is almost like batch
updates happening on the database. Is there a setting in IPlanet for
removing this kind of problem.
Regards,
Gurjit -
can we select udf which contains dml statements?
1007109 wrote:
can we select udf which contains dml statements?
Excellent question! And one that illustrates just how careful you have to be when you ASK questions or provide answers.
As with many things Oracle the correct answer is: it depends.
Yes - you can. And no - you can't. And also, yes - you can!
ANY one of those answers is correct, depending on what assumptions the questioner is making and/or what assumptions that you, the answerer are making.
Sometimes a interviewer will ask this old 'trick' question and then get mad at you if you don't give them the answer that they want even if you give them an answer that is CORRECT and even if you explain WHY your answer is correct.
Some questioners are looking for the answer that Frank gave:
>
A function that performs DML (or that calls another sub-program that performs DML) can NOT be used in a SQL statement, such as SELECT.
>
If you just read the 'restrictions' section in the Advanced App Developer's guide you might come up with the answer that Frank gave.
http://docs.oracle.com/cd/E11882_01/appdev.112/e25518/adfns_packages.htm#i1008107
>
Restrictions
When a new SQL statement is run, checks are made to see if it is logically embedded within the execution of a running SQL statement. This occurs if the statement is run from a trigger or from a subprogram that was in turn invoked from the running SQL statement. In these cases, further checks determine if the new SQL statement is safe in the specific context.
These restrictions are enforced on subprograms:
A subprogram invoked from a query (SELECT statement) or DML statement cannot end the current transaction, create or rollback to a savepoint, or ALTER the system or session.
A subprogram invoked from a query or parallelized DML statement cannot run a DML statement or otherwise modify the database.
A subprogram invoked from a DML statement cannot read or modify the particular table being modified by that DML statement.
>
But then if you read the very next sentence in that doc you will see this:
>
You can avoid these restrictions if the execution of the new SQL statement is not logically embedded in the context of the running statement. PL/SQL autonomous transactions provide one escape (see "Autonomous Transactions" ).
>
And finally if the term DML includes the SELECT statement and the SQL Language doc DOES use it that way
http://docs.oracle.com/cd/B28359_01/server.111/b28286/statements_1001.htm#i2099257
>
The SELECT statement is a limited form of DML statement in that it can only access data in the database. It cannot manipulate data stored in the database, although it can manipulate the accessed data before returning the results of the query.
>
That doc also lists statements other than the traditional SELECT, INSERT, UPDATE or DELETE
>
Data Manipulation Language (DML) Statements
Data manipulation language (DML) statements access and manipulate data in existing schema objects. These statements do not implicitly commit the current transaction. The data manipulation language statements are:
CALL
DELETE
EXPLAIN PLAN
INSERT
LOCK TABLE
MERGE
SELECT
UPDATE
>
So the CORRECT answer is:
1. No, Frank's answer, if by DML you are only considering INSERT, UPDATE or DELETE statements and you do NOT use the AUTONOMOUS_TRANSACTION pragma.
2. Yes - if DML includes SELECT (LOCK TABLE also works) - you don't need the pragma. A common use of functions is in LOOKUP operations. These functions can be, but should NOT be, called from a sql statement.
3. Yes - if the AUTONOMOUS_TRANSACTION pragma is used. This is NOT recommended.
Try some of the following code examples
>
create or replace function get_dname(p_deptno IN number) return varchar2 is
v_dname dept.dname%type;
begin
select dname into v_dname from dept where deptno = p_deptno;
return v_dname;
end;
select empno, ename, deptno, get_dname(deptno) from emp e
where rownum < 4
EMPNO,ENAME,DEPTNO,GET_DNAME(DEPTNO)
7369,SMITH,20,RESEARCH*
7499,ALLEN,30,SALES**
7521,WARD,30,SALES**
create or replace function get_dname1(p_deptno IN number) return varchar2 is
v_dname dept.dname%type;
begin
update dept set dname = dname || '*' where deptno = p_deptno;
select dname into v_dname from dept where deptno = p_deptno;
return v_dname;
end;
select empno, ename, deptno, get_dname1(deptno) from emp e
where rownum < 4
ORA-14551: cannot perform a DML operation inside a query
ORA-06512: at "SCOTT.GET_DNAME1", line 4
create or replace function get_dname2(p_deptno IN number) return varchar2 is
PRAGMA AUTONOMOUS_TRANSACTION;
v_dname dept.dname%type;
begin
update dept set dname = dname || '*' where deptno = p_deptno;
commit;
select dname into v_dname from dept where deptno = p_deptno;
return v_dname;
end;
select empno, ename, deptno, get_dname2(deptno) from emp e
where rownum < 4
EMPNO,ENAME,DEPTNO,GET_DNAME2(DEPTNO)
7369,SMITH,20,RESEARCH**
7499,ALLEN,30,SALES***
7521,WARD,30,SALES****
create or replace function get_dname3(p_deptno IN number) return varchar2 is
v_dname dept.dname%type;
begin
lock table emp_copy in share mode;
select dname into v_dname from dept where deptno = p_deptno;
return v_dname;
end;
select empno, ename, deptno, get_dname3(deptno) from emp e
where rownum < 4
EMPNO,ENAME,DEPTNO,GET_DNAME2(DEPTNO)
7369,SMITH,20,RESEARCH**
7499,ALLEN,30,SALES***
7521,WARD,30,SALES****
> -
Writing own dml statements in jdeveloper
i need to write my own dml statement in a jdevelopers application. like on saving a purchase form i would like to update stock table as well. Some one told me to write code in DoDML procedure but how ? i mean what statement should i write there ?
lot of possibilities but easy way is to call PL/SQL code i guess you are coming from FORMS background so it would be easy and understandable for you
You can expose PL/SQL package as web-services also you can call stored procedures and functions in ADF
here is the example http://baigsorcl.blogspot.com/2010/05/calling-plsql-procedure-and-function-in.html
doDML() will work at entity level you can call your PL/SQL at doDML as well or as call its method binding -
Issue with Customize program for Dunning Forms
Hi Experts
I have write a perform for dunning form in a outside report apart from standard print program. After doing some calculations I want print some information in the form using the function module "Write_Form", but I am not able write on the form.
Please advise me is there any other settings are additional details are required to print the custome lines in the dunning form. Dunning form also customized in this scenario.
Awaiting for your reply
Thanks
PraveenHi Shakeel
Thanks for your help, I am using Write_Form only, but not able to write the statements in the Form.
Let me explain my code here.
1. I wrote the perform in the SAP Script under a text element.
2. In that perform(in the program) I am calling other text elements, where I have to write the statements.
But I dont know, what is the problem here, when I debug the Write_Form FM, in the very first statement itself, it is becoming false and coming out from the whole process. That statement is
check co_perform-active <> true.
Please advise me, am I doing anything wrong or is there any other process to fullfill it.
Thanks
Praveen -
Two forms on same page..save state of one form while submitting other.
Hi....
I have 2 form on same page....
first is form on table....
nd another is tabular form.....
now if I make an entry in both table ,,,,and after entering data in tabular form if click on submit button of tabular for the data of tabular form get submitted,,but the data I have been enter in first form get erased.....
now my question is how can I save state of my first form even after clicking on submit button...........
pls,help.Hi Shirish,
in your scenario you can write manual process for one form in your both forms, using this way you can achieve you functionality.
do the above and for that manual process keep the button name as your second form button means, for two forms saving with only one button.
i am not sure in this, but you can try something.
Thanks
Chandran
Edited by: Chandran on Nov 28, 2011 2:21 AM -
Instead of Trigger for tabular form
I have a tabular layout on a form that returns data from a database view. Based on user interaction I would like to update the underlying view records that are returned by a query in the form using an INSTEAD OF trigger. I have my trigger working, however I can only get it to update the first record of the tabular layout item on the form. I realize that INSTEAD OF triggers are row level triggers, but is there a way to get this trigger to fire for multiple records? I've written a simple update statement in the form that updates the view: update newborn.nb_ltfu_positive_v
set export_dt = sysdate
where barcode = :nb_ltfu_positive_v.barcode;
and my INSTEAD OF trigger looks like this: if :old.export_dt <> :new.export_dt then
update nbpat set export_dt = sysdate
where spec = :old.spec;
end if;
if :old.export_dt <> :new.export_dt then
update nbhear_audiotest set export_dt = sysdate
where barcode = :old.barcode;
end if;
Do I need to do some looping in the trigger?
Any assistance would be greatly appreciated.
ThanksNo you cannot do any looping in the database trigger. The database trigger will for every record which is involved in an UPDATE issued againt the view.
The problem is your code inside the form. In general you do not issue "manual" update against a table/view in forms, but let forms do so. So, if you want to update a record in a tabular block in forms you would just assign the new value to the forms-item, such as
:BLOCK.EXPORT_DT:=SYSDATE;in your example. This code marks the "active" reocrd in the block as "to be updated" in the next transactions, mean when the user presses "Save". If you want to update multiple records in forms, this is either done when the user navigates between different record and then does some changes in the block-fields, or if you want to do it "programmatical", by looping over the block, something like:
FIRST_RECORD;
LOOP
EXIT WHEN :SYSTEM.RECORD_STATUS ='NEW';
-- do some stuff on the current record, exampel code
:BLOCK.EXPORT_DT:=SYSDATE;
EXIT WHEN :SYSTEM.LAST_RECORD='TRUE';
NEXT_RECORD;
END LOOP;hope this helps
Maybe you are looking for
-
Problem with uploading screen recording to YouTube
Hello, when I record my screen in QT and want to upload the video to youtube by Share->youtube, the uploaded video on youtube has first 3-5 seconds damaged. Why that happen? How can I avoid it?
-
i contact with at&t to unlock my i phone and they send me approved so would you tel me why not active yest <Edited by Host>
-
IPad Full Screen Video Encode Settings
This seems like such a basic question but I can't seem to find it. I want to transcode a video to play in 1024x768, which is the dimension of the iPad. However one of the presets in AME (CS6) for either Apple or iPad have this setting. What are peopl
-
VL10a - Dialog vs. Background
Hi All, I need input regarding this scenario with tcode VL10a. I have a Sales Order and I create delivery for it through VL10a. My SO has 3 line items. When I process the SO in Dialog mode, a delivery is created for all three line items. When I use t
-
ADF11g : Need help with RowIterator binding
Hi, I am using ADF 11g. In a ADF application we have application module under which we have different View Objects. In my application I am having a separate Data Controller, which is formed by Java Class. Inside this Data Controller, I am having a Vi