Oracle 9i Forms - Display Insert Statements
I'm getting an Oracle error "unable to insert record" during runtime of the 9i forms. Is there a way to display the insert statements? In 3.0 or 4.5 you can press F1 and F2 key how about in 9i ?
thanks
If you have the standard pull-down menu, you can use Help, Display Error.
Otherwise, it depends on the key functions defined in your fmrweb.res resource file. The default released from Oracle shows Shift Ctrl E:
69 : 3 : "Shift+Ctrl+E" : 78 : "Display Error"The line in the fmrpcweb.res file (which is what I use) shows Shift F1:
112 : 1 : "Shift+F1" : 78 : "Display Error"
Similar Messages
-
Help needed in forming dynamic insert statement
HI,
I am trying to construct a insert statement as given below.
Please help me as to how to form this and where am i going wrong?
i want the columns names to be auto populated when a table name is given.
output should be like:
==============
insert into tablename
col1,col2,col3..coln)
values
(col1, col2, col3..coln);
declare
v_sql varchar2(5000);
cnt number :=0;
col_count number;
name varchar2(5000);
TYPE string_assarrtype IS TABLE OF VARCHAR2 ( 25 ) INDEX BY VARCHAR2 ( 20 );
arr string_assarrtype;
BEGIN
select count(column_name) into col_count from user_tab_columns
where
table_name = 'PS_D_RE_BCSREGIONMAPPING';
v_sql:='insert into tablename (' ;
for i in 1..arr(col_count)
loop
v_sql:='v_sql' ||' '||arr(i);
DBMS_OUTPUT.PUT_lINE(v_sql);
END LOOP;
END;Below is the actual code which i am trying to write:
Since the below trigger logic is same for around 25/30 tables i wanted to construct a generic procedure which will take input parameter as tablename and auit_table and form the insert statement which will populate the column names which are different for different tables.
Please guide...
CREATE OR REPLACE PROCEDURE make_trigger( tablename in VARCHAR2,
auditable in VARCHAR2
AS
v_sql varchar(10000);
begin
v_sql := 'DROP TRIGGER TRD_D_AUDIT_D'||tablename;
dbms_output.put_line (v_sql );
v_sql:='CREATE OR REPLACE TRIGGER TRG_D_AUDIT_D_'||tablename||' '||
'BEFORE INSERT OR UPDATE OR DELETE ON 'tablename||' '||' REFERENCING OLD AS OLD NEW AS NEW
FOR EACH ROW';
dbms_output.put_line (v_sql );
v_sql:= 'DISABLE
DECLARE
v_Operator psoprdefn.oprid%type;
v_Sysdate Date;
v_Actn varchar2(1);
V_AUDIT_RECNAME PSRECDEFN.RECNAME%type;
BEGIN';
dbms_output.put_line (v_sql );
v_sql:= 'If (Inserting) Then
v_Actn :='||'''||'A'||'''||';'||
'Insert into '||auditable||'
('||
AUDIT_RECNAME,
AUDIT_ACTN,
AUDIT_OPRID,
AUDIT_STAMP,
D_USER_GROUP,
D_GROUP_DESC,
D_BCS_ID,
D_UBR_ID,
D_FILTER_ID,
D_NAME_ACCESS_TYPE,
D_GLOBAL_EMP_LIST
Values
V_AUDIT_RECNAME,
v_Actn,
v_Operator,
v_Sysdate,
:NEW.D_USER_GROUP,
:NEW.D_GROUP_DESC,
:NEW.D_BCS_ID,
:NEW.D_UBR_ID,
:NEW.D_FILTER_ID,
:NEW.D_NAME_ACCESS_TYPE,
:NEW.D_GLOBAL_EMP_LIST
end if;
end;Edited by: user11942774 on Oct 5, 2012 11:46 AM
Edited by: user11942774 on Oct 5, 2012 8:09 PM
Edited by: user11942774 on Oct 5, 2012 8:10 PM -
Relation between record in a form and insert statement written in button
hi all,
i am using Forms [32 Bit] Version 6.0.8.24.1 (Production).
i have a master detail form with relation
A is master of B, B is master of C and a button which resides on control block(other than A,B,C).
so i will insert a one record into the block 'A' and i will press button which will insert particular record into particular table.
so when i try to move to next record('A' block) it is asking for database change. when i give 'yes' everything is ok. but when i give 'no'(w.r.t that record) and moves to next record and inserts the record and insert record throguh button also, at this time user press 'yes' then the first record is not saving but what ever i have inserted through the insert statement is not rolling back.
How can i control insert statement with the respect to datablock change in the block.
The block 'C' data is going to the other table through insert statement the block 'C' i am posting. So due to 'post' the block is not getting cleared so insert statement is also firing.
In other words i want to unpost the posted data when user press 'no' in the database message.
I know there is nothing to do with the forms message. But is its possible to control when user press 'no' then the insert statement should not gets saved into the table.
Please help.
Thanks..
Edited by: GD on Jun 27, 2011 5:38 AMFirst off, you need to understand how Oracle Forms interacts with an Oracle database. Forms natively handles all DML transactions for you. Meaning, if you have a Forms data block based on a database table, Forms will generate all the necessary DML to handle any changes that occur in that block. You do not need to write your own DML statements in code.
so i will insert a one record into the block 'A' and i will press button which will insert particular record into particular table.Is Block "A" based on a table? How are you inserting the record into the table? If you are writting your own DML to insert the record this would explain why you are being prompted to save when you change records. As I mentioned, if your block is based on a table, Forms will know if you change a value within the block.
How can i control insert statement with the respect to datablock change in the block.If your blocks are based on tables, let Forms handle the DML! don't do it yourself.
In other words i want to unpost the posted data when user press 'no' in the database messageIf your block is based on a table, when you are prompted to save changes - answering 'NO' will automatically clear the current record of the data block (in essence - rollback the change).
Craig... -
Performance Tuning in Oracle 10g during Migration - Insert Statements
Some of the tables contain a huge data e.g. 7 million records to be migrated.
The table structure of Source Database is different from the Target Database (Where we are doing the migration).
So we have made a use of temporary tables to collect the data from different tables using joins and populate the main table using INSERT INTO tableA SELECT * FROM tableZ
Now the problem statement.
Some of the queries take infinite time and data doesnt get inserted into the main tables. I have seen the explain plan and didnt find anything unusual. The same query works fine when we use date time stamp and restrict the data.
What parameters do we have to take care ? Is there any configuration needed on Oracle Server side ? If yes which parameters?Lets start with the basics. First what is 10g? Is that 10.1.0.3 or 10.2.0.4 or something else?
Second 7 million records is a relatively small dataset.
No one can possibly help you with no DDL, no DML, no Explain Plan output generated with DBMS_XPLAN.
We can make wild guesses but that is like closing your eyes in a dark room and trying to find the light switch.
Please repost all relevant information so someone can help you. -
Issu for running insert statement in oracle procedure.
Hi expert,
I ran a oracle procedure with a insert statement inside as:
insert into table1 select....
but I got error message related to this insert statement as "SQLERRM= ORA-08103: object no longer exists"
I ran this statement separately in toad, no error message, but no data result from this execute.
please tell how to fix this issue.
Many Thanks,
Edited by: 918440 on 27-Jun-2012 8:04 AMHi friend,
my insert statement is as follows:
INSERT INTO HIROC_RU_FACT_S
select
pp.policy_fk,
pp.transaction_log_fk,
p.policy_no,
p.policy_type_code,
hiroc_rpt_user.hiroc_get_entity_name(pp.policy_fk,'POLHOLDER') policy_holder,
pp.risk_fk,
r.risk_base_record_fk,
r.entity_fk,
hiroc_sel_entity_risk_name2 (pp.risk_fk,r.entity_fk) risk_name,
substr(trim(nvl(r.county_code_used_to_rate,pth.issue_state_code)),1,2) rating_state_code,
hiroc_get_province_name(substr(trim(nvl(r.county_code_used_to_rate,pth.issue_state_code)),1,2), 'PROVINCE_CODE', 'L') rating_state_name,
hiroc_get_provicne_pol_prefix(substr(trim(nvl(r.county_code_used_to_rate,pth.issue_state_code)),1,2),p.policy_type_code) rating_prov_pol_prefix,
nvl(r.risk_cls_used_to_rate,pth.peer_groups_code) rating_peer_group_code,
hiroc_get_lookup_desc('PEER_GROUP',nvl(r.risk_cls_used_to_rate,pth.peer_groups_code),'L') rating_peer_group_name,
pth.policy_term_history_pk,
pth.term_base_record_fk,
to_char(pth.effective_from_date,'yyyy') term_effective_year,
c.coverage_pk,
c.coverage_base_record_fk,
pc.coverage_code,
c.product_coverage_code,
pc.long_description,
pp.coverage_component_code,
c.effective_from_date,
c.effective_to_date,
cls.coverage_code coverage_class_code,
cls.coverage_long_desc coverage_class_long_desc,
decode(pp.coverage_component_code ,'GROSS',cls.exposure_unit,null) exposure_unit, --hiroc_get_expos_units_by_cov(c.coverage_pk,pc.coverage_code,c.effective_from_date,c.effective_to_date) exposure_unit,
decode(pp.coverage_component_code ,'GROSS',cls.number_of_patient_day,null) number_of_patient_day,
pth.effective_from_date term_eff_from_date,
pth.effective_to_date term_eff_to_date,
pp.premium_amount premium_amount,
(case when (pc.coverage_code in ('CP','MC1','MC2','MC3','MC4','HR','F') or pc.coverage_code like 'ST%') and
pp.coverage_component_code != 'RISKMGMT' then
(nvl(pp.premium_amount,0))
else
0
end) primary_premium,
(hiroc_get_risk_units(hiroc_get_provicne_pol_prefix(substr(trim(nvl(r.county_code_used_to_rate,pth.issue_state_code)),1,2),p.policy_type_code)-- rating_prov_pol_prefix
,nvl(r.risk_cls_used_to_rate,pth.peer_groups_code) -- rating_peer_group_code
,cls.coverage_code --coverage_class_code
,decode(pp.coverage_component_code ,'GROSS',cls.exposure_unit,null)
,pp.premium_amount
,(case when (pc.coverage_code in ('CP','MC1','MC2','MC3','MC4','HR','F') or pc.coverage_code like 'ST%') and
pp.coverage_component_code != 'RISKMGMT' then
(nvl(pp.premium_amount,0))
else
0
end) -- primary_premium
,p.policy_type_code
,trunc(pth.effective_to_date))) risk_units
from proddw_mart.rmv_territory_makeup tm,
proddw_mart.rmv_premium_class_makeup pcm,
proddw_mart.rmv_product_coverage pc,
proddw_mart.rmv_coverage c,
proddw_mart.rmv_risk r,
proddw_mart.rmv_policy_term_history pth,
proddw_mart.rmv_policy p,
proddw_mart.rmv_transaction_log tl,
proddw_mart.rmv_policy_premium pp,
(select /* +rule */
p.policy_no,
p.policy_start_date,
p.policy_end_date,
r.risk_pk,
r.risk_description,
c.coverage_pk,
c.parent_coverage_base_record_fk,
pc.parent_product_covg_code,
pc.coverage_code,
pc.short_description coverage_short_desc,
pc.long_description coverage_long_desc,
c.exposure_unit,
pc.exposure_basis_code,
c.number_of_patient_day,
p.policy_start_date policy_effective_date,
p.policy_end_date policy_expiry_date,
c.effective_from_date,
c.effective_to_date,
to_char(c.effective_from_date,'YYYY') class_eff_year
from proddw_mart.odwr_coverage_only c
,proddw_mart.odwr_product_coverage pc
,proddw_mart.odwr_risk r
,proddw_mart.odwr_policy p
where pc.code = c.product_coverage_code
and pc.parent_product_covg_code is not null -- coverage classes only
and r.risk_pk = c.risk_base_record_fk
and c.accounting_to_date = to_date('1/1/3000','mm/dd/yyyy') -- only open records
and c.base_record_b = 'N'
and p.base_record_b = 'N'
and p.policy_pk = r.policy_fk
and p.accounting_to_date = to_date('1/1/3000','mm/dd/yyyy') -- only open records
group by p.policy_no,
p.policy_start_date,
p.policy_end_date,
r.risk_pk,
r.risk_description,
c.coverage_pk,
c.parent_coverage_base_record_fk,
pc.parent_product_covg_code,
pc.coverage_code,
pc.short_description, -- coverage_short_desc,
pc.long_description, -- coverage_long_desc,
c.exposure_unit,
pc.exposure_basis_code,
c.number_of_patient_day,
p.policy_start_date, -- policy_effective_date,
p.policy_end_date, -- policy_expiry_date,
c.effective_from_date,
c.effective_to_date,
to_char(c.effective_from_date,'YYYY')-- class_eff_year
) cls
where tm.risk_type_code = r.risk_type_code
and tm.county_code = r.county_code_used_to_rate
and tm.effective_from_date <= pp.rate_period_from_date
and tm.effective_to_date > pp.rate_period_from_date
and pcm.practice_state_code (+) = r.practice_state_code
and pcm.risk_class_code (+) = r.risk_cls_used_to_rate
and nvl(pcm.effective_from_date, pp.rate_period_from_date) <= pp.rate_period_from_date
and nvl(pcm.effective_to_date, to_date('01/01/3000','mm/dd/yyyy')) > pp.rate_period_from_date
and pc.code = c.product_coverage_code
and c.base_record_b = 'N'
and ( c.record_mode_code = 'OFFICIAL'
and (c.closing_trans_log_fk is null or
c.closing_trans_log_fk != tl.transaction_log_pk)
or c.record_mode_code = 'TEMP'
and c.transaction_log_fk = tl.transaction_log_pk )
and c.parent_coverage_base_record_fk is null
and c.effective_from_date < c.effective_to_date
and c.effective_from_date <= pp.rate_period_from_date
and c.effective_to_date > pp.rate_period_from_date
and c.accounting_from_date <= tl.accounting_date
and c.accounting_to_date > tl.accounting_date
and c.coverage_base_record_fk=pp.coverage_fk
and r.base_record_b = 'N'
and ( r.record_mode_code = 'OFFICIAL'
and (r.closing_trans_log_fk is null or
r.closing_trans_log_fk != tl.transaction_log_pk)
or r.record_mode_code = 'TEMP'
and r.transaction_log_fk = tl.transaction_log_pk )
and r.effective_from_date < r.effective_to_date
and r.effective_from_date <= pp.rate_period_from_date
and r.effective_to_date > pp.rate_period_from_date
and r.accounting_from_date <= tl.accounting_date
and r.accounting_to_date > tl.accounting_date
and r.risk_base_record_fk = pp.risk_fk
and pth.base_record_b = 'N'
and ( pth.record_mode_code = 'OFFICIAL'
and (pth.closing_trans_log_fk is null or
pth.closing_trans_log_fk != tl.transaction_log_pk)
or pth.record_mode_code = 'TEMP'
and pth.transaction_log_fk = tl.transaction_log_pk )
and pth.accounting_from_date <= tl.accounting_date
and pth.accounting_to_date > tl.accounting_date
and pth.term_base_record_fk = pp.policy_term_fk
and p.policy_pk = pp.policy_fk
and tl.transaction_log_pk = pp.transaction_log_fk
and pp.active_premium_b = 'Y'
and pp.rate_period_type_code in ('CS_PERIOD','SR_PERIOD')
and pp.rate_period_to_date > pp.rate_period_from_date
and tl.accounting_date <= sysdate
and p.policy_cycle_code = 'POLICY'
and substr(p.policy_no,1,1) <> 'Q'
and tl.transaction_log_pk = (select max(pp.transaction_log_fk)
from proddw_mart.rmv_policy_premium pp,proddw_mart.rmv_transaction_log tl2
where pth.term_base_record_fk = pp.policy_term_fk
and pp.transaction_log_fk = tl2.transaction_log_pk
and tl2.accounting_date <= sysdate )
and p.policy_type_code in ('LIABCRIME','MIDWIFE')
and pth.accounting_to_date = to_date('01/01/3000','mm/dd/yyyy') --<<<******* eliminates duplicates
and p.policy_no = cls.policy_no
-- and r.risk_pk = cls.risk_pk
and c.coverage_base_record_fk = cls.parent_coverage_base_record_fk(+)
and cls.effective_from_date < pth.effective_to_date -- from date less than period end date
and cls.effective_to_date > pth.effective_from_date -- to date greater than period start date
and cls.policy_effective_date < pth.effective_to_date -- from date less than period end date
and cls.policy_expiry_date > pth.effective_from_date -- to date greater than period start date
group by pp.policy_fk,
pp.transaction_log_fk,
p.policy_no,
p.policy_type_code,
pp.risk_fk,
r.risk_base_record_fk,
r.entity_fk,
substr(trim(nvl(r.county_code_used_to_rate,pth.issue_state_code)),1,2), -- rating_state_code,
r.county_code_used_to_rate,
pth.issue_state_code,
nvl(r.risk_cls_used_to_rate,pth.peer_groups_code) , -- rating_peer_group_code,
r.risk_cls_used_to_rate,
pth.peer_groups_code,
pth.policy_term_history_pk,
pth.term_base_record_fk,
to_char(pth.effective_from_date,'yyyy'), --term_effective_year,
c.coverage_pk,
c.coverage_base_record_fk,
pc.coverage_code,
c.product_coverage_code,
pc.long_description,
pp.coverage_component_code,
c.effective_from_date,
c.effective_to_date,
cls.coverage_code, -- coverage_class_code,
cls.coverage_long_desc, -- coverage_class_long_desc,
decode(pp.coverage_component_code ,'GROSS',cls.exposure_unit,null),-- exposure_unit,
decode(pp.coverage_component_code ,'GROSS',cls.number_of_patient_day,null), -- number_of_patient_day,
pth.effective_from_date, --term_eff_from_date,
pth.effective_to_date, --, --term_eff_to_date,
pp.premium_amount ;Edited by: BluShadow on 27-Jun-2012 16:12
added {noformat}{noformat} tags for readability. PLEASE READ {message:id=9360002} AS PREVIOUSLY REQUESTED! & -
Hello,
I noted in a post recently that an insert statement was formed like the one below the advantage being that there was one commit statement,
INSERT INTO TABLE
SELECT COLUMNS FROM DUAL
UNION ALL
SELECT COLUMNS FROM DUAL
So I have attempted to use something like it, I have three examples below two (first and third example) using the syntax above.
The last example attempts to use the syntax above but I have not included all the columns and it fails, is there anyway to form an insert statement similar to above that inserts multiple records for only some of the columns in the table with one commit statement.
SQL*Plus: Release 10.2.0.1.0 - Production on Wed Apr 2 09:42:05 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> CONNECT SCOTT/TIGER
Connected.
... INSERT STATEMENT WITH 8 OF 8 COLUMNS REPRESENTED
SQL>
SQL> INSERT INTO SCOTT.EMP
2 SELECT 1000,'BELL','SALESMAN',7698,to_date('01/JAN/00','DD/MON/RR'),10000,100,30 FROM DUAL
3 UNION ALL
4 SELECT 2000,'HOOK','SALESMAN',7698,to_date('01/JAN/00','DD/MON/RR'),10000,100,30 FROM DUAL
5 /
2 rows created.
SQL>
... INSERT STATEMENT WITH 3 OF 8 COLUMNS REPRESENTED
SQL> Insert into SCOTT.EMP (EMPNO,ENAME,JOB) values (3000,'FRASER','SALESMAN');
1 row created.
SQL> Insert into SCOTT.EMP (EMPNO,ENAME,JOB) values (4000,'EATON','SALESMAN');
1 row created.
SQL>
... IS IT POSSIBLE TO USE A STATEMENT LIKE THIS TO INSERT 3 OF 8 COLUMNS.
SQL> INSERT INTO SCOTT.EMP
2 SELECT 5000,'CARR','SALESMAN' FROM DUAL
3 UNION ALL
4 SELECT 6000,'PLATT','SALESMAN' FROM DUAL
5
SQL> COMMIT
2 /
Commit complete.Thank You for any assistance
BenThank You for the clarification Chen,
This is the address that I was refering to about 6 posts down Oracle Database 10g Express Edition help
After rereading it I may have come to the wrong conclusion on what Sentinel was saying.
So is there any advantage to doing an insert with join all? I had the impression it was more efficient, faster or easier to write, what do you think?
Ben -
Quote problem in Generating Insert Statement Script to Extract Data
Hi every body;
I would like to write an sql/plsql script which can extract data from an oracle existing table in insert statements.
example:
the table employees:
empno name
1 john
2 M'hir
3 M'silou
My problem is that i have the following result:
insert into employees values('1','john');
insert into employees values('2','m'hir');------- Problem with M'hir qote
insert into employees values('3','M'silou');----- Problem with M'silou quote
How can i have :
insert into employees values('2','m''hir');------- two quotes with M'hir =M''hir
insert into employees values('3','M''silou');----- Problem with M'silou=M''silou
plz your help
thank you at advanceHi,
What is your DB version?? If it is >10g, you can use the Q delimiter (as mentioned by Solomon).
Check this out.
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14251/adfns_sqltypes.htm#BABFEDBG
-Arun -
Nothing display in Oracle developer forms runtime-web...
i have started OC4J instance,no compilation error showed,when i run the form module nothing display in Oracle developer forms runtime-web.
how to resolve this?Hi skud
Pls state ur Os, Forms Version and the JIntiator Version from the control panel
if u r using forms 10g pls may be u forgot to set the following form the Form's menu
Pls Select > Edit Menu > Preferences > RunTime Tab > Set the Browser u have to use.
Hope this helps...
Regards,
Abdetu... -
Not to display Yes/No/Cancel message window, while closing Oracle Apps Form
Hello All,
I have a requirement,where we need to avoid displaying Yes/No/Cancel message window when trying to save the changes in Oracle Applications Form.
Please do let me know how to achive this.
Thanks a lot in Advance.Hi Ramesh,
Thanks for the Update.
I have used the below code in KEY-EXIT
CLEAR_FORM(NO_VALIDATE);
EXIT_FORM;
Also the code behind the button which submits the conc.program:
DECLARE
l_request_id NUMBER;
vRESP_APPL_ID number;
vRESP_ID number;
vUSER_ID number;
BEGIN
--vRESP_APPL_ID := apps.FND_PROFILE.VALUE('RESP_APPL_ID');
--vRESP_ID := apps.FND_PROFILE.VALUE('RESP_ID');
--vUSER_ID := apps.FND_PROFILE.VALUE('USER_ID');
--apps.FND_GLOBAL.APPS_INITIALIZE(vUSER_ID,vRESP_ID,vRESP_APPL_ID);
apps.FND_GLOBAL.APPS_INITIALIZE(2340,20420,1);
l_request_id := FND_REQUEST.SUBMIT_REQUEST ('XXAHS',
'XXAHSRPDSR',
null,
sysdate,
FALSE,
'|020|080|031|161|030|100|131|',
'11-JAN-10',
'|41|42|43|45|',
insert into temp_amk values(15);
commit;
message('request id:'||l_request_id);
exception
when others then
message(sqlerrm);
end;
This code worked fine, in case I ran from SQL Prompt.
Please let me know what must be missing.
Thanks. -
Generate Insert Statement Script to Extract Data from Table in Oracle 7i
Hi all, I have an old Oracle legacy system that is running for over 15 years.Every now and then we need to extract data from this table@ ORacle 7i to be imported back to Oracle 10G.
My thoughts are to create a script of Insert statements in oracle 7 and that to be deployed back to Oracle 10G.
I found this scripts in Google and not sure how exactly this works.Any explanation on thsi scripts , would be greatly appreciated.I find this scripst may help to generate a set of insert statements from that table to the latest table at 10G.
<pre>
-- Step 1: Create this procedure:
create or replace Function ExtractData(v_table_name varchar2) return varchar2 As
b_found boolean:=false;
v_tempa varchar2(8000);
v_tempb varchar2(8000);
v_tempc varchar2(255);
begin
for tab_rec in (select table_name from user_tables where table_name=upper(v_table_name))
loop
b_found:=true;
v_tempa:='select ''insert into '||tab_rec.table_name||' (';
for col_rec in (select * from user_tab_columns
where
table_name=tab_rec.table_name
order by
column_id)
loop
if col_rec.column_id=1 then
v_tempa:=v_tempa||'''||chr(10)||''';
else
v_tempa:=v_tempa||',''||chr(10)||''';
v_tempb:=v_tempb||',''||chr(10)||''';
end if;
v_tempa:=v_tempa||col_rec.column_name;
if instr(col_rec.data_type,'CHAR') > 0 then
v_tempc:='''''''''||'||col_rec.column_name||'||''''''''';
elsif instr(col_rec.data_type,'DATE') > 0 then
v_tempc:='''to_date(''''''||to_char('||col_rec.column_name||',''mm/dd/yyyy hh24:mi'')||'''''',''''mm/dd/yyyy hh24:mi'''')''';
else
v_tempc:=col_rec.column_name;
end if;
v_tempb:=v_tempb||'''||decode('||col_rec.column_name||',Null,''Null'','||v_tempc||')||''';
end loop;
v_tempa:=v_tempa||') values ('||v_tempb||');'' from '||tab_rec.table_name||';';
end loop;
if Not b_found then
v_tempa:='-- Table '||v_table_name||' not found';
else
v_tempa:=v_tempa||chr(10)||'select ''-- commit;'' from dual;';
end if;
return v_tempa;
end;
show errors
-- STEP 2: Run the following code to extract the data.
set head off
set pages 0
set trims on
set lines 2000
set feed off
set echo off
var retline varchar2(4000)
spool c:\t1.sql
select 'set echo off' from dual;
select 'spool c:\recreatedata.sql' from dual;
select 'select ''-- This data was extracted on ''||to_char(sysdate,''mm/dd/yyyy hh24:mi'') from dual;' from dual;
-- Repeat the following two lines as many times as tables you want to extract
exec :retline:=ExtractData('dept');
print :retline;
exec :retline:=ExtractData('emp');
print :retline;
select 'spool off' from dual;
spool off
@c:\t1
-- STEP3: Run the spooled output c:\recreatedata.sql to recreate data.
Source:http://www.idevelopment.info/data/Oracle/DBA_tips/PL_SQL/PLSQL_5.shtml
</pre>Thanks Justin.
I get what you are saying,i really wanted to see the output of the codes, because the furtherst i could get from that code is
SELECT EXTRACTDATA('MYTABLE') FROM MYTABLE;
and it generated this:
"select 'insert into MYTABLE ('||chr(10)||'DATE1,'||chr(10)||'TIME1,'||chr(10)||'COUNTS) values ('||decode(DATE1,Null,'Null','to_date('''||to_char(DATE1,'mm/dd/yyyy hh24:mi')||''',''mm/dd/yyyy hh24:mi'')')||','||chr(10)||''||decode(TIME1,Null,'Null',TIME1)||','||chr(10)||''||decode(COUNTS,Null,'Null',COUNTS)||');' from MYTABLE;
select '-- commit;' from dual;"
"select 'insert into MYTABLE ('||chr(10)||'DATE1,'||chr(10)||'TIME1,'||chr(10)||'COUNTS) values ('||decode(DATE1,Null,'Null','to_date('''||to_char(DATE1,'mm/dd/yyyy hh24:mi')||''',''mm/dd/yyyy hh24:mi'')')||','||chr(10)||''||decode(TIME1,Null,'Null',TIME1)||','||chr(10)||''||decode(COUNTS,Null,'Null',COUNTS)||');' from MYTABLE;
select '-- commit;' from dual;"
"select 'insert into MYTABLE ('||chr(10)||'DATE1,'||chr(10)||'TIME1,'||chr(10)||'COUNTS) values ('||decode(DATE1,Null,'Null','to_date('''||to_char(DATE1,'mm/dd/yyyy hh24:mi')||''',''mm/dd/yyyy hh24:mi'')')||','||chr(10)||''||decode(TIME1,Null,'Null',TIME1)||','||chr(10)||''||decode(COUNTS,Null,'Null',COUNTS)||');' from MYTABLE;
select '-- commit;' from dual;"
"select 'insert into MYTABLE ('||chr(10)||'DATE1,'||chr(10)||'TIME1,'||chr(10)||'COUNTS) values ('||decode(DATE1,Null,'Null','to_date('''||to_char(DATE1,'mm/dd/yyyy hh24:mi')||''',''mm/dd/yyyy hh24:mi'')')||','||chr(10)||''||decode(TIME1,Null,'Null',TIME1)||','||chr(10)||''||decode(COUNTS,Null,'Null',COUNTS)||');' from MYTABLE;
select '-- commit;' from dual;"
"select 'insert into MYTABLE ('||chr(10)||'DATE1,'||chr(10)||'TIME1,'||chr(10)||'COUNTS) values ('||decode(DATE1,Null,'Null','to_date('''||to_char(DATE1,'mm/dd/yyyy hh24:mi')||''',''mm/dd/yyyy hh24:mi'')')||','||chr(10)||''||decode(TIME1,Null,'Null',TIME1)||','||chr(10)||''||decode(COUNTS,Null,'Null',COUNTS)||');' from MYTABLE;
select '-- commit;' from dual;"
"select 'insert into MYTABLE ('||chr(10)||'DATE1,'||chr(10)||'TIME1,'||chr(10)||'COUNTS) values ('||decode(DATE1,Null,'Null','to_date('''||to_char(DATE1,'mm/dd/yyyy hh24:mi')||''',''mm/dd/yyyy hh24:mi'')')||','||chr(10)||''||decode(TIME1,Null,'Null',TIME1)||','||chr(10)||''||decode(COUNTS,Null,'Null',COUNTS)||');' from MYTABLE;
select '-- commit;' from dual;"
I was expecting a string of
insert into mytable values (19/1/2009,1,1);
insert into mytable values (19/10/2008,5,10);
Thanks for the explanation . -
Insert statement taking time on oracle 10g
Hi,
My procedure taking time in following statement while database upgrading from oracle 9i to oracle 10g.
I m using oracle version 10.2.0.4.0.
cust_item is matiralize view in procedure and it is refreshing in the procedure
Index is dropping before inserting data into cust_item_tbl TABLE and after inserting data index is created.
There are almost 6 lac records into MV which are going to insert into TABLE.
In 9i below insert statement is taking 1 hr time to insert while in 10g it is taking 2.30 hrs.
EXECUTE IMMEDIATE 'ALTER SESSION ENABLE PARALLEL QUERY';
EXECUTE IMMEDIATE 'ALTER SESSION ENABLE PARALLEL DML';
INSERT INTO /*+ APPEND PARALLEL */ cust_item_tbl NOLOGGING
(SELECT /*+ PARALLEL */
ctry_code, co_code, srce_loc_nbr, srce_loc_type_code,
cust_nbr, item_nbr, lu_eff_dt,
0, 0, 0, lu_end_dt,
bus_seg_code, 0, rt_nbr, 0, '', 0, '', SYSDATE, '', SYSDATE,
'', 0, ' ',
case
when cust_nbr in (select distinct cust_nbr from aml.log_t where CTRY_CODE = p_country_code and co_code = p_company_code)
THEN
case
when trunc(sysdate) NOT BETWEEN trunc(lu_eff_dt) AND trunc(lu_end_dt)
then NVL((select cases_per_pallet from cust_item c where c.ctry_code = a.ctry_code and c.co_code = a.co_code
and c.cust_nbr = a.cust_nbr and c.GTIN_CO_PREFX = a.GTIN_CO_PREFX and c.GTIN_ITEM_REF_NBR = a.GTIN_ITEM_REF_NBR
and c.GTIN_CK_DIGIT = a.GTIN_CK_DIGIT and trunc(sysdate) BETWEEN trunc(c.lu_eff_dt) AND trunc(c.lu_end_dt) and rownum = 1),
a.cases_per_pallet)
else cases_per_pallet
end
else cases_per_pallet
END cases_per_pallet,
cases_per_layer
FROM cust_item a
WHERE a.ctry_code = p_country_code ----varible passing by procedure
AND a.co_code = p_company_code ----varible passing by procedure
AND a.ROWID =
(SELECT MAX (b.ROWID)
FROM cust_item b
WHERE b.ctry_code = a.ctry_code
AND b.co_code = a.co_code
AND b.ctry_code = p_country_code ----varible passing by procedure
AND b.co_code = p_company_code ----varible passing by procedure
AND b.srce_loc_nbr = a.srce_loc_nbr
AND b.srce_loc_type_code = a.srce_loc_type_code
AND b.cust_nbr = a.cust_nbr
AND b.item_nbr = a.item_nbr
AND b.lu_eff_dt = a.lu_eff_dt));explain plan of oracle 10g
Plan
INSERT STATEMENT CHOOSECost: 133,310 Bytes: 248 Cardinality: 1
5 FILTER
4 HASH GROUP BY Cost: 133,310 Bytes: 248 Cardinality: 1
3 HASH JOIN Cost: 132,424 Bytes: 1,273,090,640 Cardinality: 5,133,430
1 INDEX FAST FULL SCAN INDEX MFIPROCESS.INDX_TEMP_CUST_AUTH_PERF_MV Cost: 10,026 Bytes: 554,410,440 Cardinality: 5,133,430
2 MAT_VIEW ACCESS FULL MAT_VIEW MFIPROCESS.TEMP_CUST_AUTH_PERF_MV Cost: 24,570 Bytes: 718,680,200 Cardinality: 5,133,430 can you please look into the issue?
Thanks.According to the execution plan you posted parallelism is not taking place - no parallel operations listed
Check the hint syntax. In particular, "PARALLEL" does not look right.
Running queries in parallel can either help performance, hurt performance, or do nothing for performance. In your case a parallel index scan on MFIPROCESS.INDX_TEMP_CUST_AUTH_PERF_MV using the PARALLEL_INDEX hint and the PARALLEL hint specifying the table for MAT_VIEW MFIPROCESS.TEMP_CUST_AUTH_PERF_MV Cost might help, something like (untested)
select /*+ PARALLEL_INDEX(INDX_TEMP_CST_AUTH_PERF_MV) PARALLEL(TEMP_CUST_AUTHPERF_MV) */Is query rewrite causing the MVs to be read? If so hinting the query will be tricky -
Convert the insert statement of an MS SQL server into an oracle statement
Hi ,
The insert statement in the ms sql server is
INSERT INTO #temp EXEC Procedurename @Id OUTPUT
where table temp
CREATE TABLE #temp(
Id varchar(10),
FNa varchar(40),
LNa varchar(40),
SId varchar(20),
Aid varchar(20),
Did varchar(20),
CCNa varchar(255),
CCId int,
ISu char(1),
IA char(1),
Dir char(1),
Ema varchar(60),
St char(2),
DId char(3)
I converted the insert statement like this
Procedurename(Id);
LOOP
FETCH cv_1 INTO v_temp;
EXIT WHEN cv_1%NOTFOUND;
INSERT INTO TEMP VALUES v_temp;
END LOOP;
CLOSE cv_1;
But i am receiving PL/SQL: ORA-00947: not enough values
Can anyone help on this?
Thanks1) Are you sure that you even need a temp table? Fetching all the rows from a cursor 1-by-1 and then inserting them into a temp table (I'm assuming the Oracle table TEMP is declared as a global temporary table) would seem rather unusual and most likely pointless. In Oracle, readers don't block writers, so there is generally no need to use temp tables to hold intermediate results.
2) If you do need to store a set of results into a table, it's going to be more efficient to do this in a single SQL statement rather than using a cursor. Something like
INSERT INTO my_table ( <<list of columns>> )
SELECT <<list of columns>>
FROM <<other tables>>
WHERE <<some conditions>>The SELECT part of the statement here is likely whatever SQL you use in declaring the cursor.
Justin -
INSERT Statement behind a FORM on a TABLE with REPORT
When I create a form on a table with report, I'm sure an INSERT STATEMENT is genereated in the background somewhere. How can I see this insert statement or how can I get to this INSERT statement? If I can see it, would I be able to modify this INSERT statement?
Please use simple terms.
Thanks.Roel
At first, i was just curious to see where that insert statement is and how it looks like.
Later, I really wanted to see it because I wanted to know how it looks like whne I try to insert a one to many relationship record. Don't know if I'm being too clear on this.
Lets say table A and B have a 1-to-many relationship. When I want to insert records into both A and B, how does the insert work? Maybe if I get an answer to this question, I may understand how the inserts are done on a 1 to many relationship data insert.
Thanks. -
Run or display the output in Oracle developer form runtime web
Hi guys,
I have installed oracle forms10g in windows 7. im using firefox v.2. when i run the form, the Oracle developer form runtime web is not opening. the output is display in the mozilla firefox itself.
but how to run or display the output in Oracle developer form runtime web?
Thanks in advanceWhat's the problem? What do you mean with the form, the Oracle developer form runtime web is not opening and the output is display in the mozilla firefox itself?
Is the Form open or not? If you see you form, where ever, then the "runtime" is running!
Is it displays within the browser window? But you expected it in an own window?
If that's the case you have to set separateFrame = TRUE in fomsweb.cfg. -
Creating Form Manually w/Process that Contains Multiple Insert Statements
Hello,
I've been trying to create a form manually by following the instructions in the Users Manual under "Creating Form Manually - Creating a Process that Contains One or More Insert Statements." I have not had much luck and I think that it is because I'm not sure what is ment when said:
"Create a conditional process of type PL/SQL that executes when the user clicks the button."
Here is the PL/SQL that I used:
BEGIN
UPDATE T
SET first_name = :P1_FIRST_NAME,
last_name = :P1_LAST_NAME
WHERE ID = :P1_ID;
END;
I am not sure where to create this process,however. I've tried several areas (i.e. Processes under Page Processing, Processes under Page Rendering, Under Conditions on the Button, etc.) but will get errors or no effect at all.
Please let me know what i am doing wrong. If you could provide me with a simple example of how to create a form manually, that would be greatly appreciated.
Thanks.
Linda
Message was edited by:
lhudakHello Scott,
I followed your instructions and the error that I get is that nothing happens at all. I submit the page and nothing gets updated, deleted or added.
I have the table, report, processes and form in place. Here are the settings:
Process Point: is "on-submit, after computations...(in the Page Processing Section)
Type: PL/SQL anonymous block
Source: BEGIN
INSERT INTO T ( first_name, last_name )
VALUES (:P1_FIRST_NAME, :P1_LAST_NAME);
END;
Conditional Processing: When Button Pressed (Create (ADD))
For the Button:
Database Action: SQL Insert action
URL Redirect: No Target
Should I have any special settings on the Page Item? (i.e. under Default: Default Value Type: PL/SQL Expression) or maybe under Conditions: Condition Type - PL/SQL?
Please let me know.
Thanks
Linda
Maybe you are looking for
-
How do I create a PDF Form in Pages
I am trying to work out how I can create a questionnaire in Pages with drop down boxes that converts to a PDF form for my clients to complete. At present I am using Serif on my Windows Laptop but would like to use the Mac to do this. The aim is that
-
Hi, just wondering if anyone knew how i can change the color of a bubble in the flex bubble chart when the mouse moves over? thanks
-
Removing credit card number from my account
How do I remove my credit card number from my account. My son who is 8 lost his iPod touch or gave it away and I would like to cancel my account so that my credit card is not charged for any apps.
-
Using Sun Traffic manager in SC
Dear Gurus Is there any specfic requirement using Sun traffic Manager in Sun cluster i am using Sun cluster 3.1 on Solaris 9 Regard
-
About Connection, ResultSet, Statement interfaces....
hi , Connection, ResultSet, Statement etc.. all are the interfaces. But when i am writing the codes like, Statement stmt= con.createStatement(); ResultSet rs= stmt.excuteQuery("select * from student_mst"); where con is the instance of Connection inte