Reference SQL Loader Bind Variables in the when Clause
Support for SQL: SQL * Loader: version 8.0.6.3.0 (don't ask, it runs on Oracle EBS 11i...)I have a case where my sample data looks like:
HD00100001002
SM00100002CHAPS 99999999999 20120906GBP0000000000001000000000001
and another fileHD00100001001
SM00100002GBP0000000000001000000000001
Essentially, I need to apply another "IN" clause for each record of SM depends on the ack_type (char 13 on HD recording), either 1 or 2I tried setting up the ack_type with a variable binding but find how to reference.
Example of control file:
-- $Header: test.ctl
--
LOAD DATA
REPLACE
-- Record Type HD : File Header
INTO TABLE test_table
WHEN rec_id_no = 'HD'
TRAILING NULLCOLS
(rec_no RECNUM,
hdr_line CONSTANT 'H',
rec_id_no POSITION(1:2) CHAR,
file_number POSITION(3:5) CHAR,
sequence_number POSITION(6:10) CHAR,
status POSITION(11:12) CHAR,
ack_type POSITION(13:13) ":ack_type",
co_id POSITION(14:21) CHAR,
dept_id POSITION(22:24) CHAR,
btch_no POSITION(25:36) CHAR,
trans_id POSITION(37:42) CHAR)
-- Record Type SM : File Summary
INTO TABLE test_table
WHEN rec_id_no = 'SM' and :ack_type = '1'
TRAILING NULLCOLS
(rec_no RECNUM,
hdr_line CONSTANT 'L',
rec_id_no POSITION(1:2) CHAR,
file_number POSITION(3:5) CHAR,
sequence_number POSITION(6:10) CHAR,
ccy_code POSITION(11:13) CHAR,
amount POSITION(14:26) CHAR,
number_trans_ok POSITION(27:40) CHAR)
The code above does not work, it is said that: ack_type is not recognized. Is there a way to do it, given the former character of the SQL Load version?
What is the database version 11i is running on? If 11 GR 2, this doc can help you in the use of the features that Dan mentions
How to use the 9i or 10g features in SQL * Loader for Apps? [423035.1 ID]
HTH
Srini
Tags: Database
Similar Questions
-
problem with bind variables in the SQL query view object
Hi all
I use JDev 11.1.2.4.0.
I have a problem with bind variables in the SQL query view object.
This is my original SQL
SELECT sum(t.TIME) , t.legertype_id FROM LEDGER t WHERE t.nctuser_id = '20022' AND to_char(t.insertdate,'YYYYMMDD') in ('20130930','20130929') group by t.legertype_id
In my view .xml object query tab, I am writing this
SELECT sum(t.TIME) , t.legertype_id FROM LEDGER t WHERE t.nctuser_id = '20022' AND to_char(t.insertdate,'YYYYMMDD') in :dddd group by t.legertype_id
Davis here is a variable of Type liaison: String, updatable and necessary.
I try to deal with Davis as ('20130930 ', ' 20130929') hoping the view object, run as my original SQL.
But failed. The view object retrieves 0 line after that I run.
Why?
Thank you! ('2original SQL0130930', '20130929') ('20130930 ', ' 20130929')
A variable binding cannot be used as this is why you must use years table. Check decompilation binary ADF: using oracle.jbo.domain.Array with ViewCriteria to see a solution.
Timo
-
PL/SQL using bind variable to delete records
Hello
I'm currently implementing PL/SQL using bind variables to remove records from the "item_progress" table in the simple join query where I'm passing itemName, itemLoc and orderLoc in the delete query in pl/sql block.
Please suggest, it should be easy for oracle experts...
(a) I need first records in the item_progress table by using the join query and then update of status in the renew_item table.
(b) it works fine if I use the simple removal with a condition that is ("DELETE from item_progress where itemname =: 1' using itemname1").
(c) but it gives an error when I run it using delete with join:
---------------------------------------
* Invalid relational operator ORA-00920:
ORA-06512: at "SE", line 14 (it's the deletion with the join... "DELETE FROM item_progress WHERE item_id IN (SELECT ip.item_id'...)" ....'
ORA-06512: at line 10
Process exited.*
---------------------------------------
create or replace PROCEDURE PUT (itemName IN VARCHAR2,
itemLoc IN VARCHAR2,
orderLoc IN VARCHAR2) is
itemName1 varchar2 (30);
itemLoc1 varchar2 (30);
orderLoc1 varchar2 (30);
BEGIN
orderLoc1: = ' C: test/local /';
itemLoc1: = ' / / L123/R;
itemName1: = 'AAA ';
immediate execution
"DELETE FROM item_progress WHERE item_id IN (SELECT ip.item_id FROM ip, item_order io item_progress WHERE io.orderlocation: = 1 AND ip.order_id io.order_id UNION SELECT item_id FROM item_progress WHERE ITEMLOCATION =: = 2) AND itemname: = 3' using orderloc1, itemloc1, itemname1;"
-"DELETE from item_progress where itemname =: 1' using itemname1; -IT WORKS FINE
-Once the above query is updated to success, the status in another table
-Renew_item update the Status value = "RENEWED" where ITEMNAME =: 1, ITEMLOCATION =: 2 using itemname1, itemloc1;
commit;
END OPERATIONS;user10828299 wrote:
Please suggest, it should be easy for oracle experts...You have made a typo. bind variables are preceded by two points, while you put a colon in front of the equality operator that he listens to it in the PL/SQL assignment operator. Change:
WHERE io.orderlocation : = 1
TO
IO.orderlocation WHERE =:1
Change:
WHERE ITEMLOCATION : = 2
TO:
WHERE ITEMLOCATION =:2
Change
AND itemname : = 3
TO:
AND itemname =:3
SY.
-
bind variables using the values in the collection
Hi the gems... Good afternoon...
Can we not use plsql values in the collection in the USING clause to pass the bind variable values...
I wrote the procedure to kill all sessions that cross the parameter OPEN_CURSORS below. the query, I found only three sessions that exceed. But when I execute my procedure so those are not removed, execution gives me an error also. He simply executed but no session has been killed.
My part of the code is as below:
However, when I replace the bind variable with the values in the collection, then it works:.......... .......... .......... OPEN rc FOR v_sql; FETCH rc BULK COLLECT INTO v_tt_sessions; LOOP EXIT WHEN v_tt_sessions.COUNT = 0; FOR idx IN 1 .. v_tt_sessions.COUNT LOOP EXECUTE IMMEDIATE 'alter system kill session '':a,:b'' immediate' USING v_tt_sessions(idx).sid, v_tt_sessions(idx).serial#; END LOOP; END LOOP; CLOSE rc; ......... .........
Please suggest if there is something wrong in my code first. I tried, but could not get any inadequacy........... .......... .......... OPEN rc FOR v_sql; FETCH rc BULK COLLECT INTO v_tt_sessions; LOOP EXIT WHEN v_tt_sessions.COUNT = 0; FOR idx IN 1 .. v_tt_sessions.COUNT LOOP EXECUTE IMMEDIATE 'alter system kill session '''||v_tt_sessions(idx).sid||','||v_tt_sessions(idx).serial#||''' immediate'; END LOOP; END LOOP; CLOSE rc; .......... ..........
But the doubt is when I removed the variable of liaison with the values of the collection hard-coded (in my first post), then this process works very well. But I want to use bind variables.
You cannot use bind variables in this situation. You can use bind variables for the DML statements.
I'm surprised that you have no error, but I guess that this block of code explains everything:EXCEPTION WHEN OTHERS THEN dbms_output.put_line(SQLCODE || ' : ' || SQLERRM);
You concatenate values to build a single command ALTER SYSTEM and run, just like your second attempt.
You don't need to have a dynamic cursor either.for r in ( select v.SID, u.serial#, count(v.sid) from v$open_cursor v, v$session u where v.CURSOR_TYPE='OPEN' and v.sid=u.sid group by v.sid, u.serial# having count(v.sid)>190 order by count(*) desc ) loop execute immediate 'alter system kill session '''||r.sid||','||r.serial#||''' immediate'; end loop;
And of course, I agree with the comments of Keith (assuming that this is not just an exercise).
Published by: odie_63 on October 16, 2012 14:03
-
SQL * Loader - can I specify the log file in the control file
SQL * Loader - can I specify the log file in the control file? If so howYes,
Try sqlldr "echo $command_line_par".
Note: ' back quotes
Kind regards
-
Bind variables in the SQL causes slow
We have a strange problem in our PeopleSoft system that I traced to a SELECT statement using bind variables, if hardcode us them values in SQL, it runs very fast.
but using bindings (what the application does) a problem of efficiency. I'm going to re - write the code that is based on a view of three tables joined to go against
the base tables and I don't think I'll have a problem. However, I would like to know why the problem exists in the first place. Here is what info I have:
Oracle version: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
It's the 'good' application without links:
And the 'good' explains the plan:SELECT COUNT(*) FROM sysadm.PS_ERN_PROG_DESCR A WHERE A.ERN_PROGRAM = 'VT' AND A.ERNCD = '01' AND EFFDT = (SELECT MAX(B.EFFDT) FROM sysadm.PS_ERN_PROG_DESCR B WHERE B.ERN_PROGRAM = 'VT' AND B.EFFDT <= TO_DATE('2009-10-10','YYYY-MM-DD') );
Here is the 'good' autotrace:Plan hash value: 3344976101 ------------------------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | ------------------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | 33 | 58 (23)| 00:00:01 | | 1 | SORT AGGREGATE | | 1 | 33 | | | | 2 | NESTED LOOPS | | 1 | 33 | 3 (0)| 00:00:01 | | 3 | NESTED LOOPS | | 1 | 22 | 2 (0)| 00:00:01 | |* 4 | INDEX UNIQUE SCAN | PS_ERN_PROGRAM_DEF | 1 | 12 | 1 (0)| 00:00:01 | | 5 | SORT AGGREGATE | | 1 | 9 | | | | 6 | VIEW | | 23 | 207 | 51 (26)| 00:00:01 | |* 7 | FILTER | | | | | | | 8 | SORT GROUP BY | | 23 | 1748 | 51 (26)| 00:00:01 | |* 9 | HASH JOIN | | 2995 | 222K| 49 (23)| 00:00:01 | |* 10 | TABLE ACCESS FULL | PS_EARNINGS_TBL | 1913 | 24869 | 15 (7)| 00:00:01 | |* 11 | HASH JOIN | | 13621 | 838K| 30 (20)| 00:00:01 | | 12 | TABLE ACCESS FULL | PS_EARNINGS_TBL | 1913 | 42086 | 14 (0)| 00:00:01 | |* 13 | HASH JOIN | | 3097 | 124K| 14 (29)| 00:00:01 | |* 14 | TABLE ACCESS BY INDEX ROWID| PS_ERN_PROGRAM_TBL | 9 | 207 | 2 (0)| 00:00:01 | |* 15 | INDEX RANGE SCAN | PS_ERN_PROGRAM_TBL | 18 | | 1 (0)| 00:00:01 | |* 16 | TABLE ACCESS FULL | PS_ERN_PROGRAM_DEF | 12035 | 211K| 10 (20)| 00:00:01 | |* 17 | INDEX RANGE SCAN | PS_EARNINGS_TBL | 1 | 10 | 1 (0)| 00:00:01 | | 18 | SORT AGGREGATE | | 1 | 10 | | | |* 19 | INDEX RANGE SCAN | PS_EARNINGS_TBL | 1 | 10 | 2 (0)| 00:00:01 | |* 20 | TABLE ACCESS BY INDEX ROWID | PS_ERN_PROGRAM_TBL | 1 | 11 | 1 (0)| 00:00:01 | |* 21 | INDEX UNIQUE SCAN | PS_ERN_PROGRAM_TBL | 1 | | 0 (0)| 00:00:01 | ------------------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 4 - access("A"."ERN_PROGRAM"='VT' AND "A"."EFFDT"= (SELECT MAX("$vm_col_2") FROM (SELECT /*+ */ "EFFDT" "$vm_col_1","A"."EFFDT" "$vm_col_2" FROM SYSADM."PS_EARNINGS_TBL" "C",SYSADM."PS_ERN_PROGRAM_TBL" "B",SYSADM."PS_ERN_PROGRAM_DEF" "A",SYSADM."PS_EARNINGS_TBL" "D" WHERE "D"."EFFDT"<="A"."EFFDT" AND "D"."ERNCD"="C"."ERNCD" AND "D"."EFFDT"<=TO_DATE(' 2009-10-10 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND "A"."EFFDT"="B"."EFFDT" AND "A"."ERN_PROGRAM"="B"."ERN_PROGRAM" AND "A"."ERN_PROGRAM"='VT' AND "A"."EFFDT"<=TO_DATE(' 2009-10-10 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND "B"."EFFDT"<=TO_DATE(' 2009-10-10 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND "B"."ERN_PROGRAM"='VT' AND "B"."EFF_STATUS"='A' AND "C"."ERNCD"="A"."ERNCD" GROUP BY "D"."ERNCD",ROWID,ROWID,ROWID,ROWID,"A"."EFFDT","EFFDT" HAVING "EFFDT"=MAX("D"."EFFDT")) "$vm_view") AND "A"."ERNCD"='01') 7 - filter("EFFDT"=MAX("D"."EFFDT")) 9 - access("D"."ERNCD"="C"."ERNCD") filter("D"."EFFDT"<="A"."EFFDT") 10 - filter("D"."EFFDT"<=TO_DATE(' 2009-10-10 00:00:00', 'syyyy-mm-dd hh24:mi:ss')) 11 - access("C"."ERNCD"="A"."ERNCD") 13 - access("A"."ERN_PROGRAM"="B"."ERN_PROGRAM" AND "A"."EFFDT"="B"."EFFDT") 14 - filter("B"."EFF_STATUS"='A') 15 - access("B"."ERN_PROGRAM"='VT' AND "B"."EFFDT"<=TO_DATE(' 2009-10-10 00:00:00', 'syyyy-mm-dd hh24:mi:ss')) 16 - filter("A"."ERN_PROGRAM"='VT' AND "A"."EFFDT"<=TO_DATE(' 2009-10-10 00:00:00', 'syyyy-mm-dd hh24:mi:ss')) 17 - access("C"."ERNCD"='01') filter(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))= (SELECT MAX(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))) FROM SYSADM."PS_EARNINGS_TBL" "D" WHERE SYS_OP_DESCEND("EFFDT") IS NOT NULL AND SYS_OP_DESCEND("EFFDT")>=SYS_OP_DESCEND(:B1) AND "D"."ERNCD"=:B2 AND SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))<=:B3)) 19 - access("D"."ERNCD"=:B1 AND SYS_OP_DESCEND("EFFDT")>=SYS_OP_DESCEND(:B2) AND SYS_OP_DESCEND("EFFDT") IS NOT NULL) filter(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))<=:B1) 20 - filter("B"."EFF_STATUS"='A') 21 - access("B"."ERN_PROGRAM"='VT' AND "A"."EFFDT"="B"."EFFDT")
===================================SQL> variable ppe_date varchar2(10) SQL> variable erncd varchar2(3) SQL> exec :ppe_date := '2009-10-10' SQL> exec :erncd := '01' SQL> SELECT COUNT(*) 2 FROM PS_ERN_PROG_DESCR A 3 WHERE A.ERN_PROGRAM = 'VT' 4 AND A.ERNCD = '01' 5 AND EFFDT = 6 (SELECT MAX(B.EFFDT) 7 FROM PS_ERN_PROG_DESCR B 8 WHERE B.ERN_PROGRAM = 'VT' 9 AND B.EFFDT <= TO_DATE('2009-10-10','YYYY-MM-DD') 10 ); COUNT(*) ---------- 1 Elapsed: 00:00:01.23 Execution Plan ---------------------------------------------------------- 0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=59 Card=1 Bytes=33) 1 0 SORT (AGGREGATE) 2 1 NESTED LOOPS (Cost=3 Card=1 Bytes=33) 3 2 NESTED LOOPS (Cost=2 Card=1 Bytes=22) 4 3 INDEX (UNIQUE SCAN) OF 'PS_ERN_PROGRAM_DEF' (INDEX (UNIQUE)) (Cost=1 Card=1 Bytes=12) 5 4 SORT (AGGREGATE) 6 5 VIEW (Cost=52 Card=24 Bytes=216) 7 6 FILTER 8 7 SORT (GROUP BY) (Cost=52 Card=24 Bytes=1824) 9 8 HASH JOIN (Cost=50 Card=3177 Bytes=241452) 10 9 TABLE ACCESS (FULL) OF 'PS_EARNINGS_TBL' (TABLE) (Cost=15 Card=1921 Bytes=24973) 11 9 HASH JOIN (Cost=31 Card=14488 Bytes=912744) 12 11 TABLE ACCESS (FULL) OF 'PS_EARNINGS_TBL' (TABLE) (Cost=14 Card=1921 Bytes=42262) 13 11 HASH JOIN (Cost=15 Card=3303 Bytes=135423) 14 13 TABLE ACCESS (FULL) OF 'PS_ERN_PROGRAM_TBL' (TABLE) (Cost=2 Card=9 Bytes=207) 15 13 TABLE ACCESS (FULL) OF 'PS_ERN_PROGRAM_DEF' (TABLE) (Cost=12 Card=12856 Bytes=231408) 16 3 INDEX (RANGE SCAN) OF 'PS_EARNINGS_TBL' (INDEX (UNIQUE)) (Cost=1 Card=1 Bytes=10) 17 16 SORT (AGGREGATE) 18 17 INDEX (RANGE SCAN) OF 'PS_EARNINGS_TBL' (INDEX (UNIQUE)) (Cost=2 Card=1 Bytes=10) 19 2 TABLE ACCESS (BY INDEX ROWID) OF 'PS_ERN_PROGRAM_TBL' (TABLE) (Cost=1 Card=1 Bytes=11) 20 19 INDEX (UNIQUE SCAN) OF 'PS_ERN_PROGRAM_TBL' (INDEX (UNIQUE)) (Cost=0 Card=1) Statistics ---------------------------------------------------------- 0 recursive calls 0 db block gets 182 consistent gets 0 physical reads 0 redo size 232 bytes sent via SQL*Net to client 278 bytes received via SQL*Net from client 2 SQL*Net roundtrips to/from client 1 sorts (memory) 0 sorts (disk) 1 rows processed SQL> spool off
This is the 'bad' query using bindings:
===================================
The 'bad' explain planSELECT COUNT(*) FROM sysadm.PS_ERN_PROG_DESCR A WHERE A.ERN_PROGRAM = 'VT' AND A.ERNCD = :erncd AND EFFDT = (SELECT MAX(B.EFFDT) FROM sysadm.PS_ERN_PROG_DESCR B WHERE B.ERN_PROGRAM = 'VT' AND B.EFFDT <= TO_DATE(:ppe_date,'YYYY-MM-DD') );
Here's the bad autotrace:explain plan succeeded. PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Plan hash value: 337039962 -------------------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | -------------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | 33 | 20 (25)| 00:00:01 | | 1 | SORT AGGREGATE | | 1 | 33 | | | | 2 | NESTED LOOPS | | 1 | 33 | 3 (0)| 00:00:01 | | 3 | NESTED LOOPS | | 1 | 22 | 2 (0)| 00:00:01 | |* 4 | INDEX UNIQUE SCAN | PS_ERN_PROGRAM_DEF | 1 | 12 | 1 (0)| 00:00:01 | | 5 | SORT AGGREGATE | | 1 | 63 | | | | 6 | NESTED LOOPS | | 1 | 63 | 13 (39)| 00:00:01 | | 7 | NESTED LOOPS | | 1 | 52 | 12 (42)| 00:00:01 | |* 8 | HASH JOIN | | 4 | 168 | 12 (42)| 00:00:01 | | 9 | VIEW | VW_SQ_1 | 88 | 2112 | 9 (45)| 00:00:01 | | 10 | SORT GROUP BY | | 88 | 2728 | 9 (45)| 00:00:01 | | 11 | MERGE JOIN | | 3087 | 95697 | 7 (29)| 00:00:01 | | 12 | SORT JOIN | | 643 | 11574 | 2 (0)| 00:00:01 | |* 13 | INDEX RANGE SCAN | PS_ERN_PROGRAM_DEF | 643 | 11574 | 2 (0)| 00:00:01 | |* 14 | SORT JOIN | | 96 | 1248 | 5 (40)| 00:00:01 | |* 15 | INDEX FAST FULL SCAN | PS_EARNINGS_TBL | 96 | 1248 | 4 (25)| 00:00:01 | |* 16 | INDEX RANGE SCAN | PS_ERN_PROGRAM_DEF | 643 | 11574 | 2 (0)| 00:00:01 | |* 17 | INDEX UNIQUE SCAN | PS_EARNINGS_TBL | 1 | 10 | 0 (0)| 00:00:01 | |* 18 | TABLE ACCESS BY INDEX ROWID| PS_ERN_PROGRAM_TBL | 1 | 11 | 1 (0)| 00:00:01 | |* 19 | INDEX UNIQUE SCAN | PS_ERN_PROGRAM_TBL | 1 | | 0 (0)| 00:00:01 | |* 20 | INDEX RANGE SCAN | PS_EARNINGS_TBL | 1 | 10 | 1 (0)| 00:00:01 | | 21 | SORT AGGREGATE | | 1 | 10 | | | |* 22 | INDEX RANGE SCAN | PS_EARNINGS_TBL | 1 | 10 | 2 (0)| 00:00:01 | |* 23 | TABLE ACCESS BY INDEX ROWID | PS_ERN_PROGRAM_TBL | 1 | 11 | 1 (0)| 00:00:01 | |* 24 | INDEX UNIQUE SCAN | PS_ERN_PROGRAM_TBL | 1 | | 0 (0)| 00:00:01 | -------------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 4 - access("A"."ERN_PROGRAM"='VT' AND "A"."EFFDT"= (SELECT MAX("A"."EFFDT") FROM SYSADM."PS_EARNINGS_TBL" "C",SYSADM."PS_ERN_PROGRAM_TBL" "B",SYSADM."PS_ERN_PROGRAM_DEF" "A", (SELECT MAX(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))) "VW_COL_1","D"."ERNCD" "ERNCD",ROWID "ROWID" FROM SYSADM."PS_EARNINGS_TBL" "D","PS_ERN_PROGRAM_DEF" "A" WHERE "A"."EFFDT"<=TO_DATE(:PPE_DATE,'YYYY-MM-DD') AND "A"."ERN_PROGRAM"='VT' AND SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))<=INTERNAL_FUNCTION("A"."EFFDT") AND SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))<=TO_DATE(:PPE_DATE,'YYYY-MM-DD') GROUP BY "D"."ERNCD",ROWID) "VW_SQ_1" WHERE "ROWID"=ROWID AND "A"."EFFDT"<=TO_DATE(:PPE_DATE,'YYYY-MM-DD') AND "A"."ERN_PROGRAM"='VT' AND "A"."EFFDT"="B"."EFFDT" AND "B"."ERN_PROGRAM"='VT' AND "B"."EFF_STATUS"='A' AND "B"."EFFDT"<=TO_DATE(:PPE_DATE,'YYYY-MM-DD') AND SYS_OP_DESCEND("EFFDT")=SYS_OP_DESCEND("VW_COL_1") AND "ERNCD"="C"."ERNCD" AND "C"."ERNCD"="A"."ERNCD" AND SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))="VW_COL_1") AND "A"."ERNCD"=:ERNCD) 8 - access("ROWID"=ROWID) 13 - access("A"."ERN_PROGRAM"='VT' AND "A"."EFFDT"<=TO_DATE(:PPE_DATE,'YYYY-MM-DD')) 14 - access(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))<=INTERNAL_FUNCTION("A"."EFFDT")) filter(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))<=INTERNAL_FUNCTION("A"."EFFDT")) 15 - filter(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))<=TO_DATE(:PPE_DATE,'YYYY-MM-DD')) 16 - access("A"."ERN_PROGRAM"='VT' AND "A"."EFFDT"<=TO_DATE(:PPE_DATE,'YYYY-MM-DD')) 17 - access("ERNCD"="C"."ERNCD" AND SYS_OP_DESCEND("EFFDT")=SYS_OP_DESCEND("VW_COL_1")) filter("C"."ERNCD"="A"."ERNCD" AND SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))="VW_COL_1") 18 - filter("B"."EFF_STATUS"='A') 19 - access("B"."ERN_PROGRAM"='VT' AND "A"."EFFDT"="B"."EFFDT") filter("B"."EFFDT"<=TO_DATE(:PPE_DATE,'YYYY-MM-DD')) 20 - access("C"."ERNCD"=:ERNCD) filter(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))= (SELECT MAX(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))) FROM SYSADM."PS_EARNINGS_TBL" "D" WHERE SYS_OP_DESCEND("EFFDT") IS NOT NULL AND SYS_OP_DESCEND("EFFDT")>=SYS_OP_DESCEND(:B1) AND "D"."ERNCD"=:B2 AND SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))<=:B3)) 22 - access("D"."ERNCD"=:B1 AND SYS_OP_DESCEND("EFFDT")>=SYS_OP_DESCEND(:B2) AND SYS_OP_DESCEND("EFFDT") IS NOT NULL) filter(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))<=:B1) 23 - filter("B"."EFF_STATUS"='A') 24 - access("B"."ERN_PROGRAM"='VT' AND "A"."EFFDT"="B"."EFFDT")
SQL> variable ppe_date varchar2(10) SQL> variable erncd varchar2(3) SQL> exec :ppe_date := '2009-10-10' SQL> exec :erncd := '01' SQL> SELECT COUNT(*) 2 FROM PS_ERN_PROG_DESCR A 3 WHERE A.ERN_PROGRAM = 'VT' 4 AND A.ERNCD = :erncd 5 AND EFFDT = 6 (SELECT MAX(B.EFFDT) 7 FROM PS_ERN_PROG_DESCR B 8 WHERE B.ERN_PROGRAM = 'VT' 9 AND B.EFFDT <= TO_DATE(:ppe_date,'YYYY-MM-DD') 10 ); COUNT(*) ---------- 1 Elapsed: 00:04:07.40 Execution Plan ---------------------------------------------------------- 0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=20 Card=1 Bytes=33) 1 0 SORT (AGGREGATE) 2 1 NESTED LOOPS (Cost=3 Card=1 Bytes=33) 3 2 NESTED LOOPS (Cost=2 Card=1 Bytes=22) 4 3 INDEX (UNIQUE SCAN) OF 'PS_ERN_PROGRAM_DEF' (INDEX (UNIQUE)) (Cost=1 Card=1 Bytes=12) 5 4 SORT (AGGREGATE) 6 5 NESTED LOOPS (Cost=13 Card=1 Bytes=63) 7 6 NESTED LOOPS (Cost=12 Card=1 Bytes=52) 8 7 HASH JOIN (Cost=12 Card=4 Bytes=168) 9 8 VIEW OF 'VW_SQ_1' (VIEW) (Cost=9 Card=88 Bytes=2112) 10 9 SORT (GROUP BY) (Cost=9 Card=88 Bytes=2728) 11 10 MERGE JOIN (Cost=7 Card=3087 Bytes=95697) 12 11 SORT (JOIN) (Cost=2 Card=643 Bytes=11574) 13 12 INDEX (RANGE SCAN) OF 'PS_ERN_PROGRAM_DEF' (INDEX (UNIQUE)) (Cost=2 Card=643 Bytes=11574) 14 11 SORT (JOIN) (Cost=5 Card=96 Bytes=1248) 15 14 INDEX (FAST FULL SCAN) OF 'PS_EARNINGS_TBL' (INDEX (UNIQUE)) (Cost=4 Card=96 Bytes=1248) 16 8 INDEX (RANGE SCAN) OF 'PS_ERN_PROGRAM_DEF' (INDEX (UNIQUE)) (Cost=2 Card=643 Bytes=11574) 17 7 INDEX (UNIQUE SCAN) OF 'PS_EARNINGS_TBL' (INDEX (UNIQUE)) (Cost=0 Card=1 Bytes=10) 18 6 TABLE ACCESS (BY INDEX ROWID) OF 'PS_ERN_PROGRAM_TBL' (TABLE) (Cost=1 Card=1 Bytes=11) 19 18 INDEX (UNIQUE SCAN) OF 'PS_ERN_PROGRAM_TBL' (INDEX (UNIQUE)) (Cost=0 Card=1) 20 3 INDEX (RANGE SCAN) OF 'PS_EARNINGS_TBL' (INDEX (UNIQUE)) (Cost=1 Card=1 Bytes=10) 21 20 SORT (AGGREGATE) 22 21 INDEX (RANGE SCAN) OF 'PS_EARNINGS_TBL' (INDEX (UNIQUE)) (Cost=2 Card=1 Bytes=10) 23 2 TABLE ACCESS (BY INDEX ROWID) OF 'PS_ERN_PROGRAM_TBL' (TABLE) (Cost=1 Card=1 Bytes=11) 24 23 INDEX (UNIQUE SCAN) OF 'PS_ERN_PROGRAM_TBL' (INDEX (UNIQUE)) (Cost=0 Card=1) Statistics ---------------------------------------------------------- 3820 recursive calls 66 db block gets 4677728 consistent gets 80608 physical reads 0 redo size 232 bytes sent via SQL*Net to client 278 bytes received via SQL*Net from client 2 SQL*Net roundtrips to/from client 2 sorts (memory) 1 sorts (disk) 1 rows processed SQL> spool off
I think you have to hit some sort of bug in the optimizer. Do you have the histograms on the EFFDT column.
-
When I go from ODP.NET to the ODP.NET managed some of my questions begins to throw errors missing bind variable.
I reproduced with a simple example that uses a variable called liaison: unitName
It's the example SQL:
SELECT
: unitName
Of
DOUBLE
Now, if I add a comment at the beginning of the SQL like this:
-Text with: unitName
SELECT
: unitName
Of
DOUBLE
It works, but if I have a variable binding in a comment that is located on a number of the 'same' line, I get ORA-01006:
This causes the error:
-First line comment
-Text with: unitName
SELECT
: unitName
Of
DOUBLE
Kind regards
-Tommy
I was able to reproduce this problem. I filed Bug 19433348 on your behalf.
The circumstances in which the bug occurs are fairly easy to get around.
(1) remove the colon in the second commented line.
(2) add a space between the '\n' and ' - '.
If you are one of those things, you won't encounter the bug behavior.
-
Use of bind variables in the repository
All,
Our client has a requirement that they need the sales this year of sales vs. last year passing year as a guest.
I can't use BI built in function to get early start or this year last year because our calendar dates are not standard. So I have to this day of dim query table to see e.g. for whats 2010 is the start date and so on...
To do this, I created a variable repository to hold these values using SQL. I want to know is can I use a binding to this SQL variable so that when the user passes year I can feed that year in this SQL and it will provide me with correct start and the end date for this year and last year.
Thanks in advanceYes. We can pass a value to what the user selects the guest. To do this you have create a session variable with "enable any user to set the value". Prompt properties for the year column choose "Ask the Variable" for whole Variable. And the use of content filtering year = ' valueof (NQ_SESSION.myVariable).
Let me know if it worked.
Kind regards
Jay -
SQL and shared Variable communication failure when you run an .exe application
Salvation OR engineers,
I'm faced with a problem. I have already tried almost everything under my bottom to solve, but I just couldn't get over it.
I have a VI on my PC accessing a SQL database via the connection string and some share of variables in a server. Both shared variables and the SQL database are on the same server. There is a firewall between this server and my PC and the server is located in a DMZ environment.
Design Labview environment, everything works fine. Even when I run the .exe on this computer file, everything works fine. But, when I created an application and install it on another computer, it just doesn't work.
I'm using Labview 2013.
Someone of you can help me with this bug?
Thanks in advance!
Hello world
Back to share with you the solution:
The problem was with the "SQL Native Client". Windows 7 doesn't have it as a default installation, if the application could not find the OLE DB provider for ODBC drivers. After installation, the connection has been established.
As the server was within a demilitarized zone, I had to open some specific ports as follows:
UDP/1434
TCP / / 2343,49163
59110-59115
In fact, I have not experienced problems with the OAS. The error was generated when you try to connect to the database and sent to the rest of the code through the cluster of the error.
Thanks for the support!
Best regards to everyone.
Luiz
-
Bind Variables on the view objects child definition
JDeveloper 12 c
I have an interesting question. I have a view (AisWebModulePrivsVO) object that uses a bindvariable hardcoded in the view object.
SELECT * FROM SYS. DBA_ROLE_PRIVS where DEALER =: bvUserName
If I put this in the request module I can programmatically set the variable binding (view object contains the getter/setter for the binding variable).
AisWebModulePrivsVOImpl voTest = am.getAisWebModulePrivsVI ();
voTest.setbvUserName ("ARAWLS");
voTest.executeQuery ();
System.out.println ("test reports:" + voTest.getRowCount ());
and get the correct number of records based on return on the user and database roles. If it works.
What does NOT work, it is when this display object is a recording of 'the child' to another display object (as specified by a link between the two and by setting the object from a point of view as one child of the other in the module of the application).
AppModule looks like this:
CgRefCodesVO
AisWebModulePrivsVO
In this case, I have a view called cgRefCodeVO parent object. There is a link between this and the AisWebModulePrivsVO. The relationship works.
AISMenuAppModuleImpl m = ADFUtils.getApplicationModuleForDataControl (appMod) (AISMenuAppModuleImpl);
CgRefCodesVOImpl cgRefVO = am.getCgRefCodes1 ();
AisWebModulePrivsVOImpl modsVO = am.getAisWebModulePrivs1 ();
modsVO.setbvDBUserName ("ARAWLS"); This doesn't seem to work here...
cgRefVO.executeQuery ();
All lines rs = cgRefVO.getRowSet ();
RS. Reset();
While (rs.hasNext ()) {}
CgRefCodesVORowImpl CgRefRow = rs.next ((CgRefCodesVORowImpl));
System.out.println ("RvLowValue:" + CgRefRow.getAttribute ("RvLowValue"));
RowIterator aisModulesRowIter = CgRefRow.getAisWebModulePrivs ();
System.out.println ("number of children:" + aisModulesRowIter.getRowCount ());
}
The code compiles and runs. She translates: "County of the child: 0" for each row returned by the
I also tried:
VM VariableValueManager = modsVO.ensureVariableManager ();
vm.setVariableValue ("bvDBUserName", "ARAWLS");
And:
modsVO.setNamedWhereClauseParam ("bvDBUserName", "ARAWLS");
and (of ( )
@Override
protected void executeQueryForCollection (Object, object, Object [] object2, int i) {}
I coded everything hard to see if it would work.
setNamedWhereClauseParam ("bvDBUserName", "ARAWLS");
super.executeQueryForCollection (object, object2, i);
}
and from there, I changed around the order to execute the objects in view.
How can I set the variable binding in the object view child?
Thank you
Stuart
It is an interesting example how ADF works up to a certain point... then you need to start to make cuts to modify its behavior as you wish.
I decided that it was just easier to delete 'the child' parent (in the app module) and create a view of criteria on this subject for what would basically query the records to get the same results, like a child.
Perhaps not as elegant, but so much easier.
Thanks for your help.
Stuart
-
SQL Loader in error after the modified table
Hello
"I had a column in the table that was initially defined as VARCHAR2 (250), I changed the table and made 1000, when the data is over 250 characters sql loader is in error"
Field in the data file exceeds the maximum length. The table shows the field in VARCHAR2 (1000). Help, please.
Thank you
Gwenaël
I changed the table again to make VARCHAR2 (4000) and still have the error. My data are about 350 characters. Help, please
Change to the column sqlldr control file and explicitly set tank (4000). The default data in sqlldr type is char (255).
-
Hi all
I have a view object with a query that uses a variable binding. I drag the data on my .jsf page control to create a table. I create a query method on a bean in sight. The query method uses the content of one of the attributes of the bean to set the link for the query variable:
vo.setNamedWhereClauseParam ("CraIdBindVar", sessionBean.getCraId ());
I put a button on the page that calls the method of the request and it fills the table. That's fine, but I don't want the user to have to click the "query" button when browsing this page. I found forums dealing with create an AMImpl.jave method, create a link on the page, create an executable file for the link. It works that the method is executed until the page appears. However, the AMImpl method cannot call sessionBean.getCraid () to obtain the data required to complete the binding variable.
Is it possible to run my method of view range bean before the page is displayed? Or maybe a way for the AMImpl.java method to access the range of view variable?
Thank you, SteveSteve,
You can drag a call method on the workflow activity. Select the new method call activity, and open the property inspector. Here you choose your bean method in the method property. Now, first of all, you go to this activity of method call, then the page.Timo
-
Procedure of the ODI - Bind Variables in the conditional statements
In an ODI procedure, is it possible to add a conditional statement around bind variable? For example, if I use OdiOutFile as the command on the target and Oracle as the command on the Source, I can use bind variables to fill the data in this table (we are in fact using OdiInvokeWebService and passing a XML structure very complex, but it's easier for testing):
OdiOutFile-FILE = C: / TEST. TXT
< person >
< first > #FIRSTNAME < / first >
< Middle > #MIDDLENAME < / Middle >
< last > #LASTNAME < / last >
< / person >
It is a way to add a conditional statement using one of these bind variables? For example, if I wanted to test #MIDDLENAME null and null value, produced this portion of XML, such as:
OdiOutFile-FILE = C: / TEST. TXT
< person >
< first > #FIRSTNAME < / first >
< % if (#MIDDLENAME! = null) {% >}
< Middle > #MIDDLENAME < / Middle >
< %} % >
< last > #LASTNAME < / last >
< / person >
This type of scriptlet syntax seems to work fine, as long as the binding variable is not in the mix (if I put "true is true" or "true == false" in the case, it shows or does not show this line in the XML file, as expected). I use ODI 11.1.1.7.0
----------------------
Post edited by: KevinPratt
Thanks for the reply! As suggested, in what follows, I changed the command and it works as you want
OdiOutFile-FILE = C: / TEST. TXT-APPEND
< person >
< first > #FIRSTNAME < / first >
< @ if (!) (("#MIDDLENAME".equals(""))) {@ >}
< Middle > #MIDDLENAME < / Middle >
{< @} @ >
< last > #LASTNAME < / last >
< / person >
Using the syntax <@ ...="" @="">serve your purpose. Also, I think you might want to include the variable binding in the quotation to avoid syntax errors.
@>
-
The use of bind variables in the application process
Bind variables refer to elements of session state supported in queries in an application request process?
All the examples I see show how to pass client side values using the $v () function and the htmldb_get object addParam method and refer to them using the wwv_flow.g_xNN variables, but already available in session state values, I should be able to use them directly in the process, right?
Thank youYes, they are supported.
Denes Kubicek
-------------------------------------------------------------------
http://deneskubicek.blogspot.com/
http://www.Opal-consulting.de/training
http://Apex.Oracle.com/pls/OTN/f?p=31517:1
http://www.Amazon.de/Oracle-Apex-XE-Praxis/DP/3826655494
------------------------------------------------------------------- -
Hello
Could you please comment on this syntax, step by step, please:
'%' || : SEARCH_STRING. '%'
I need to know what it does and why are these characters: '%' and |
Thank you very much in advance...Hello
SEARCH_STRING is variable defined at the page or application level and is "%" padding for the SQL LIKE operator where you say something like finding any name that has 'SAM' in it.
WHERE NAME LIKE '%SAM%'
In order to build this dynamic condition you can have a variable to store the value SAM (SEARCH_STRING) and then in the WHERE clause, you can say "%" | : SEARCH_STRING. '%' (| is a concatenation operator).
I hope this helps.
Thank you
Manish
Maybe you are looking for
-
iPhone 6 and some applications do not work without an internet connection
If I'm not connected to WiFi, a number of applications will not work. Error message says "no internet connection found. Please sign in to continue. "Is there a work around?
-
How blurredscript fixed?
The script on Firefox is blurred. This has happened on several computers. My computer at home, my laptop and my work computer. It is only on Firefox. Is it a problem with the program, or do I have to erase something on my computer? I tried to clear t
-
When you try to open the XP disc prompts you to format the drive. How can I get XP to recognize the current files without loseing no information?
-
SSRS 2005: Delay in opening a report in Adobe
SSRS 2005: Delay in opening a report in Adobe (export as PDF on the place) A lot of time to open a report in Adobe - more than 5 minutes. With IE9 - Download pane displays ' running safety analysis... » With IE7 - The download window is waiting. Fina
-
On the removal of the updates of Windows for Vista
I have Windows Vista 7. If I switch to Windows 10 I continue to get automatic updates from Microsoft? I understand that Microsoft supports is no longer upgrading the Vista operating system...