RETURNING clause with WHERE
Hi friends,
Is there any way to restrict the values fetched using RETURNING caluse after an UPDATE?
For example, the following RETURNING caluse will fetch the new SALs of the DEPTs 10 and 20:
UPDATE EMP
SET SAL = SAL+100
WHERE DEPT IN (10,20)
RETURNING SAL BULK COLLECT INTO ARRAY_NEW_SAL;
Is it possible to fetch the new SALs of only DEPT 10? Anything like:
UPDATE EMP
SET SAL = SAL+100
WHERE DEPT IN (10,20)
RETURNING SAL BULK COLLECT INTO ARRAY_NEW_SAL WHERE DEPT = 10;
Edited by: 964559 on 30-May-2013 03:41
No, you can't.
The returning clause is used to return data from all the effected rows of the update. It's a part of PL/SQL, not SQL, so you cannot apply an SQL WHERE clause to it.
The RETURNING clause and the way you can use it are detailed in the documentation (what a surprise!)...
http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/returninginto_clause.htm#LNPLS01354
Similar Messages
-
Select clause with where part is needs 600 times longer to complete
Hello.
I have two select clauses one with where, which needs 120 seconds to complete and one without where, which completes in 0,3 seconds. I want to know why is that.
120 seconds
SELECT B.* FROM
(SELECT A.OLOG, MCL_ISPROTOCOLALLOWED('LMOD', 'MCLI', A.OPRG) ALLOWED FROM (SELECT DISTINCT OLOG, OPRG FROM FLOG WHERE FIRM = '001') A) B WHERE B.ALLOWED = '1' ORDER BY OLOG;0,3 seconds
SELECT B.* FROM
(SELECT A.OLOG, MCL_ISPROTOCOLALLOWED('LMOD', 'MCLI', A.OPRG) ALLOWED FROM (SELECT DISTINCT OLOG, OPRG FROM FLOG WHERE FIRM = '001') A) B ORDER BY OLOG;Table FLOG has arround 270000 records, but only 40 of them are distinct.
IsProtocolAllowed checks if user has a permision to view the record.
Thank you for your help.
Regards,
Borut Ojcinger
Edited by: 993896 on 14.3.2013 7:24Hi,
welcome to the forum.
Please read SQL and PL/SQL FAQ
If you have a performance issue have a look at SQL and PL/SQL FAQ
Additionally when you put some code or output please enclose it between two lines starting with {noformat}{noformat}
i.e.:
{noformat}{noformat}
SELECT ...
{noformat}{noformat}
Regards.
Al -
Using RETURNING clause with Execute Immediate
I wrote a query to update a table and return the column in to a nested table type variable using returning clause but its not working I am getting error like
ORA-06550: line 66, column 22:
PLS-00306: wrong number or types of arguments in call to '||'
ORA-06550: line 66, column 4:
PL/SQL: Statement ignored
I am getting error in following part of my query
|| 'RETURNING if_row_status bulk collect INTO '
|| v_if_row_status;
v_if_row_status is defined as -
TYPE v_count IS TABLE OF varchar2(50) INDEX BY BINARY_INTEGER;
v_if_row_status v_count;I am trying to update a table for diffrent column if they are null and want no of column updated for each column.
I wrote following query but I am not getting the correct output.
UPDATE
Temp_Bulk_Col_POC
SET if_row_status = 'VALIDATED',
if_row_processed_date = sysdate,
if_row_error_msg =
CASE
WHEN record_type IS NULL
THEN 'RECORD_TYPE is a required column and cannot be NULL'
WHEN source_system IS NULL
THEN 'SOURCE_SYSTEM is a required column and cannot be NULL'
WHEN record_company IS NULL
THEN 'RECORD_COMPANY is a required column and cannot be NULL'
WHEN record_system IS NULL
THEN 'RECORD_SYSTEM is a required column and cannot be NULL'
WHEN txn_flag IS NULL
THEN 'TXN_FLAG is a required column and cannot be NULL'
WHEN create_date IS NULL
THEN 'CREATE_DATE is a required column and cannot be NULL'
WHEN UPDATE_date IS NULL
THEN 'UPDATE_DATE is a required column and cannot be NULL'
WHEN source_customer_id IS NULL
THEN 'SOURCE_CUSTOMER_ID is a required column and cannot be NULL'
WHEN source_product_id IS NULL
THEN 'SOURCE_PRODUCT_ID is a required column and cannot be NULL'
WHEN az_product_id IS NULL
THEN 'AZ_PRODUCT_ID is a required column and cannot be NULL'
WHEN decile IS NULL
THEN 'DECILE is a required column and cannot be NULL'
END
WHERE if_row_status IS NULL
AND (record_type IS NULL
OR source_system IS NULL
OR record_company IS NULL
OR record_system IS NULL
OR txn_flag IS NULL
OR create_date IS NULL
OR UPDATE_date IS NULL
OR source_customer_id IS NULL
OR source_product_id IS NULL
OR az_product_id IS NULL
OR decile IS NULL)
RETURNING if_row_status,record_type,source_system,record_company,record_system,
txn_flag,create_date,UPDATE_date,source_customer_id,source_product_id,az_product_id,
decile
BULK COLLECT INTO
v_if_row_status,v_record_type,v_source_system,
v_record_company,v_record_system,v_txn_flag,v_create_date,v_UPDATE_date,
v_source_customer_id,v_source_product_id,v_az_product_id,v_decile;
its showing same number for all the column.
how I can collect based on the coulmn updated -
Hi All,
I was trying to use RETURNING CLAUSE into pl/sql process but it gives error as :-
"1 error has occurred
* ORA-06550: line 12, column 13: PL/SQL: ORA-00933: SQL command not properly ended ORA-06550: line 6, column 3: PL/SQL: SQL Statement ignored"
Pl/sql process contains code as below:-
DECLARE
vID VARCHAR2(20);
BEGIN
INSERT INTO STUDENT_INFORMATION (DOB, AGE, OTHER_DATE, OTHER_AGE)
SELECT TO_DATE(C1_C002, 'MM/DD/YYYY'), C1_C003, TO_DATE(C1_C004, 'MM/DD/YYYY'), C1_C005
FROM (SELECT C1.C002 C1_C002, C1.C003 C1_C003, C1.C004 C1_C004, C1.C005 C1_C005
FROM APEX_COLLECTIONS C1
WHERE C1.COLLECTION_NAME = 'INFORMATION'
AND C1.SEQ_ID = 1)
RETURNING ID INTO vID; // IF I REMOVE THIS LINE & AND THIS INSERT STATEMENT WITH SEMICOLON(;) IN THE ABOVE LINE THE CODE WORKS FINE
// BUT THAN THE I'M GETTING ERROR WITH THE NEXT INSERT STATEMENT
INSERT INTO STUDENT_INFORMATION_GRADE (ID, GRADE_DATE, GRADE_AGE)
SELECT vID, TO_DATE(C2_C002, 'MM/DD/YYYY'), C2_C003
FROM (SELECT C2.C002 C2_C002, C2.C003 C2_C003
FROM APEX_COLLECTIONS C2, APEX_COLLECTIONS C1
WHERE C2.COLLECTION_NAME = 'GRADE'
AND C1.COLLECTION_NAME = 'INFORMATION'
AND C1.SEQ_ID = C2.SEQ_ID
AND C1.SEQ_ID = 1);
INSERT INTO STUDENT_INFORMATION_RESULT (ID, FINAL_RESULT)
SELECT vID, C3_C002
FROM (SELECT C3.C002 C3_C002
FROM APEX_COLLECTIONS C3, APEX_COLLECTIONS C1
WHERE C3.COLLECTION_NAME = 'RESULT'
AND C1.COLLECTION_NAME = 'INFORMATION'
AND C1.SEQ_ID = C3.SEQ_ID
AND C1.SEQ_ID = 1);
END;
I have trying RETURNING CLAUSE with other pl/sql process something like this :-
DECLARE
vID VARCHAR2(20;
BEGIN
INSERT INTO ..... ()
VALUES ()
RETURNING ID INTO vID;
INSERT INTO ... (ID, ....)
VALUES (vID, ..........)
END;
the above code works well with no errors, but when I'm using RETURNING CLAUSE with COLLECTIONS it gives me error.
Can anybody help me out?
Thanks
DeepDeep:
You can perform the inserts in a cursor loop as followsfor x in (SELECT C1.C002 C1_C002, C1.C003 C1_C003, C1.C004 C1_C004, C1.C005 C1_C005
FROM APEX_COLLECTIONS C1
WHERE C1.COLLECTION_NAME = 'INFORMATION'
AND C1.SEQ_ID = 1)
loop
INSERT INTO STUDENT_INFORMATION (DOB, AGE, OTHER_DATE, OTHER_AGE)
values ( TO_DATE(x.C1_C002, 'MM/DD/YYYY'),x.C1_C003, TO_DATE(x.C1_C004, 'MM/DD/YYYY'),x.C1_C005)
RETURNING ID INTO vID;
end loop;Varad -
ORA-22816: unsupported feature with RETURNING clause
My database is: 10g 10.2.0.3.0
Sorry this is a little long but I need some help!
The insert is being done in PLSQL with SQL.
I am trying to Insert a row into a view the view has 3 Instead of triggers. (insert, update, delete)
I have looked up this error and have seen that you cannot use a RETURNING clause on view with INSTEAD OF triggers
because it is not supported?
My issue is, I cannot find any code around this view where a RETURNING clause is being used.
Does anyone have any idea what else this could be??
1. The trigger populates old and new values based on wether it is an insert update or delete,
and then calls a procedure to do the insert, update or delete.
2. Then calls another procedure that builds an XML string to pass into oracle queueing.
They are all new triggers and procedures I have written.
I searched for "RETURNING" in all other dependent objects for this view and could not find anything.
Thats why I was wondering if it could be anything else?
Another FYI. This whole procedure is actually on some other tables as well. It works fine with no issue on the tables.
It wasn't until I started testing the VIEW that I started getting this error.
I commented out the procedure calls and I still have an issue. I disabled the trigger and the issue went away.
Another FYI to make it more interesting, The instead of update and the instead of delete triggers on this view
work just fine with the package calls and everything. They are written exactly as the instead of insert trigger.
It is only the instead of insert trigger that it is getting this error.
Can someone help??? See Instead of Insert trigger below.
{CREATE OR REPLACE TRIGGER TRIIBTF97A
INSTEAD OF INSERT ON RTI_BUS_TA_FORM97A_VW
FOR EACH ROW
DECLARE
old_rec RTI_BUS_TA_FORM97A_VW%ROWTYPE;
new_rec RTI_BUS_TA_FORM97A_VW%ROWTYPE;
v_change_type VARCHAR2(8);
v_event_source VARCHAR2(20) := 'TRIIBTF97A';
BEGIN
-- only new values on inserts
new_rec.DOC_LOC_NBR := :new.DOC_LOC_NBR ;
new_rec.TRAN_ID := :new.TRAN_ID ;
new_rec.RPTD_ADJ_SUBTOT_AMT := :new.RPTD_ADJ_SUBTOT_AMT ;
new_rec.CALC_ADJ_SUBTOT_AMT := :new.CALC_ADJ_SUBTOT_AMT ;
new_rec.RPTD_ADJ_SUBTOT2_AMT := :new.RPTD_ADJ_SUBTOT2_AMT ;
new_rec.CALC_ADJ_SUBTOT2_AMT := :new.CALC_ADJ_SUBTOT2_AMT ;
new_rec.RPTD_AGI_PRENOL_AMT := :new.RPTD_AGI_PRENOL_AMT ;
new_rec.CALC_AGI_PRENOL_AMT := :new.CALC_AGI_PRENOL_AMT ;
new_rec.RPTD_BAL_DUE_AMT := :new.RPTD_BAL_DUE_AMT ;
new_rec.CALC_BAL_DUE_AMT := :new.CALC_BAL_DUE_AMT ;
new_rec.RPTD_CC_CRED_AMT := :new.RPTD_CC_CRED_AMT ;
new_rec.CALC_CC_CRED_AMT := :new.CALC_CC_CRED_AMT ;
new_rec.RPTD_CHAR_CONTRIB_AMT := :new.RPTD_CHAR_CONTRIB_AMT ;
new_rec.CALC_CHAR_CONTRIB_AMT := :new.CALC_CHAR_CONTRIB_AMT ;
new_rec.RPTD_DIV_DEDUC_AMT := :new.RPTD_DIV_DEDUC_AMT ;
new_rec.CALC_DIV_DEDUC_AMT := :new.CALC_DIV_DEDUC_AMT ;
new_rec.RPTD_EST_PMT_AMT := :new.RPTD_EST_PMT_AMT ;
new_rec.CALC_EST_PMT_AMT := :new.CALC_EST_PMT_AMT ;
new_rec.RPTD_EZ_EMP_CRED_AMT := :new.RPTD_EZ_EMP_CRED_AMT ;
new_rec.CALC_EZ_EMP_CRED_AMT := :new.CALC_EZ_EMP_CRED_AMT ;
new_rec.RPTD_FED_INCM_AMT := :new.RPTD_FED_INCM_AMT ;
new_rec.CALC_FED_INCM_AMT := :new.CALC_FED_INCM_AMT ;
new_rec.RPTD_FRGN_GROSS_UP_AMT := :new.RPTD_FRGN_GROSS_UP_AMT ;
new_rec.CALC_FRGN_GROSS_UP_AMT := :new.CALC_FRGN_GROSS_UP_AMT ;
new_rec.RPTD_LREPT_AMT := :new.RPTD_LREPT_AMT ;
new_rec.CALC_LREPT_AMT := :new.CALC_LREPT_AMT ;
new_rec.RPTD_HRSJT_AMT := :new.RPTD_HRSJT_AMT ;
new_rec.CALC_HRSJT_AMT := :new.CALC_HRSJT_AMT ;
new_rec.RPTD_RELST_TAX_AMT := :new.RPTD_RELST_TAX_AMT ;
new_rec.CALC_RELST_TAX_AMT := :new.CALC_RELST_TAX_AMT ;
new_rec.RPTD_GOVT_INT_AMT := :new.RPTD_GOVT_INT_AMT ;
new_rec.CALC_GOVT_INT_AMT := :new.CALC_GOVT_INT_AMT ;
new_rec.RPTD_IN_AGI1_AMT := :new.RPTD_IN_AGI1_AMT ;
new_rec.CALC_IN_AGI1_AMT := :new.CALC_IN_AGI1_AMT ;
new_rec.RPTD_LRSJT_AMT := :new.RPTD_LRSJT_AMT ;
new_rec.CALC_LRSJT_AMT := :new.CALC_LRSJT_AMT ;
new_rec.RPTD_IN_NOL_AMT := :new.RPTD_IN_NOL_AMT ;
new_rec.CALC_IN_NOL_AMT := :new.CALC_IN_NOL_AMT ;
new_rec.RPTD_INCM_SUBTOT_AMT := :new.RPTD_INCM_SUBTOT_AMT ;
new_rec.CALC_INCM_SUBTOT_AMT := :new.CALC_INCM_SUBTOT_AMT ;
new_rec.RPTD_INT_DUE_AMT := :new.RPTD_INT_DUE_AMT ;
new_rec.CALC_INT_DUE_AMT := :new.CALC_INT_DUE_AMT ;
new_rec.RPTD_IRECV_CRED_AMT := :new.RPTD_IRECV_CRED_AMT ;
new_rec.CALC_IRECV_CRED_AMT := :new.CALC_IRECV_CRED_AMT ;
new_rec.RPTD_LATE_PEN_AMT := :new.RPTD_LATE_PEN_AMT ;
new_rec.CALC_LATE_PEN_AMT := :new.CALC_LATE_PEN_AMT ;
new_rec.RPTD_LIC_CRED_AMT := :new.RPTD_LIC_CRED_AMT ;
new_rec.CALC_LIC_CRED_AMT := :new.CALC_LIC_CRED_AMT ;
new_rec.RPTD_MODIF_AMT := :new.RPTD_MODIF_AMT ;
new_rec.CALC_MODIF_AMT := :new.CALC_MODIF_AMT ;
new_rec.RPTD_NAC_CRED_AMT := :new.RPTD_NAC_CRED_AMT ;
new_rec.CALC_NAC_CRED_AMT := :new.CALC_NAC_CRED_AMT ;
new_rec.RPTD_NONBUS_DISTA_AMT := :new.RPTD_NONBUS_DISTA_AMT ;
new_rec.CALC_NONBUS_DISTA_AMT := :new.CALC_NONBUS_DISTA_AMT ;
new_rec.RPTD_LTOT_AMT := :new.RPTD_LTOT_AMT ;
new_rec.CALC_LTOT_AMT := :new.CALC_LTOT_AMT ;
new_rec.RPTD_OTH_ADJ_AMT := :new.RPTD_OTH_ADJ_AMT ;
new_rec.CALC_OTH_ADJ_AMT := :new.CALC_OTH_ADJ_AMT ;
new_rec.RPTD_OTH_CRED_AMT := :new.RPTD_OTH_CRED_AMT ;
new_rec.CALC_OTH_CRED_AMT := :new.CALC_OTH_CRED_AMT ;
new_rec.RPTD_OTH_PMT_AMT := :new.RPTD_OTH_PMT_AMT ;
new_rec.CALC_OTH_PMT_AMT := :new.CALC_OTH_PMT_AMT ;
new_rec.RPTD_OVERPMT_CRED_AMT := :new.RPTD_OVERPMT_CRED_AMT ;
new_rec.CALC_OVERPMT_CRED_AMT := :new.CALC_OVERPMT_CRED_AMT ;
new_rec.RPTD_PRIOR_EXT_PMT_AMT := :new.RPTD_PRIOR_EXT_PMT_AMT ;
new_rec.CALC_PRIOR_EXT_PMT_AMT := :new.CALC_PRIOR_EXT_PMT_AMT ;
new_rec.RPTD_HRNTX_AMT := :new.RPTD_HRNTX_AMT ;
new_rec.CALC_HRNTX_AMT := :new.CALC_HRNTX_AMT ;
new_rec.RPTD_LRNTX_AMT := :new.RPTD_LRNTX_AMT ;
new_rec.CALC_LRNTX_AMT := :new.CALC_LRNTX_AMT ;
new_rec.RPTD_REFUND_DUE_AMT := :new.RPTD_REFUND_DUE_AMT ;
new_rec.CALC_REFUND_DUE_AMT := :new.CALC_REFUND_DUE_AMT ;
new_rec.RPTD_RELST_PP_TAX_AMT := :new.RPTD_RELST_PP_TAX_AMT ;
new_rec.CALC_RELST_PP_TAX_AMT := :new.CALC_RELST_PP_TAX_AMT ;
new_rec.RPTD_STATE_TAX_AMT := :new.RPTD_STATE_TAX_AMT ;
new_rec.CALC_STATE_TAX_AMT := :new.CALC_STATE_TAX_AMT ;
new_rec.RPTD_SU_TAX_AMT := :new.RPTD_SU_TAX_AMT ;
new_rec.CALC_SU_TAX_AMT := :new.CALC_SU_TAX_AMT ;
new_rec.RPTD_HREPT_AMT := :new.RPTD_HREPT_AMT ;
new_rec.CALC_HREPT_AMT := :new.CALC_HREPT_AMT ;
new_rec.RPTD_SUPP_NI_TAX1_AMT := :new.RPTD_SUPP_NI_TAX1_AMT ;
new_rec.CALC_SUPP_NI_TAX1_AMT := :new.CALC_SUPP_NI_TAX1_AMT ;
new_rec.RPTD_TAX_BUS_INC_AMT := :new.RPTD_TAX_BUS_INC_AMT ;
new_rec.CALC_TAX_BUS_INC_AMT := :new.CALC_TAX_BUS_INC_AMT ;
new_rec.RPTD_TOT_REL_TAX_AMT := :new.RPTD_TOT_REL_TAX_AMT ;
new_rec.CALC_TOT_REL_TAX_AMT := :new.CALC_TOT_REL_TAX_AMT ;
new_rec.RPTD_TAX_SUBTOT_AMT := :new.RPTD_TAX_SUBTOT_AMT ;
new_rec.CALC_TAX_SUBTOT_AMT := :new.CALC_TAX_SUBTOT_AMT ;
new_rec.RPTD_TCSP_CRED_AMT := :new.RPTD_TCSP_CRED_AMT ;
new_rec.CALC_TCSP_CRED_AMT := :new.CALC_TCSP_CRED_AMT ;
new_rec.RPTD_TOT_CRED_AMT := :new.RPTD_TOT_CRED_AMT ;
new_rec.CALC_TOT_CRED_AMT := :new.CALC_TOT_CRED_AMT ;
new_rec.RPTD_TOT_DUE_AMT := :new.RPTD_TOT_DUE_AMT ;
new_rec.CALC_TOT_DUE_AMT := :new.CALC_TOT_DUE_AMT ;
new_rec.RPTD_TOT_OVERPMT_AMT := :new.RPTD_TOT_OVERPMT_AMT ;
new_rec.CALC_TOT_OVERPMT_AMT := :new.CALC_TOT_OVERPMT_AMT ;
new_rec.RPTD_TOT_PMT_AMT := :new.RPTD_TOT_PMT_AMT ;
new_rec.CALC_TOT_PMT_AMT := :new.CALC_TOT_PMT_AMT ;
new_rec.RPTD_HTOT_AMT := :new.RPTD_HTOT_AMT ;
new_rec.CALC_HTOT_AMT := :new.CALC_HTOT_AMT ;
new_rec.RPTD_TAX_DUE_AMT := :new.RPTD_TAX_DUE_AMT ;
new_rec.CALC_TAX_DUE_AMT := :new.CALC_TAX_DUE_AMT ;
new_rec.RPTD_TAX_DUE2_AMT := :new.RPTD_TAX_DUE2_AMT ;
new_rec.CALC_TAX_DUE2_AMT := :new.CALC_TAX_DUE2_AMT ;
new_rec.RPTD_UNDERPMT_PEN_AMT := :new.RPTD_UNDERPMT_PEN_AMT ;
new_rec.CALC_UNDERPMT_PEN_AMT := :new.CALC_UNDERPMT_PEN_AMT ;
new_rec.RFND_1_INT_RATE := :new.RFND_1_INT_RATE ;
new_rec.RFND_1_AMT := :new.RFND_1_AMT ;
new_rec.RFND_2_INT_RATE := :new.RFND_2_INT_RATE ;
new_rec.RFND_2_AMT := :new.RFND_2_AMT ;
new_rec.RFND_3_INT_RATE := :new.RFND_3_INT_RATE ;
new_rec.RFND_3_AMT := :new.RFND_3_AMT ;
new_rec.RFND_4_INT_RATE := :new.RFND_4_INT_RATE ;
new_rec.RFND_4_AMT := :new.RFND_4_AMT ;
new_rec.RPTD_HRAMT_AMT := :new.RPTD_HRAMT_AMT ;
new_rec.CALC_HRAMT_AMT := :new.CALC_HRAMT_AMT ;
new_rec.RPTD_LRAMT_AMT := :new.RPTD_LRAMT_AMT ;
new_rec.CALC_LRAMT_AMT := :new.CALC_LRAMT_AMT ;
new_rec.RPTD_CMBTX_AMT := :new.RPTD_CMBTX_AMT ;
new_rec.CALC_CMBTX_AMT := :new.CALC_CMBTX_AMT ;
new_rec.RPTD_HRSUB_AMT := :new.RPTD_HRSUB_AMT ;
new_rec.CALC_HRSUB_AMT := :new.CALC_HRSUB_AMT ;
new_rec.RPTD_LRSUB_AMT := :new.RPTD_LRSUB_AMT ;
new_rec.CALC_LRSUB_AMT := :new.CALC_LRSUB_AMT ;
new_rec.RPTD_FUEL_CRED_AMT := :new.RPTD_FUEL_CRED_AMT ;
new_rec.CALC_FUEL_CRED_AMT := :new.CALC_FUEL_CRED_AMT ;
new_rec.RPTD_ADJUST_AMT := :new.RPTD_ADJUST_AMT ;
new_rec.CALC_ADJUST_AMT := :new.CALC_ADJUST_AMT ;
new_rec.RPTD_CARRY_YR_NBR := :new.RPTD_CARRY_YR_NBR ;
new_rec.CALC_CARRY_YR_NBR := :new.CALC_CARRY_YR_NBR ;
new_rec.RPTD_APPORT_PCNT := :new.RPTD_APPORT_PCNT ;
new_rec.CALC_APPORT_PCNT := :new.CALC_APPORT_PCNT ;
new_rec.RPTD_IN_APPORT_AMT := :new.RPTD_IN_APPORT_AMT ;
new_rec.CALC_IN_APPORT_AMT := :new.CALC_IN_APPORT_AMT ;
new_rec.RPTD_AGI_TAX_AMT := :new.RPTD_AGI_TAX_AMT ;
new_rec.CALC_AGI_TAX_AMT := :new.CALC_AGI_TAX_AMT ;
new_rec.RPTD_NONBUS_DISTB_AMT := :new.RPTD_NONBUS_DISTB_AMT ;
new_rec.CALC_NONBUS_DISTB_AMT := :new.CALC_NONBUS_DISTB_AMT ;
new_rec.RPTD_TOT_INC_AMT := :new.RPTD_TOT_INC_AMT ;
new_rec.CALC_TOT_INC_AMT := :new.CALC_TOT_INC_AMT ;
new_rec.REMIT_AMT := :new.REMIT_AMT ;
new_rec.RFND_1_DT := :new.RFND_1_DT ;
new_rec.PPIS_NAME := :new.PPIS_NAME ;
new_rec.RFND_2_DT := :new.RFND_2_DT ;
new_rec.EXT_FILED_INDC := :new.EXT_FILED_INDC ;
new_rec.RFND_3_DT := :new.RFND_3_DT ;
new_rec.INIT_RET_INDC := :new.INIT_RET_INDC ;
new_rec.RFND_4_DT := :new.RFND_4_DT ;
new_rec.FINAL_RET_INDC := :new.FINAL_RET_INDC ;
new_rec.INT_PD_TO_DT := :new.INT_PD_TO_DT ;
new_rec.UNITARY_COMB_INDC := :new.UNITARY_COMB_INDC ;
new_rec.PPIS_ST_3_ADDR := :new.PPIS_ST_3_ADDR ;
new_rec.PPIS_ST_1_ADDR := :new.PPIS_ST_1_ADDR ;
new_rec.PPIS_CHK_BOX := :new.PPIS_CHK_BOX ;
new_rec.PPIS_PHN_NMBR := :new.PPIS_PHN_NMBR ;
new_rec.INTERNAL_ID := :new.INTERNAL_ID ;
new_rec.PPIS_ST_2_ADDR := :new.PPIS_ST_2_ADDR ;
new_rec.PPIS_CTRY_CD := :new.PPIS_CTRY_CD ;
new_rec.PPIS_CTY_ADDR := :new.PPIS_CTY_ADDR ;
new_rec.PPIS_CTRY_OLD := :new.PPIS_CTRY_OLD ;
new_rec.PPIS_STATE_CD := :new.PPIS_STATE_CD ;
new_rec.EXT_ATT_INDC := :new.EXT_ATT_INDC ;
new_rec.PPIS_ZIP := :new.PPIS_ZIP ;
new_rec.SCORP_INDC := :new.SCORP_INDC ;
new_rec.PPIS_ID := :new.PPIS_ID ;
new_rec.PPIS_ID_TP_CD := :new.PPIS_ID_TP_CD ;
new_rec.APPORT_METHOD_CD := :new.APPORT_METHOD_CD ;
new_rec.INS_CO_INDC := :new.INS_CO_INDC ;
new_rec.PER_BEGIN_DT := :new.PER_BEGIN_DT ;
new_rec.PER_END_DT := :new.PER_END_DT ;
new_rec.FORM_DT := :new.FORM_DT ;
new_rec.FORM_TYPE_ID := :new.FORM_TYPE_ID ;
new_rec.NOL_CARRYBACK_CD := :new.NOL_CARRYBACK_CD ;
new_rec.FARM_COOP_INDC := :new.FARM_COOP_INDC ;
new_rec.ADD_DT := :new.ADD_DT ;
new_rec.ADD_ID := :new.ADD_ID ;
new_rec.UPD_DT := :new.UPD_DT ;
new_rec.UPD_ID := :new.UPD_ID ;
new_rec.VENDOR_CD := :new.VENDOR_CD ;
new_rec.RPTD_HLTHINSASN_CR_AMT := :new.RPTD_HLTHINSASN_CR_AMT ;
new_rec.CALC_HLTHINSASN_CR_AMT := :new.CALC_HLTHINSASN_CR_AMT ;
new_rec.RPTD_GIT_FINAL_AMT := :new.RPTD_GIT_FINAL_AMT ;
new_rec.CALC_GIT_FINAL_AMT := :new.CALC_GIT_FINAL_AMT ;
new_rec.FISCAL_YR_CD := :new.FISCAL_YR_CD ;
new_rec.RPTD_BONUS_DEPR_AMT := :new.RPTD_BONUS_DEPR_AMT ;
new_rec.CALC_BONUS_DEPR_AMT := :new.CALC_BONUS_DEPR_AMT ;
new_rec.RPTD_PREV_CRYFWD_AMT := :new.RPTD_PREV_CRYFWD_AMT ;
new_rec.CALC_PREV_CRYFWD_AMT := :new.CALC_PREV_CRYFWD_AMT ;
new_rec.RPTD_DOM_PROD_DED_AMT := :new.RPTD_DOM_PROD_DED_AMT ;
new_rec.CALC_DOM_PROD_DED_AMT := :new.CALC_DOM_PROD_DED_AMT ;
new_rec.RPTD_XS_IRC_DED_AMT := :new.RPTD_XS_IRC_DED_AMT ;
new_rec.CALC_XS_IRC_DED_AMT := :new.CALC_XS_IRC_DED_AMT ;
new_rec.RPTD_COAL_CR_AMT := :new.RPTD_COAL_CR_AMT ;
new_rec.CALC_COAL_CR_AMT := :new.CALC_COAL_CR_AMT ;
new_rec.SCHD_M_INDC := :new.SCHD_M_INDC ;
new_rec.INTANG_EXP_INDC := :new.INTANG_EXP_INDC ;
new_rec.RPTD_INTANGEXP_ADJ_AMT := :new.RPTD_INTANGEXP_ADJ_AMT ;
new_rec.CALC_INTANGEXP_ADJ_AMT := :new.CALC_INTANGEXP_ADJ_AMT ;
new_rec.AGIT_CONSOL_INDC := :new.AGIT_CONSOL_INDC ;
new_rec.INCRP_DT := :new.INCRP_DT ;
new_rec.INCRP_STATE_CD := :new.INCRP_STATE_CD ;
new_rec.COMMERCIAL_ST_CD := :new.COMMERCIAL_ST_CD ;
new_rec.INIT_IN_RTN_YR := :new.INIT_IN_RTN_YR ;
new_rec.REC_LOC_ADDR := :new.REC_LOC_ADDR ;
new_rec.EST_TAX_OTH_FID_INDC := :new.EST_TAX_OTH_FID_INDC ;
new_rec.FED_1120_CONSOL_INDC := :new.FED_1120_CONSOL_INDC ;
new_rec.UNTRY_MTRL_CHG_INDC := :new.UNTRY_MTRL_CHG_INDC ;
new_rec.FED_ELEC_CONF_NBRV := :new.FED_ELEC_CONF_NBRV ;
new_rec.RTN_SRC_CD := :new.RTN_SRC_CD ;
new_rec.BANKRPT_INDC := :new.BANKRPT_INDC ;
new_rec.FIT_FILER_INDC := :new.FIT_FILER_INDC ;
new_rec.NAME_CHG_INDC := :new.NAME_CHG_INDC ;
new_rec.REMIC_INDC := :new.REMIC_INDC ;
new_rec.INPUT_SRC_METH_CD := :new.INPUT_SRC_METH_CD ;
new_rec.ANNULZN_INDC := :new.ANNULZN_INDC ;
new_rec.RPTD_REIT_DIV_DED_AMT := :new.RPTD_REIT_DIV_DED_AMT ;
new_rec.CALC_REIT_DIV_DED_AMT := :new.CALC_REIT_DIV_DED_AMT ;
new_rec.RPTD_PAT_INCM_AMT := :new.RPTD_PAT_INCM_AMT ;
new_rec.CALC_PAT_INCM_AMT := :new.CALC_PAT_INCM_AMT ;
new_rec.RPTD_MDA_PROD_CR_AMT := :new.RPTD_MDA_PROD_CR_AMT ;
new_rec.CALC_MDA_PROD_CR_AMT := :new.CALC_MDA_PROD_CR_AMT ;
IF inserting THEN
v_change_type := 'INSERT';
ELSIF updating THEN
v_change_type := 'UPDATE';
ELSIF deleting THEN
v_change_type := 'DELETE';
END IF;
--call to do base table insert, update or delete
RSDGP004.bus_ta_form_97A(in_event_user => user,
in_event_source => v_event_source,
in_change_type => v_change_type,
in_old_rec => old_rec,
in_new_rec => new_rec);
-- call to build xml for rti_table_audits and queues --xdbaud
RSDGP001.bus_ta_form_97A(in_event_user => user,
in_event_source => v_event_source,
in_change_type => v_change_type,
in_old_rec => old_rec,
in_new_rec => new_rec);
END;}
Edited by: SDL on Feb 17, 2009 4:54 AM
Edited by: SDL on Feb 17, 2009 5:09 AM
Edited by: SDL on Feb 17, 2009 5:14 AMHere is the insert code that is in the package RSDGP004 that does the insert into the base table for the view.
I think maybe this is what you meant, when you asked for the code that does the insert?
{ELSIF in_change_type = 'INSERT' THEN
levent := 'INSERT';
INSERT INTO rti_bus_ta_forms(
add_dt
, add_id
, tran_id
, doc_loc_nbr
, field_009_amt
, field_01_txt
, field_010_amt
, field_015_amt
, field_016_amt
, field_02_txt
, field_029_amt
, field_03_txt
, field_030_amt
, field_039_amt
, field_04_txt
, field_040_amt
, field_041_amt
, field_042_amt
, field_05_txt
, field_053_amt
, field_054_amt
, field_06_txt
, field_063_amt
, field_064_amt
, field_067_amt
, field_068_amt
, field_07_txt
, field_079_amt
, field_08_txt
, field_080_amt
, field_085_amt
, field_086_amt
, field_09_txt
, field_091_amt
, field_092_amt
, field_095_amt
, field_096_amt
, field_10_txt
, field_101_amt
, field_102_amt
, field_103_amt
, field_104_amt
, field_105_amt
, field_106_amt
, field_11_txt
, field_111_amt
, field_112_amt
, field_12_txt
, field_125_amt
, field_126_amt
, field_127_amt
, field_128_amt
, field_13_txt
, field_131_amt
, field_132_amt
, field_137_amt
, field_138_amt
, field_139_amt
, field_14_txt
, field_140_amt
, field_141_amt
, field_142_amt
, field_143_amt
, field_144_amt
, field_147_amt
, field_148_amt
, field_149_amt
, field_15_txt
, field_150_amt
, field_151_amt
, field_152_amt
, field_153_amt
, field_154_amt
, field_16_txt
, field_165_amt
, field_166_amt
, field_167_amt
, field_168_amt
, field_169_amt
, field_170_amt
, field_171_amt
, field_172_amt
, field_181_amt
, field_182_amt
, field_175_amt
, field_176_amt
, field_177_amt
, field_178_amt
, field_179_amt
, field_180_amt
, field_193_amt
, field_194_amt
, field_195_amt
, field_196_amt
, field_197_amt
, field_198_amt
, field_199_amt
, per_begin_dt
, per_end_dt
, form_dt
, form_type_id
, field_31_txt
, field_201_amt
, upd_dt
, upd_id
, field_27_txt
, field_006_amt
, field_007_amt
, field_008_amt
, field_005_amt
, field_21_txt
, field_22_txt
, field_23_txt
, field_020_amt
, field_021_amt
, field_022_amt
, field_023_amt
, field_024_amt
, field_025_amt
, field_026_amt
, field_027_amt
, field_028_amt
, field_031_amt
, field_183_amt
, field_184_amt
, field_034_amt
, field_035_amt
, field_036_amt
, field_191_amt
, field_192_amt
, field_188_amt
, field_189_amt
, field_17_txt
, field_18_txt
, field_33_txt
, field_19_txt
, field_39_txt
, field_20_txt
, field_185_amt
, field_186_amt
, field_24_txt )
VALUES(
in_new_rec.ADD_DT,
in_new_rec.ADD_ID,
in_new_rec.TRAN_ID,
in_new_rec.DOC_LOC_NBR,
in_new_rec.RPTD_BAL_DUE_AMT,
in_new_rec.EXT_ATT_INDC,
in_new_rec.CALC_BAL_DUE_AMT,
in_new_rec.RPTD_REL_TAX_AMT,
in_new_rec.CALC_REL_TAX_AMT,
in_new_rec.EXT_FILED_INDC,
in_new_rec.RPTD_EST_PMT_AMT,
in_new_rec.PPIS_CTRY_CD,
in_new_rec.CALC_EST_PMT_AMT,
in_new_rec.RPTD_HRAMT_AMT,
in_new_rec.PPIS_ST_3_ADDR,
in_new_rec.CALC_HRAMT_AMT,
in_new_rec.RPTD_CMBTX_AMT,
in_new_rec.CALC_CMBTX_AMT,
in_new_rec.INTERNAL_ID,
in_new_rec.RPTD_LTOT_AMT,
in_new_rec.CALC_LTOT_AMT,
in_new_rec.PPIS_ID,
in_new_rec.RPTD_INT_DUE_AMT,
in_new_rec.CALC_INT_DUE_AMT,
in_new_rec.RPTD_LATE_PEN_AMT,
in_new_rec.CALC_LATE_PEN_AMT,
in_new_rec.PPIS_ID_TP_CD,
in_new_rec.RPTD_HRNTX_AMT,
in_new_rec.PPIS_NAME,
in_new_rec.CALC_HRNTX_AMT,
in_new_rec.RPTD_OTH_PMT_AMT,
in_new_rec.CALC_OTH_PMT_AMT,
in_new_rec.PPIS_ST_1_ADDR,
in_new_rec.RPTD_OVERPMT_CRED_AMT,
in_new_rec.CALC_OVERPMT_CRED_AMT,
in_new_rec.RPTD_PRIOR_EXT_PMT_AMT,
in_new_rec.CALC_PRIOR_EXT_PMT_AMT,
in_new_rec.PPIS_ST_2_ADDR,
in_new_rec.RPTD_HREPT_AMT,
in_new_rec.CALC_HREPT_AMT,
in_new_rec.RPTD_HRSUB_AMT,
in_new_rec.CALC_HRSUB_AMT,
in_new_rec.RPTD_REFUND_DUE_AMT,
in_new_rec.CALC_REFUND_DUE_AMT,
in_new_rec.PPIS_CTY_ADDR,
in_new_rec.RPTD_RENT_AMT,
in_new_rec.CALC_RENT_AMT,
in_new_rec.PPIS_STATE_CD,
in_new_rec.RPTD_SU_TAX_AMT,
in_new_rec.CALC_SU_TAX_AMT,
in_new_rec.RPTD_HRSJT_AMT,
in_new_rec.CALC_HRSJT_AMT,
in_new_rec.PPIS_ZIP,
in_new_rec.RPTD_SUPP_NI_TAX1_AMT,
in_new_rec.CALC_SUPP_NI_TAX1_AMT,
in_new_rec.RPTD_TAX_DUE_AMT,
in_new_rec.CALC_TAX_DUE_AMT,
in_new_rec.RPTD_TOT_DUE_AMT,
in_new_rec.PPIS_PHN_NMBR,
in_new_rec.CALC_TOT_DUE_AMT,
in_new_rec.RPTD_TOT_OVERPMT_AMT,
in_new_rec.CALC_TOT_OVERPMT_AMT,
in_new_rec.RPTD_TOT_PMT_AMT,
in_new_rec.CALC_TOT_PMT_AMT,
in_new_rec.RPTD_TOT_REL_TAX_AMT,
in_new_rec.CALC_TOT_REL_TAX_AMT,
in_new_rec.RPTD_UNDERPMT_PEN_AMT,
in_new_rec.PPIS_CHK_BOX,
in_new_rec.CALC_UNDERPMT_PEN_AMT,
in_new_rec.RPTD_HTOT_AMT,
in_new_rec.CALC_HTOT_AMT,
in_new_rec.RPTD_HRBAL_AMT,
in_new_rec.CALC_HRBAL_AMT,
in_new_rec.PPIS_CTRY_OLD,
in_new_rec.RPTD_LRNTX_AMT,
in_new_rec.CALC_LRNTX_AMT,
in_new_rec.RPTD_LRBAL_AMT,
in_new_rec.CALC_LRBAL_AMT,
in_new_rec.RPTD_LREPT_AMT,
in_new_rec.CALC_LREPT_AMT,
in_new_rec.RPTD_LRSUB_AMT,
in_new_rec.CALC_LRSUB_AMT,
in_new_rec.RPTD_LRSJT_AMT,
in_new_rec.CALC_LRSJT_AMT,
in_new_rec.RPTD_LRAMT_AMT,
in_new_rec.CALC_LRAMT_AMT,
in_new_rec.RPTD_AGI_TAX_AMT,
in_new_rec.CALC_AGI_TAX_AMT,
in_new_rec.RPTD_TOT_UNREL_TAX_AMT,
in_new_rec.CALC_TOT_UNREL_TAX_AMT,
in_new_rec.RPTD_GI_TAX_AMT,
in_new_rec.CALC_GI_TAX_AMT,
in_new_rec.RPTD_TAX_DUE2_AMT,
in_new_rec.CALC_TAX_DUE2_AMT,
in_new_rec.RPTD_TOT_URL_AMT,
in_new_rec.CALC_TOT_URL_AMT,
in_new_rec.REMIT_AMT,
in_new_rec.PER_BEGIN_DT,
in_new_rec.PER_END_DT,
in_new_rec.FORM_DT,
in_new_rec.FORM_TYPE_ID,
in_new_rec.NOL_CARRYBACK_CD,
in_new_rec.CALC_IN_NOL_AMT,
in_new_rec.UPD_DT,
in_new_rec.UPD_ID,
in_new_rec.VENDOR_CD,
in_new_rec.RPTD_PREV_CRYFWD_AMT,
in_new_rec.CALC_PREV_CRYFWD_AMT,
in_new_rec.RPTD_TOT_CRED_AMT,
in_new_rec.CALC_TOT_CRED_AMT,
in_new_rec.FISCAL_YR_CD,
in_new_rec.INIT_RET_INDC,
in_new_rec.FINAL_RET_INDC,
in_new_rec.RPTD_FED_INCM_AMT,
in_new_rec.CALC_FED_INCM_AMT,
in_new_rec.RPTD_BONUS_DEPR_AMT,
in_new_rec.CALC_BONUS_DEPR_AMT,
in_new_rec.RPTD_SPF_DEDUCT_AMT,
in_new_rec.CALC_SPF_DEDUCT_AMT,
in_new_rec.RPTD_GOVT_INT_AMT,
in_new_rec.CALC_GOVT_INT_AMT,
in_new_rec.RPTD_URL_SUBTOT_AMT,
in_new_rec.CALC_URL_SUBTOT_AMT,
in_new_rec.RPTD_APPORT_PCNT,
in_new_rec.CALC_APPORT_PCNT,
in_new_rec.RPTD_IN_INCM_AMT,
in_new_rec.CALC_IN_INCM_AMT,
in_new_rec.RPTD_IN_NOL_AMT,
in_new_rec.RPTD_TOT_URL_INCM_AMT,
in_new_rec.CALC_TOT_URL_INCM_AMT,
in_new_rec.RPTD_TOT_MOD_AMT,
in_new_rec.CALC_TOT_MOD_AMT,
in_new_rec.SCHD_M_INDC,
in_new_rec.FED_ELEC_CONF_NBRV,
in_new_rec.RTN_SRC_CD,
in_new_rec.BANKRPT_INDC,
in_new_rec.NAME_CHG_INDC,
in_new_rec.INPUT_SRC_METH_CD,
in_new_rec.RPTD_PAT_INCM_AMT,
in_new_rec.CALC_PAT_INCM_AMT,
in_new_rec.ANNULZN_INDC) ;} -
Mysterious where clause with japanese
enviroment:
PL/SQL Develope, Version 7.1.0.1337, Windows XP Professional 5.1 Build 2600 (Service Pack 2)
Here is the problem, when i add a where clause with japanese, the data evaporated:
SQL> select * from ja_test;
EXECUTABLE_NAME DESCRIPTION
XX00MRP0411C 需要供給データ作成マネージャ
SQL> select * from ja_test j where j.description = '需要供給データ作成マネージャ';
EXECUTABLE_NAME DESCRIPTION
SQL>
thanks in advance!Thanks for replies and Sorry for my rashness, maybe the following
scripts could explain the problem more well. I create a table named
ja_test with two fields(EXECUTABLE_NAME and DESCRIPTION), both of the
type is varchar2, and there is only one record in the table,
but the DESCRIPTION contains JAPANESE characters, when i use a where
clause like this "where j.executable_name = 'XX00MRP0411C';", everything
seems work fine, but when the where clase include JAPANESE characters
like this "j.description = '需要供給データ作成マネージャ';", even if
the "j.description" is copied form database, no records returned:
SQL> select * from ja_test j where j.executable_name = 'XX00MRP0411C';
EXECUTABLE_NAME DESCRIPTION
XX00MRP0411C 需要供給データ作成マネージャ
SQL> select * from ja_test j where j.description = '需要供給データ作成マネージャ';
EXECUTABLE_NAME DESCRIPTION
SQL> desc ja_test;
Name Type Nullable Default Comments
EXECUTABLE_NAME VARCHAR2(30)
DESCRIPTION VARCHAR2(240) Y
SQL> -
How can I pass multiple condition in where clause with the join table?
Hi:
I need to collect several inputs at run time, and query the record according to the input.
How can I pass multiple conditions in where clause with the join table?
Thanks in advance for any help.
Regards,
TDIf you are using SQL-Plus or Reports you can use lexical parameters like:
SELECT * FROM emp &condition;
When you run the query it will ask for value of condition and you can enter what every you want. Here is a really fun query:
SELECT &columns FROM &tables &condition;
But if you are using Forms. Then you have to change the condition by SET_BLOCK_PROPERTY.
Best of luck! -
Export (expdp) with where clause
Hello Gurus,
I am trying to export with where clause. I am getting below error.
Here is my export command.
expdp "'/ as sysdba'" tables = USER1.TABLE1 directory=DATA_PUMP dumpfile=TABLE1.dmp logfile=TABLE1.log query= “USER1.TABLE1:where auditdate>'01-JAN-10'” Here is error
[keeth]DB1 /oracle/data_15/db1> DATA_PUMP dumpfile=TABLE1.dmp logfile=TABLE1.log query= USER1.TABLE1:where auditdate>'01-JAN-10' <
Export: Release 11.2.0.3.0 - Production on Tue Mar 26 03:03:26 2013
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "SYS"."SYS_EXPORT_TABLE_03": "/******** AS SYSDBA" tables=USER1.TABLE1 directory=DATA_PUMP dumpfile=TABLE1.dmp logfile=TABLE1.log query= USER1.TABLE1:where auditdate
Estimate in progress using BLOCKS method...
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 386 MB
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT
Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type TABLE_EXPORT/TABLE/TRIGGER
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
ORA-31693: Table data object "USER1"."TABLE1" failed to load/unload and is being skipped due to error:
ORA-00933: SQL command not properly ended
Master table "SYS"."SYS_EXPORT_TABLE_03" successfully loaded/unloaded
Dump file set for SYS.SYS_EXPORT_TABLE_03 is:
/oracle/data_15/db1/TABLE1.dmp
Job "SYS"."SYS_EXPORT_TABLE_03" completed with 1 error(s) at 03:03:58Version
SQL> select * from v$version;
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for IBM/AIX RISC System/6000: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - ProductionHello,
You should use parameter file.Another question i can see you are using 11g.Why don't you use data pump?.
Data Pump is faster and have more features and enhancement than regular imp and exp.
You can do the following:
sqlplus / as sysdba
Create directory DPUMP_DIR3 for 'Type here your os path that you want to export to';then touch a file:
touch par.txt
In this file type the following the following :
tables=schema.table_name
dumpfile=yourdump.dmp
DIRECTORY=DPUMP_DIR3
logfile=Your_logfile.log
QUERY =abs.texp:"where hiredate>'01-JAN-13' "then do the following
expdp username/password parfile='par.txt'
If you will import from Oracle 11g to version 10g then you have to addthe parameter "version=10" to the parameter file above
BR
Mohamed ELAzab
http://mohamedelazab.blogspot.com/ -
Outer Join with Where Clause in LTS
HI all,
I have a requirement like this in ANSI SQL:
select p1.product_id, p1.product_name, p2.product_group
from product p1 left outer join product_group p2 on p1.product_id = p2.product_id
and p2.product_group = 'NEW'
In Regular SQL:
select p1.product_id, p1.product_name, p2.product_group
from product p1, product_group p2
WHERE p1.product_id *= p2.product_id and p2.product_group = 'NEW'
In OBIEE, I am using a left outer join between these two in Logical table Source, and also, Gave
p2.product_group = 'NEW' in WHERE clause of LTS.
This doesn't seem to solve purpose.
Do you have any idea how to convert WHERE clause in physical query that OBIEE is generating to something like
product p1 left outer join product_group p2 on p1.product_id = p2.product_id AND p2.product_group = 'NEW'
I am using Version 10.1.3.4.1
Creating an Opaque view would be my last option though.Hello
I have read your post and the responses as well. and I understand that you have issues with the Outer Join with where Clause in LTS.
Try this solution which worked for me (using your example ) -
1. In the Physical Layer created a Complex join between PRODUCT and PRODUCT_GROUP tables and use this join relationship :
PRODUCT.PROD_ID = PRODUCT_GROUP.PROD_ID AND PRODUCT_GROUP.GROUP_NAME = 'MECHANICAL'
2. In the General Tab of PRODUCT table LTS add PRODUCT_GROUP table and select Join Type as Left Outer Join.
3. Check Consistency and make sure there are no errors .
when you run a request you should see the following query generated -
select distinct T26908.PROD_ID as c1,
T26908.PROD_NAME as c2,
T26912.GROUP_NAME as c3
from
PRODUCT T26908 left outer join PRODUCT_GROUP T26912 On T26908.PROD_ID = T26912.PROD_ID and T26912.GROUP_NAME = 'MECHANICAL'
order by c1, c2, c3
Hope this works for you. If it does please mark this response as 'Correct' .
Good Luck. -
Hii,
I have an issue with using where clause with time stamp. My requirement is to
select * from driver_on_policy
where last_change_datetime = '2001-03-06 19:00:06'
date is in this form 6/3/2001 7:00:06 PM
thnks
samIf you want to use '6/3/2001 7:00:06 PM', then
where last_change_datetime = to_timestamp('6/3/2001 7:00:06 PM','DD/MM/YYYY HH:MI:SS PM')If you can use a literal string in ANSI standard YYYY-MM-DD HH24:MI:SS format, then just
where last_change_datetime = timestamp '2001-03-06 19:00:06' (That 'DD/MM' might need to be switched around to 'MM/DD' if you are in America.)
Message was edited by:
William Robertson -
Merge with where clause after matched and unmatched
Hai,
Can anybody give me one example of merge statement with
where clause after matched condition and after the unmatched condition.
MERGE INTO V1 VV1
USING (SELECT A.CNO XXCNO, A.SUNITS XXSU, A.DDATE XXDD, XX.SUM_UNITS SUMMED
FROM V1 A,
(SELECT
SUM(SUNITS) SUM_UNITS FROM V1 B
GROUP BY CNO) c
WHERE
A.DDATE=0 AND A.SUNITS <>0 AND
A.ROWID=(SELECT MAX(ROWID) FROM V1 )) XX
ON (1=1)
WHEN MATCHED THEN UPDATE SET
VV1.SUNITS=XX.SUMMED
WHERE XX.XXDD=0
WHEN NOT MATCHED THEN INSERT
(VV1.CNO, VV1.SUNITS, VV1.SUNITS)
VALUES (XX.XXCNO, XX.XXSU, XX.XXDD)
WHERE XX.XXDD<>0
i am getting the error
WHERE XX.XXDD=0
ERROR at line 13:
ORA-00905: missing keyword
Thanks,
PalOne of the example is there:
http://download-west.oracle.com/docs/cd/B14117_01/server.101/b10759/statements_9016.htm#sthref7014
What Oracle version do you use ?
Besides the condition (1=1) is non-deterministic,
I would expect there an exception like "unable to get a stable set of rows".
Rgds. -
Hi,
Can we write Insert with 'Where' clause? I'm looking for something similar to the below one (which is giving me an error)
insert into PS_AUDIT_OUT (AUDIT_ID, EMPLID, RECNAME, FIELDNAME, MATCHVAL, ERRORMSG)
Values ('1','10000139','NAMES','FIRST_NAME',';','')
Where AUDIT_ID IN
( select AUDIT_ID from PS_AUDIT_FLD where AUDIT_ID ='1' and RECNAME ='NAMES'
AND FIELDNAME = 'FIRST_NAME' AND MATCHVAL = ';' );
Thanks
DuraiIt is not clear what are you trying to do, but it looks like:
insert
into PS_AUDIT_OUT(
AUDIT_ID,
EMPLID,
RECNAME,
FIELDNAME,
MATCHVAL,
ERRORMSG
select '1',
'10000139',
'NAMES',
'FIRST_NAME',
from PS_AUDIT_FLD
where AUDIT_ID = '1'
and RECNAME ='NAMES'
and FIELDNAME = 'FIRST_NAME'
and MATCHVAL = ';'
SY. -
Hierarchical query with where clause
Hi,
How can I query hierarchically a query with WHERE clause? I have a table with three fields session_id,id and root_id.
When I try with the following query,
select id, level from relation
where session_id = 79977
connect by prior id = root_id start with id = 5042;
It gets duplicate values.
I want the query to show in the hierarchical manner with a filter condition using WHERE clause. Please help me how can I achieve this. If you know any link that describes more about this, please send it.
Thanks in Advance.
Regards,
-ParmyHi Sridhar Murthy an others,
Thanks a lot for your/the answer. It's working for me. It saved a lot of other work around without the proper knowledge of hierarchical query. Please send me any link that describes these issues in detail and also I hope as I have mentioned in the other message, same cannot be achieved on views or ( on two different tables ???)
Any way thanks for your reply,
It's working for me.
With happiness,
-Parmy -
SQL query in SQL_REDO Logminor showing where clause with ROWID
SQL query in SQL_REDO Logminor showing where clause with ROWID. I dont wanted to use rowid but wanted to use actual value.
OPERATION SQL_REDO SQL_UNDO
DELETE delete from "OE"."ORDERS" insert into "OE"."ORDERS"
where "ORDER_ID" = '2413' ("ORDER_ID","ORDER_MODE",
and "ORDER_MODE" = 'direct' "CUSTOMER_ID","ORDER_STATUS",
and "CUSTOMER_ID" = '101' "ORDER_TOTAL","SALES_REP_ID",
and "ORDER_STATUS" = '5' "PROMOTION_ID")
and "ORDER_TOTAL" = '48552' values ('2413','direct','101',
and "SALES_REP_ID" = '161' '5','48552','161',NULL);
and "PROMOTION_ID" IS NULL
and ROWID = 'AAAHTCAABAAAZAPAAN';
DELETE delete from "OE"."ORDERS" insert into "OE"."ORDERS"
where "ORDER_ID" = '2430' ("ORDER_ID","ORDER_MODE",
and "ORDER_MODE" = 'direct' "CUSTOMER_ID","ORDER_STATUS",
and "CUSTOMER_ID" = '101' "ORDER_TOTAL","SALES_REP_ID",
and "ORDER_STATUS" = '8' "PROMOTION_ID")
and "ORDER_TOTAL" = '29669.9' values('2430','direct','101',
and "SALES_REP_ID" = '159' '8','29669.9','159',NULL);
and "PROMOTION_ID" IS NULL
and ROWID = 'AAAHTCAABAAAZAPAAe';
Please let me know solution/document which will convert SQL redo rowid value with actual value.
Thanks,Please enclose your output within tag so that people here can read it easily and help you. Also the reason that why you want to remove rowid?
Salman
Edited by: Salman Qureshi on Mar 20, 2013 3:53 PM -
Where clause with a combination of And and Or statements - Basic question
Hi,
I have a where clause with a combination of And and Or statements... May I know which one would run first
Here is the sample
WHERE SITE_NAME = 'Q' AND ET_NAME IN ('12', '15') AND TEST_DATE > DATE OR SITE_NAME = 'E' AND ET_NAME IN ('19', '20')
can you please explain how this combination works
Thanks in advanceHi,
This reminds me of a great story. It's so good, it probably didn't really happen, but it's so good, I'm going to repeat it anyway.
IBM once had an "executive apptitude test" that they would give to job applicants. There were some questions you might call general knowlege or trivia questions, and each question had a weight (for example, answering an unimportant queestion might score one point, an important question might be 5 points.) One of the questions was "What is the standard width of a mobile home?", and the weight of the question was -20: answering the question correctly did serious harm to your score. The reasoning was that the more you knew about mobile homes, the less likely you were to be their kind of executive.
Now, as to your question, the correct answer is: I don't know. I don't want to know. Mixing ANDs and ORs without grouping them in parentheses is a really bad idea. Even if you get it right, it's going to confuse the next person who has to look at that code. Use parentheses to make sure the code is doing what you want it to do.
If you really want to find out, it's documented in the SQL language manual. Look up "Operators, prcedence"
http://docs.oracle.com/cd/E11882_01/server.112/e26088/operators001.htm#sthref815
You can easily do an experiment, using scott.emp, or even dual, where
WHERE (x AND y)
OR zproduces different results from
WHERE x
AND (y OR z)
Maybe you are looking for
-
Using report generation toolkit and MS Word
How do I insert data using bookmarks, using an array output for my data source and match up the appropriate bookmark for each value of data? I know how to do it individually using append report text, but I would like to be able to do it from an array
-
My 2011 Macbook Pro OSX 10.8.4 latest update won't connect to secured Wi-fi
2011 Macbook Pro OSX 10.8.4 latest updates Suddenly stopped connecting to any wireless network which is secured, WEP/WPA/WPA2/personal/enterprise all do NOT work. Connects to unsecured networks just fine. For example, our wireless password is: 123456
-
Equipment Number Range Clarification
Hi, I have defined the below number range as Creation of Equiment Master (Txn. IE01) for Category Q / Z. AAA-0000-AAA ZZZ-9999-ZZZ During creation, I would like to change the number as like EDP15890UYT. Can I use the below user exit for the same. If
-
Hi, Last September I have cancelled my contract and paid cancellation fee. In the last two days mone has been taken from my account and it appears as: LNK BT PHONE, BRIG CD 7315 09JAN14ATM OWNER FEE 1.45 11.45£ LNK BT PHONE, BRIG CD 7315 10JAN14ATM
-
I have R/3 system and One is XI system. I need to send the idoc from R/3 to XI . Please let me know what are the intial setup and configuration I need to do in r/3 side , So that I can send the Idoc R/3 to XI and same XI to R/3. Please let m