Calling Stored procedure which uses Bulk Collect
Hi All, I have Oracle stored procedure which uses Bulk Collect and returns table type parameter as output. Can anyone please help me how Can I call this kind of stored procedures which returns table type output using VB and Oracle's Driver. (I am successfully able to call using MS ODBC driver, but I want to use OraOLEDB driver.)
861412 wrote:
how Can I call this kind of stored procedures which returns table type output using VB and Oracle's Driver. This forum deals with the server-side languages SQL and PL/SQL.
Your question deals with the client side and Visual Basic language.
Similar Messages
-
ORA-06502 during a procedure which uses Bulk collect feature and nested tab
Hello Friends,
have created one procedure which uses Bulk collect and nested table to hold the bulk data. This procedure was using one cursor and a nested table with the same type as the cursor to hold data fetched from cursor. Bulk collection technique was used to collect data from cursor to nested table. But it is giving ORA-06502 error.
I reduced code of procedure to following to trace the error point. But still error is comming. Please help us to find the cause and solve it.
Script which is giving error:
declare
v_Errorflag BINARY_INTEGER;
v_flag number := 1;
CURSOR cur_terminal_info Is
SELECT distinct
'a' SettlementType
FROM
dual;
TYPE typ_cur_terminal IS TABLE OF cur_terminal_info%ROWTYPE;
Tab_Terminal_info typ_cur_Terminal;
BEGIN
v_Errorflag := 2;
OPEN cur_terminal_info;
LOOP
v_Errorflag := 4;
FETCH cur_terminal_info BULK COLLECT INTO tab_terminal_info LIMIT 300;
EXIT WHEN cur_terminal_info%rowcount <= 0;
v_Errorflag := 5;
FOR Y IN Tab_Terminal_Info.FIRST..tab_terminal_info.LAST
LOOP
dbms_output.put_line(v_flag);
v_flag := v_flag + 1;
end loop;
END LOOP;
v_Errorflag := 13;
COMMIT;
END;
I have updated script as following to change datatype as varchar2 for nested table, but still same error is
comming..
declare
v_Errorflag BINARY_INTEGER;
v_flag number := 1;
CURSOR cur_terminal_info Is
SELECT distinct
'a' SettlementType
FROM
dual;
TYPE typ_cur_terminal IS TABLE OF varchar2(50);
Tab_Terminal_info typ_cur_Terminal;
BEGIN
v_Errorflag := 2;
OPEN cur_terminal_info;
LOOP
v_Errorflag := 4;
FETCH cur_terminal_info BULK COLLECT INTO tab_terminal_info LIMIT 300;
EXIT WHEN cur_terminal_info%rowcount <= 0;
v_Errorflag := 5;
FOR Y IN Tab_Terminal_Info.FIRST..tab_terminal_info.LAST
LOOP
dbms_output.put_line(v_flag);
v_flag := v_flag + 1;
end loop;
END LOOP;
v_Errorflag := 13;
COMMIT;
I could not find the exact reason of error.
Please help us to solve this error.
Thanks and Regards..
Dipali..Hello Friends,
I got the solution.. :)
I did one mistake in procedure where the loop should end.
I used the statemetn: EXIT WHEN cur_terminal_info%rowcount <= 0;
But it should be: EXIT WHEN Tab_Terminal_Info.COUNT <= 0;
Now my script is working fine.. :)
Thanks and Regards,
Dipali.. -
Calling Stored Procedure which returns single or multiple value
Hi All Experts,
I have written one stored procedure which is returning different
integer values according to condition.I am calling this
stored procedure through prepareCall() method then executeUpdate() method ,but it is always returning 1,not my desired value.
Pl also tell me,if my stored procedure returns more than one value
then how will i get those values in my java program?
Pl help by writing some sample code.
Thanx in Advance.
Pradipto1) Create CallableStatement
2) For each of returning value you have to call RegisterOutParameter()
3) For others user setXXX() method depending on type of parameter
4) call
5) use vars registered through RegisterOutParameter() - all your values should be there
Pavel -
Send SQL query or call stored procedure, which is best???
hello experts!!
i would like to ask what will be the best implementation on querying a database using Java, send a SQL query(insert into table values...) or call stored procedure(just pass parameters)?? and also in stored procedure does "autoCommit/rollback" applies/make sense??I searched google for this:
Stored Procedures vs. SQL
and found this useful link:
http://www.karlkatzke.com/stored-procedures-vs-sql-calls/
I thiink you should also read up on other articles based on such google searches
to get other opinions. Also, read the links provided by that article.
Personnally, I think stored procedures should be avoided unless there is a definite
advantage as specified in the above article. Especially not used for CRUD operations.
Also, no matter where you put the SQL, it should be documented. I've seen too many stored procedures that aren't documented. -
Call stored procedure and use user parameter
I am a new user of BIEE.
1. Can I call stored procedure from BIEE report? If yes then how can I call?
2. Can I use parameter in sql script of BIEE report? If yes then how can I take this value of parameter from front end user?urang oge keur neangan ..hese euy,,,,
Message was edited by:
user648680 -
SOAP TO JDBC scenario: calling stored procedure which will return the value
Hi
I have Soap To Jdbc scenario in which I am going to call the Stored Procedure at target side which will be executed and it is going to return the result set .
Result contains following values.
return code as ( 0 Or 1) and also specific exception message if its return code as 1.
Could you suggest me the way by which I can handled this return code and send it back to the Sap PI system then the same thing is directed the to SMTP server for sending mail to consern person.
Regards
KumarThe OUT parameters of stored procedure will be returned as response. Where exactly are you facing the proble? Here is a complete walkthourgh
/people/luis.melgar/blog/2008/05/13/synchronous-soap-to-jdbc--end-to-end-walkthrough
In your case, you don't want response at sender. Instead you want to mail it. For this you may use BPM to design your scenario with following steps
Receive (to receive data from sender)
Send Sync (to stored procedure and get response)
Send Async (to mail receiver)
Regards,
Prateek -
(How) Can a SP call the Function which has BULK COLLECT return?
I have a function using BULL COLLECT to put (XML data) many line into a table type record. (I had this as a function because it's gong to call many times).
From one SP program, I will need to call it to get converted XML data info, how should i call it? If it's single line return, I could use
my_result := get_tbl_xml(p_xml);
but when it's table type, even I defined it, it still get error. Here is the program:
Declare (at package spec)
TYPE OrderDtl_Tab IS TABLE OF xxx%ROWTYPE INDEX BY BINARY_INTEGER;
in_OrderDtlTab OrderDtl_Tab;
FUNCTION get_tbl_xml (p_xml IN CLOB ) RETURN OrderDtl_Tab IS
BEGIN
SELECT extractvalue(VALUE(x), '/xxxx/xxxx') AS xxxx BULK COLLECT
INTO in_OrderDtlTab
FROM TABLE(xmlsequence(extract(xmltype(p_xml), '/Order/Lines/*'))) x;
RETURN in_OrderDtlTab;
END;
PROCEDURE SAVE_A (p_xml IN CLOB )
BEGIN
--- how to call get_tbl_xml to get result, so I will be able to insert into DB table
in_OrderDtlTab := get_tbl_xml(p_xml);
END;
--------------------------------------------------------------------------------------------------------------------May be this is better
FUNCTION get_tbl_xml (p_xml IN CLOB ) RETURN OrderDtl_Tab IS
BEGIN
SELECT extractvalue(VALUE(x), '/xxxx/xxxx') AS xxxx BULK COLLECT
INTO in_OrderDtlTab
FROM TABLE(xmlsequence(extract(xmltype(p_xml), '/Order/Lines/*'))) x;
RETURN in_OrderDtlTab;
END;
PROCEDURE SAVE_A (p_xml IN CLOB )
yourrow your_table%rowtype;
BEGIN
--- how to call get_tbl_xml to get result, so I will be able to insert into DB table
in_OrderDtlTab := get_tbl_xml(p_xml);
FORALL myrowtype
IN in_OrderDtlTab .FIRST .. in_OrderDtlTab .LAST
INSERT INTO Your_table
VALUES in_OrderDtlTab(yourrow);
END;
END; -
Calling Stored Procedure(takes varray of objects as input) from jdeveloper
How can i call Stored Procedure which takes varray of objects as input from jdeveloper
My object is :
TYPE Entry IS Object (
Name VARCHAR2(1024),
Value VARCHAR2(1024)
& the varray is :
TYPE EntryArr IS varray(10) OF Entry ;
& the procedure is :
PROCEDURE myProc( myEntryArr IN EntryArr )
AS
s varchar2(1024);
BEGIN
for i in 1.. myEntryArr .COUNT loop
if myEntryArr(i).Name = 'Name1' then
s := myEntryArr(i).Value
end loop;
end;hi 429071
Maybe you can find some useful information in:
"Oracle Database Java Developer's Guide"
http://download-west.oracle.com/docs/cd/B14117_01/java.101/b12021.pdf
see "6 Publishing Java Classes With Call Specs" > "Writing Object Type Call Specs"
success
Jan Vervecken -
Calling Stored Procedure from Oracle DataBase using Sender JDBC (JDBC-JMS)
Hi All,
We have requirement to move the data from Database to Queue (Interface Flow: JDBC -> JMS).
Database is Oracle.
*Based on Event, data will be triggered into two tables: XX & YY. This event occurs twice daily.
Take one field: 'aa' in XX and compare it with the field: 'pp' in YY.
If both are equal, then
if the field: 'qq' in YY table equals to "Add" then take the data from the view table: 'Add_View'.
else if the field: 'qq' in YY table equals to "Modify" then take the data from the view table: 'Modify_View'.
Finally, We need to archive the selected data from the respective view table.*
From each table, data will come differently, means with different field names.
I thought of call Stored Procedure from Sender JDBC Adapter for the above requirement.
But I heard that, we cannot call stored procedure in Oracle through Sender JDBC as it returns Cursor instead of ResultSet.
Is there any way other than Stored Procedure?
How to handle Data Types as data is coming from two different tables?
Can we create one data type for two tables?
Is BPM required for this to collect data from two different tables?
Can somebody guide me on how to handle this?
Waiting eagerly for help which will be rewarded.
Thanks and Regards,
Jyothirmayi.Hi Gopal,
Thank you for your reply.
>Is there any way other than Stored Procedure?
Can you try configuring sender adapter to poll the data in intervals. You can configure Automatic TIme planning (ATP) in the sender jdbc channel.
I need to select the data from different tables based on some conditions. Let me simplify that.
Suppose Table1 contains 'n' no of rows. For each row, I need to test two conditions where only one condition will be satisfied. If 1st condition is satisfied, then data needs to be taken from Table2 else data needs to be taken from Table3.
How can we meet this by configuring sender adapter with ATP?
================================================================================================
>How to handle Data Types as data is coming from two different tables?
If you use join query in the select statement field of the channel then whatever you need select fields will be returned. This might be fields of two tables. your datatype fields are combination of two diff table.
we need to take data only from one table at a time. It is not join of two tables.
================================================================================================
Thanks,
Jyothirmayi. -
Calling a Oracle Stored Procedure which will take a while to complete
Hey.
I'm calling a Oracle stored procedure which goes of and do a whole lot of things and therefore takes a fair while to complete.
Currently I am doing this:
String sql = "begin concorde.start_transfer(); end;";
HibernateUtil.getSessionFactory().openStatelessSession().connection().prepareCall(sql).execute();
....Where HibernateUtil is just a mean to get to the SessionFactory. The connection I get is the same one as a JDBC, I think.
I would want to regain control of the application as soon as the procedure is called and continue with the rest of the logic.
How do I do that? Do I have to initiate it from a different thread?
ThanksIf it was me I wouldn't have a stored proc that took a while to complete. Instead I would submit a job to job queue. In terms of implementation I would call a proc that writes a record to a table. Then a process in the database polls that table and runs jobs it finds there. Then reports results somewhere.
Sometime later you collect the results.
But without that then the solution in java is obvious - create a thread. -
Weird Problem calling Stored Procedure using JDBC
Scenario is..
I have J2EE application and calling stored procedure using JDBC.
My application connects to instance "A" of testDB.
Schema "A" does NOT own any packages/procedure but granted execute on oracle packages/procedures that reside in schema "B" of testDB.
In java code I call procedure(proc1) in package(pac1) which internally calls procedure(proc2) in package(pac2).
The problem occurs when procedure pac2.proc2 is modified. After the modification, my java code fails and throws an exception "User-Defined Exception" and I am also getting "ORA-06508: PL/SQL: could not find program unit being called". This clears up only if I bounce the web container. (This doesn't happen if I modify pac1.proc1 and run my application)
Has any one faced this problem? Please suggest if any thing can be changed in jdbc code to fix this problem.
ThanksHi,
I assume these are PL/SQL packages and that the changes are made at the package specification level?
If so, it looks like you are hitting the PL/SQL dependencies rules. In other words, if the spec of proc2 is changed, then proc1 is invalidated, since proc1 still depends on the old version of proc2's spec. As a result, if you try to run proc1, its spec must either be explicitly rewritten before it could run again or implicitly recompiled first, if the (implicit) recompilation fails, it won’t run.
Kuassi http://db360.blogspot.com -
Calling stored procedures using forms & ruleframe
Does anybody know how I should call a stored procedure (which does some DML on tables) from forms when ruleframe is used? Should a transaction be opened before the procedure is called and closed afterwards? What should happen in the exception handler of the stored procedure, and how should exceptions be handled in the form?
Mike,
When calling code that performs DML, you must explicitly code the open and close transaction call. In that call, specify a program name that is specific to that piece of code. And you have to have an exception handler (see below).
What will happen, is that the open transaction call checks if a transaction is already open. If it is, it does nothing, and also the close transaction call will then do nothing, as the transaction was opened by another program unit.
If there is no open transaction yet, your call will open one, and then your close-call will also close it because it has the same program name. If at that moment errors are raised, you have to catch them with the standard Headstart exception handler (which you ought to have in all your Forms program units):
when form_trigger_failure
then
raise;
when others
then
qms$errors.unhandled_exception(<program unit>);
This exception handler will recognize the ruleframe exception and show the messages.
We have updated the CDM RuleFrame documentation for 6i to make this more clear, to avoid confusion in the future.
Hope this helps,
Sandra -
Calling a stored procedure which returns a value
Hi Friends,
I want to call a stored procedure which returns a value.
Eg
create or replace procedure xyz(a1 in varchar2, a2 in varchar2, z1 out number)
thanksHi,
use this.
declare
retval number;
begin
abc('aaa','bbb',retval);
dbms_output.put_line('retval is ' ||retval);
end;
--Basava.S -
How to use @jws:sql call Stored Procedure from Workshop
Is there anyone know how to use @jws tag call Sybase stored procedure within
Workshop,
Thanks,Anurag,
Do you know is there any plan to add this feature in future release? and
when?
Thanks,
David
"Anurag Pareek" <[email protected]> wrote in message
news:[email protected]..
David,
In the current release, we do not support calling stored procedures from a
database control. You will have to write JDBC code in the JWS file to call
stored procedures.
Regards,
Anurag
Workshop Support
"David Yuan" <[email protected]> wrote in message
news:[email protected]..
Anurag,
I know how to use DB connection pool and create a db control with it. In
fact, we have created a Web Service with the db control using plain SQL
in
@jws:sql. However, my question here is how to use @jws tag in Weblogic
Workshop to create a Web Services based on Sybase stored procedure orany
Stored Proc not plain SQL.
Thanks,
David
"Anurag Pareek" <[email protected]> wrote in message
news:[email protected]..
David,
You can use a database control to obtain a connection from any JDBC
Connection Pool configured in the config.xml file. The JDBC Connectionpool
could be connecting to any database, the database control is
independent
of
that.
Regards,
Anurag
Workshop Support
"David Yuan" <[email protected]> wrote in message
news:[email protected]..
Is there anyone know how to use @jws tag call Sybase stored
procedure
within
Workshop,
Thanks, -
Procedure failed while using bulk collect into clause and works with cursor
hi all,
I am using "BULK collect into" clause in my procedure and it is failing after 21 minutes and gives the error "end of file communication channel".
after this error comes when i tried to connect database it is giving following error.
ORA -01034 - Oracle not available.
ORA- 27101 - shared memory realm does not exist.
svr4- error :2 : No such file or directory.
when i use cursor instead of BULK COLLECT INTO clause it is running successful.
Following code is working with cursor.
procedure work_kiosk_full(an_jobid in number ,ac_sqlcode out varchar2 ,ac_sqlerrm out varchar2) is
ld_curr_time Date;
cursor cur_work_kiosk is
select distinct jt.jt_id AS jt_id,
NVL ((ROUND ((jt_date_completed - jt_date_requested) * 24, 2)
0
) AS actual_hrs_to_complete,
NVL ((ROUND ((jt_date_responded - jt_date_requested) * 24, 2)
0
) AS actual_hrs_to_respond,
peo1.peo_name AS agent_name,
peo1.peo_user_name AS asagent_soe_id,
le.lglent_desc AS ap_system,
' ' AS assign_work_request_comment,
DECODE (jt.jt_bill_id,
138802, 'CLIENT BILLABLE',
138803, 'CONTRACTED',
138804, 'INTERNAL BILLABLE',
NULL, ' '
) AS billable,
bl.bldg_name_cc AS building, bl.bldg_id_ls AS building_id,
DECODE (bl.bldg_active_cc,
'Y', 'ACTIVE',
'INACTIVE'
) AS building_status,
DECODE (jt.jt_wrk_cause_id,
141521, 'STANDARD WEAR AND TEAR',
141522, 'NEGLIGENCE',
141523, 'ACCIDENTAL',
141524, 'MECHANICAL MALFUNCTION',
141525, 'OVERSIGHT',
141526, 'VANDAL',
141527, 'STANDARD',
141528, 'PROJECT WORK',
6058229, 'TEST',
NULL, ' '
) AS cause_type,
' ' AS comments, peo3.peo_name AS completed_by,
jt.jt_requestor_email AS contact_email,
jt.jt_requestor_name_first
|| ' '
|| jt.jt_requestor_name_last AS contact_name,
jt.jt_requestor_phone AS contact_phone,
cc.cstctrcd_apcode AS corp_code,
cc.cstctrcd_code AS cost_center,
jt.jt_date_closed AS date_closed,
jt.jt_date_completed AS date_completed,
jt.jt_date_requested AS date_requested,
jt.jt_date_responded AS date_responded,
jt.jt_date_response_ecd AS date_response_ecd,
jt.jt_date_scheduled AS date_scheduled,
DECODE (jt.jt_def_id,
139949, 'WTG VENDOR RESPONSE',
139950, 'WAITING ON PARTS',
139951, 'LABOR AVAILABILITY',
139952, 'DEFERRED- HI PRI WORK',
139953, 'WTG APPROVAL',
139954, 'FUNDING REQUIRED',
139955, 'ACCESS DENIED',
139956, 'WTG MATERIAL',
NULL, ' '
) AS deferral_reason,
jt.jt_description AS description,
jt.jt_date_resched_ecd AS ecd,
fmg.facility_manager AS facility_manager,
fl.floors_text AS FLOOR, gl.genled_desc AS general_ledger,
' ' AS kiosk_date_requested, ' ' AS kiosk_dispatch_confirmed,
' ' AS kiosk_dispatched,
eqp.equip_customer_code AS linked_equipment_alias,
eqp.equip_id AS linked_equipment_id,
eqp.equip_text AS linked_equipment_name,
DECODE (jt_originator_type_id,
1000, 'PROJECT MOVE REQUEST',
138834, 'CUSTOMER INITIATED CORRECTION',
138835, 'CUSTOMER INITIATED REQUEST',
138836, 'CORRECTIVE MAINTENANCE',
138837, 'CONFERENCE ROOM BOOKING',
138838, 'PROJECT INITIATED REQUEST',
138839, 'PLANNED PREVENTIVE MAINTENANCE',
138840, 'SELF INITATED REQUEST',
NULL, ' '
) AS originator_type,
' ' AS payment_terms, priority_text AS priority_code,
swoty.sworktype_text AS problem_type,
prop.property_name_cc AS property,
jt.jt_cost_quote_total AS quote_total,
par.levels_name AS region,
DECODE (jt.jt_repdef_id,
141534, 'ADJUSTED SETTING',
141535, 'TRAINING FOR END',
141536, 'NEW REQUEST',
141537, 'NO REPAIR REQUIR',
141538, 'REPLACED PARTS',
141539, 'REPLACE EQUIPMEN',
1000699, 'NEW REQUEST',
NULL, ' '
) AS repair_definitions,
jt.jt_repairdesc AS repair_description,
jt.jt_requestor AS requestor, ' ' AS requestor_cost_center,
jt.jt_requestor_email AS requestor_email,
jt.jt_requestor_name_first AS requestor_name,
jt.jt_requestor_phone AS requestor_phone,
' ' AS response_time, rm.room_name_cc AS room,
p1.peo_provider_code1 AS service_provider,
p1.peo_address_1 AS service_provider_address,
peocity.city_text service_provider_city,
p1.peo_provider_code1 AS service_provider_code,
peocity.city_country_name AS service_provider_country,
peocur.currency_text AS service_provider_currency,
p1.peo_name AS service_provider_description,
p1.peo_dispatch_method AS serv_prov_dispatc_hmethod,
p1.peo_rate_double AS serv_prov_double_time_rate,
p1.peo_email AS service_provider_email,
p1.peo_emergency_phone AS serv_prov_emergency_phone,
p1.peo_fax AS service_provider_fax_number,
p1.peo_home_phone AS service_provider_home_phone,
p1.peo_rate_hourly AS service_provider_hourly_rate,
p1.peo_title AS service_provider_job_title,
p1.peo_method_id AS service_provider_method,
p1.peo_cell_phone AS service_provider_mobile_phone,
p1.peo_pager AS service_provider_pager,
p1.peo_rate_differential AS service_provider_rates,
p1.peo_rate_differential AS ser_prov_shift_differential,
peocity.city_state_prov_text AS serv_prov_state_province,
DECODE (p1.peo_active,
'Y', 'ACTIVE',
'INACTIVE'
) AS service_provider_status,
p1.peo_url AS serv_prov_web_site_address,
p1.peo_phone AS service_provider_work_phone,
p1.peo_postal_code AS serv_prov_zip_postal_code, ' ' AS shift,
' ' AS skill,
DECODE (jt.jt_bigstatus_id,
138813, 'NEW',
138814, 'PENDING',
138815, 'OPEN',
138816, 'COMPLETED',
138817, 'CLOSED',
138818, 'CANCELLED',
NULL, ' '
) AS status,
lev.levels_name AS subregion, ' ' AS trade,
p1.peo_ls_interface_code1 AS vendor_id,
p1.peo_fax AS vendor_purchasing_fax,
p1.peo_vendor_site_code AS vendor_sitecode,
jt.jt_id AS vendor_ticket, p1.peo_name AS vendor_companyname,
jt.jt_requestor_vip AS vip, wo.wo_id AS work_order_no,
jt.jt_id AS work_request,
jt.jt_class_id AS work_request_class,
woty.worktype_text AS work_type, ' ' AS wr_cost,
jt.jt_description AS wr_description,
' ' AS wr_dispatch_method,
DECODE (jt.jt_bigstatus_id,
138813, 'NEW',
138814, 'PENDING',
138815, 'OPEN',
138816, 'COMPLETED',
138817, 'CLOSED',
138818, 'CANCELLED',
NULL, ' '
) AS wr_status,
ctry.country_name AS country
FROM citi.jobticket jt,
citi.property prop,
citi.bldg bl,
citi.bldg_levels bldglvl,
citi.LEVELS lev,
citi.LEVELS par,
(SELECT crstools.stragg (peo_name) facility_manager,
bldgcon_bldg_id
FROM citi.bldg_contacts, citi.people
WHERE bldgcon_peo_id = peo_id
AND bldgcon_contype_id IN (40181, 10142)
GROUP BY bldgcon_bldg_id) fmg,
citi.floors fl,
citi.room rm,
citi.general_ledger gl,
citi.legal_entity le,
citi.cost_center_codes cc,
citi.equipment eqp,
citi.worktype woty,
citi.subworktype swoty,
citi.work_order wo,
citi.jt_workers jtwo,
citi.priority,
citi.country ctry,
citi.people p1,
citi.people peo3,
citi.people peo1,
citi.city peocity,
citi.currency peocur
WHERE jt.jt_bldg_id = bl.bldg_id
AND bl.bldg_id = bldglvl.bldg_levels_bldg_id
AND bldglvl.bldg_levels_levels_id = lev.levels_id
AND lev.levels_parent = par.levels_id(+)
AND prop.property_id = bl.bldg_property_id
AND bl.bldg_active_ls <> 'N'
AND jt.jt_floors_id = fl.floors_id(+)
AND jt.jt_room_id = rm.room_id(+)
AND jt.jt_bldg_id = fmg.bldgcon_bldg_id(+)
AND jt.jt_genled_id = gl.genled_id(+)
AND gl.genled_lglent_id = le.lglent_id(+)
AND jt.jt_cstctrcd_id = cc.cstctrcd_id(+)
AND jt.jt_equip_id = eqp.equip_id(+)
AND jt.jt_id = jtwo.jtw_jt_id(+)
AND jt.jt_worktype_id = woty.worktype_id(+)
AND jt.jt_sworktype_id = swoty.sworktype_id(+)
AND jt.jt_wo_id = wo.wo_id
AND jt.jt_priority_id = priority_id(+)
--AND jt.jt_date_requested >= ADD_MONTHS (SYSDATE, -12)
AND jt.jt_last_update >= ADD_MONTHS (ld_curr_time, -12)
AND bl.bldg_country_id = ctry.country_id
AND jtwo.jtw_peo_id = p1.peo_id(+)
AND p1.peo_city_id = peocity.city_id(+)
AND jt.jt_completed_by_peo_id = peo3.peo_id(+)
AND p1.peo_rate_currency_id = peocur.currency_id(+)
AND jt.jt_agent_peo_id = peo1.peo_id(+);
BEGIN
execute immediate 'truncate table crstools.drt_bom_work_kiosk';
select sysdate into ld_curr_time from dual;
FOR cur_rec in cur_work_kiosk LOOP
IF MOD(cur_work_kiosk%rowcount,10000 ) = 0 then
COMMIT;
END IF;
INSERT INTO crstools.drt_bom_work_kiosk
( JT_ID
,ACTUAL_HRS_TO_COMPLETE
,ACTUAL_HRS_TO_RESPOND
,AGENT_NAME
,ASAGENT_SOE_ID
,AP_SYSTEM
,ASSIGN_WORK_REQUEST_COMMENT
,BILLABLE
,BUILDING
,BUILDING_ID
,BUILDING_STATUS
,CAUSE_TYPE
,COMMENTS
,COMPLETED_BY
,CONTACT_EMAIL
,CONTACT_NAME
,CONTACT_PHONE
,CORP_CODE
,COST_CENTER
,DATE_CLOSED
,DATE_COMPLETED
,DATE_REQUESTED
,DATE_RESPONDED
,DATE_RESPONSE_ECD
,DATE_SCHEDULED
,DEFERRAL_REASON
,DESCRIPTION
,ECD
,FACILITY_MANAGER
,FLOOR
,GENERAL_LEDGER
,KIOSK_DATE_REQUESTED
,KIOSK_DISPATCH_CONFIRMED
,KIOSK_DISPATCHED
,LINKED_EQUIPMENT_ALIAS
,LINKED_EQUIPMENT_ID
,LINKED_EQUIPMENT_NAME
,ORIGINATOR_TYPE
,PAYMENT_TERMS
,PRIORITY_CODE
,PROBLEM_TYPE
,PROPERTY
,QUOTE_TOTAL
,REGION
,REPAIR_DEFINITIONS
,REPAIR_DESCRIPTION
,REQUESTOR
,REQUESTOR_COST_CENTER
,REQUESTOR_EMAIL
,REQUESTOR_NAME
,REQUESTOR_PHONE
,RESPONSE_TIME
,ROOM
,SERVICE_PROVIDER
,SERVICE_PROVIDER_ADDRESS
,SERVICE_PROVIDER_CITY
,SERVICE_PROVIDER_CODE
,SERVICE_PROVIDER_COUNTRY
,SERVICE_PROVIDER_CURRENCY
,SERVICE_PROVIDER_DESCRIPTION
,SERV_PROV_DISPATC_HMETHOD
,SERV_PROV_DOUBLE_TIME_RATE
,SERVICE_PROVIDER_EMAIL
,SERV_PROV_EMERGENCY_PHONE
,SERVICE_PROVIDER_FAX_NUMBER
,SERVICE_PROVIDER_HOME_PHONE
,SERVICE_PROVIDER_HOURLY_RATE
,SERVICE_PROVIDER_JOB_TITLE
,SERVICE_PROVIDER_METHOD
,SERVICE_PROVIDER_MOBILE_PHONE
,SERVICE_PROVIDER_PAGER
,SERVICE_PROVIDER_RATES
,SER_PROV_SHIFT_DIFFERENTIAL
,SERV_PROV_STATE_PROVINCE
,SERVICE_PROVIDER_STATUS
,SERV_PROV_WEB_SITE_ADDRESS
,SERVICE_PROVIDER_WORK_PHONE
,SERV_PROV_ZIP_POSTAL_CODE
,SHIFT
,SKILL
,STATUS
,SUBREGION
,TRADE
,VENDOR_ID
,VENDOR_PURCHASING_FAX
,VENDOR_SITECODE
,VENDOR_TICKET
,VENDOR_COMPANYNAME
,VIP
,WORK_ORDER_NO
,WORK_REQUEST
,WORK_REQUEST_CLASS
,WORK_TYPE
,WR_COST
,WR_DESCRIPTION
,WR_DISPATCH_METHOD
,WR_STATUS
,COUNTRY
,CREATE_DATE
VALUES
(cur_rec.jt_id
,cur_rec.ACTUAL_HRS_TO_COMPLETE
,cur_rec.ACTUAL_HRS_TO_RESPOND
,cur_rec.AGENT_NAME
,cur_rec.ASAGENT_SOE_ID
,cur_rec.AP_SYSTEM
,cur_rec.ASSIGN_WORK_REQUEST_COMMENT
,cur_rec.BILLABLE
,cur_rec.BUILDING
,cur_rec.BUILDING_ID
,cur_rec.BUILDING_STATUS
,cur_rec.CAUSE_TYPE
,cur_rec.COMMENTS
,cur_rec.COMPLETED_BY
,cur_rec.CONTACT_EMAIL
,cur_rec.CONTACT_NAME
,cur_rec.CONTACT_PHONE
,cur_rec.CORP_CODE
,cur_rec.COST_CENTER
,cur_rec.DATE_CLOSED
,cur_rec.DATE_COMPLETED
,cur_rec.DATE_REQUESTED
,cur_rec.DATE_RESPONDED
,cur_rec.DATE_RESPONSE_ECD
,cur_rec.DATE_SCHEDULED
,cur_rec.DEFERRAL_REASON
,cur_rec.DESCRIPTION
,cur_rec.ECD
,cur_rec.FACILITY_MANAGER
,cur_rec.FLOOR
,cur_rec.GENERAL_LEDGER
,cur_rec.KIOSK_DATE_REQUESTED
,cur_rec.KIOSK_DISPATCH_CONFIRMED
,cur_rec.KIOSK_DISPATCHED
,cur_rec.LINKED_EQUIPMENT_ALIAS
,cur_rec.LINKED_EQUIPMENT_ID
,cur_rec.LINKED_EQUIPMENT_NAME
,cur_rec.ORIGINATOR_TYPE
,cur_rec.PAYMENT_TERMS
,cur_rec.PRIORITY_CODE
,cur_rec.PROBLEM_TYPE
,cur_rec.PROPERTY
,cur_rec.QUOTE_TOTAL
,cur_rec.REGION
,cur_rec.REPAIR_DEFINITIONS
,cur_rec.REPAIR_DESCRIPTION
,cur_rec.REQUESTOR
,cur_rec.REQUESTOR_COST_CENTER
,cur_rec.REQUESTOR_EMAIL
,cur_rec.REQUESTOR_NAME
,cur_rec.REQUESTOR_PHONE
,cur_rec.RESPONSE_TIME
,cur_rec.ROOM
,cur_rec.SERVICE_PROVIDER
,cur_rec.SERVICE_PROVIDER_ADDRESS
,cur_rec.SERVICE_PROVIDER_CITY
,cur_rec.SERVICE_PROVIDER_CODE
,cur_rec.SERVICE_PROVIDER_COUNTRY
,cur_rec.SERVICE_PROVIDER_CURRENCY
,cur_rec.SERVICE_PROVIDER_DESCRIPTION
,cur_rec.SERV_PROV_DISPATC_HMETHOD
,cur_rec.SERV_PROV_DOUBLE_TIME_RATE
,cur_rec.SERVICE_PROVIDER_EMAIL
,cur_rec.SERV_PROV_EMERGENCY_PHONE
,cur_rec.SERVICE_PROVIDER_FAX_NUMBER
,cur_rec.SERVICE_PROVIDER_HOME_PHONE
,cur_rec.SERVICE_PROVIDER_HOURLY_RATE
,cur_rec.SERVICE_PROVIDER_JOB_TITLE
,cur_rec.SERVICE_PROVIDER_METHOD
,cur_rec.SERVICE_PROVIDER_MOBILE_PHONE
,cur_rec.SERVICE_PROVIDER_PAGER
,cur_rec.SERVICE_PROVIDER_RATES
,cur_rec.SER_PROV_SHIFT_DIFFERENTIAL
,cur_rec.SERV_PROV_STATE_PROVINCE
,cur_rec.SERVICE_PROVIDER_STATUS
,cur_rec.SERV_PROV_WEB_SITE_ADDRESS
,cur_rec.SERVICE_PROVIDER_WORK_PHONE
,cur_rec.SERV_PROV_ZIP_POSTAL_CODE
,cur_rec.SHIFT
,cur_rec.SKILL
,cur_rec.STATUS
,cur_rec.SUBREGION
,cur_rec.TRADE
,cur_rec.VENDOR_ID
,cur_rec.VENDOR_PURCHASING_FAX
,cur_rec.VENDOR_SITECODE
,cur_rec.VENDOR_TICKET
,cur_rec.VENDOR_COMPANYNAME
,cur_rec.VIP
,cur_rec.WORK_ORDER_NO
,cur_rec.WORK_REQUEST
,cur_rec.WORK_REQUEST_CLASS
,cur_rec.WORK_TYPE
,cur_rec.WR_COST
,cur_rec.WR_DESCRIPTION
,cur_rec.WR_DISPATCH_METHOD
,cur_rec.WR_STATUS
,cur_rec.COUNTRY
,ld_curr_time
END LOOP;
COMMIT;
exception
when others then
rollback;
dbms_output.put_line('SQLCODE :'||sqlcode ||' Error :'||sqlerrm);
end work_kiosk_full;
Note : total record inserted 849000.
The same code does not work with bulk collect into caluse.
Please help me out why this is happening.
Thanks & regards
shyam~Shyam,
I agree with Billy.
Why are you not using an INSERT..SELECT ?
Also, what are you trying to achieve by
- incremental commits?
- copying data from one table to another (using expensive I/O)?
- using dynamic DML?
Most of these approaches are typically wrong - and not recommended for scalable and performant Oracle applications.I could see you using a CURSOR FOR LOOP if you were changing the data being inserted in such a way that you couldn't encapsulate the changes in a query, but you are doing a straight insert into the table from your Cursor. A much more efficient way would be to use the following modifications I made to your code example:
PROCEDURE WORK_KIOSK_FULL(AN_JOBID IN NUMBER,
AC_SQLCODE OUT VARCHAR2,
AC_SQLERRM OUT VARCHAR2) IS
BEGIN
EXECUTE IMMEDIATE 'truncate table crstools.drt_bom_work_kiosk';
/* Note: The APPEND hint forces a Direct Path INSERT (see Link below code sample) and is combined with the NOLOGGING Hint */
/* To dramtically increase performance. The Direct Path INSERT inserts records above the High-Water Mark on the table. */
INSERT /*+ APPEND NOLOGGING */ INTO CRSTOOLS.DRT_BOM_WORK_KIOSK
(JT_ID
,ACTUAL_HRS_TO_COMPLETE
,ACTUAL_HRS_TO_RESPOND
,AGENT_NAME
,ASAGENT_SOE_ID
,AP_SYSTEM
-- ,ASSIGN_WORK_REQUEST_COMMENT /* I commented out this COLUMN because it doesn't make sense to me to insert */
,BILLABLE /* a couple of space characters into a table. If the intent is to leave the column NULL */
,BUILDING /* don't include it in your INSERT statement and it will be NULL. If there is a valid reason */
,BUILDING_ID /* for inserting the spaces, then remove the "line comments" from the insert and select statments */
,BUILDING_STATUS
,CAUSE_TYPE
-- ,COMMENTS
,COMPLETED_BY
,CONTACT_EMAIL
,CONTACT_NAME
,CONTACT_PHONE
,CORP_CODE
,COST_CENTER
,DATE_CLOSED
,DATE_COMPLETED
,DATE_REQUESTED
,DATE_RESPONDED
,DATE_RESPONSE_ECD
,DATE_SCHEDULED
,DEFERRAL_REASON
,DESCRIPTION
,ECD
,FACILITY_MANAGER
,FLOOR
,GENERAL_LEDGER
-- ,KIOSK_DATE_REQUESTED
-- ,KIOSK_DISPATCH_CONFIRMED
-- ,KIOSK_DISPATCHED
,LINKED_EQUIPMENT_ALIAS
,LINKED_EQUIPMENT_ID
,LINKED_EQUIPMENT_NAME
,ORIGINATOR_TYPE
-- ,PAYMENT_TERMS
,PRIORITY_CODE
,PROBLEM_TYPE
,PROPERTY
,QUOTE_TOTAL
,REGION
,REPAIR_DEFINITIONS
,REPAIR_DESCRIPTION
,REQUESTOR
-- ,REQUESTOR_COST_CENTER
,REQUESTOR_EMAIL
,REQUESTOR_NAME
,REQUESTOR_PHONE
-- ,RESPONSE_TIME
,ROOM
,SERVICE_PROVIDER
,SERVICE_PROVIDER_ADDRESS
,SERVICE_PROVIDER_CITY
,SERVICE_PROVIDER_CODE
,SERVICE_PROVIDER_COUNTRY
,SERVICE_PROVIDER_CURRENCY
,SERVICE_PROVIDER_DESCRIPTION
,SERV_PROV_DISPATC_HMETHOD
,SERV_PROV_DOUBLE_TIME_RATE
,SERVICE_PROVIDER_EMAIL
,SERV_PROV_EMERGENCY_PHONE
,SERVICE_PROVIDER_FAX_NUMBER
,SERVICE_PROVIDER_HOME_PHONE
,SERVICE_PROVIDER_HOURLY_RATE
,SERVICE_PROVIDER_JOB_TITLE
,SERVICE_PROVIDER_METHOD
,SERVICE_PROVIDER_MOBILE_PHONE
,SERVICE_PROVIDER_PAGER
,SERVICE_PROVIDER_RATES
,SER_PROV_SHIFT_DIFFERENTIAL
,SERV_PROV_STATE_PROVINCE
,SERVICE_PROVIDER_STATUS
,SERV_PROV_WEB_SITE_ADDRESS
,SERVICE_PROVIDER_WORK_PHONE
,SERV_PROV_ZIP_POSTAL_CODE
-- ,SHIFT
-- ,SKILL
,STATUS
,SUBREGION
-- ,TRADE
,VENDOR_ID
,VENDOR_PURCHASING_FAX
,VENDOR_SITECODE
,VENDOR_TICKET
,VENDOR_COMPANYNAME
,VIP
,WORK_ORDER_NO
,WORK_REQUEST
,WORK_REQUEST_CLASS
,WORK_TYPE
-- ,WR_COST
,WR_DESCRIPTION
-- ,WR_DISPATCH_METHOD
,WR_STATUS
,COUNTRY
,CREATE_DATE
VALUES
(SELECT DISTINCT
JT.JT_ID AS JT_ID
,NVL((ROUND((JT_DATE_COMPLETED - JT_DATE_REQUESTED) * 24,2)),0) AS ACTUAL_HRS_TO_COMPLETE
,NVL((ROUND((JT_DATE_RESPONDED - JT_DATE_REQUESTED) * 24,2)),0) AS ACTUAL_HRS_TO_RESPOND
,PEO1.PEO_NAME AS AGENT_NAME
,PEO1.PEO_USER_NAME AS ASAGENT_SOE_ID
,LE.LGLENT_DESC AS AP_SYSTEM
-- ,' ' AS ASSIGN_WORK_REQUEST_COMMENT
,DECODE(JT.JT_BILL_ID,138802,'CLIENT BILLABLE'
,138803,'CONTRACTED'
,138804,'INTERNAL BILLABLE',NULL,' ') AS BILLABLE
,BL.BLDG_NAME_CC AS BUILDING
,BL.BLDG_ID_LS AS BUILDING_ID
,DECODE(BL.BLDG_ACTIVE_CC, 'Y', 'ACTIVE', 'INACTIVE') AS BUILDING_STATUS
,DECODE(JT.JT_WRK_CAUSE_ID,141521,'STANDARD WEAR AND TEAR'
,141522,'NEGLIGENCE'
,141523,'ACCIDENTAL'
,141524,'MECHANICAL MALFUNCTION'
,141525,'OVERSIGHT'
,141526,'VANDAL'
,141527,'STANDARD'
,141528,'PROJECT WORK'
,6058229,'TEST',NULL,' ') AS CAUSE_TYPE
-- ,' ' AS COMMENTS
,PEO3.PEO_NAME AS COMPLETED_BY
,JT.JT_REQUESTOR_EMAIL AS CONTACT_EMAIL
,JT.JT_REQUESTOR_NAME_FIRST || ' ' ||JT.JT_REQUESTOR_NAME_LAST AS CONTACT_NAME
,JT.JT_REQUESTOR_PHONE AS CONTACT_PHONE
,CC.CSTCTRCD_APCODE AS CORP_CODE
,CC.CSTCTRCD_CODE AS COST_CENTER
,JT.JT_DATE_CLOSED AS DATE_CLOSED
,JT.JT_DATE_COMPLETED AS DATE_COMPLETED
,JT.JT_DATE_REQUESTED AS DATE_REQUESTED
,JT.JT_DATE_RESPONDED AS DATE_RESPONDED
,JT.JT_DATE_RESPONSE_ECD AS DATE_RESPONSE_ECD
,JT.JT_DATE_SCHEDULED AS DATE_SCHEDULED
,DECODE(JT.JT_DEF_ID,139949,'WTG VENDOR RESPONSE'
,139950,'WAITING ON PARTS'
,139951,'LABOR AVAILABILITY'
,139952,'DEFERRED- HI PRI WORK'
,139953,'WTG APPROVAL'
,139954,'FUNDING REQUIRED'
,139955,'ACCESS DENIED'
,139956,'WTG MATERIAL',NULL,' ') AS DEFERRAL_REASON
,JT.JT_DESCRIPTION AS DESCRIPTION
,JT.JT_DATE_RESCHED_ECD AS ECD
,FMG.FACILITY_MANAGER AS FACILITY_MANAGER
,FL.FLOORS_TEXT AS FLOOR
,GL.GENLED_DESC AS GENERAL_LEDGER
-- ,' ' AS KIOSK_DATE_REQUESTED
-- ,' ' AS KIOSK_DISPATCH_CONFIRMED
-- ,' ' AS KIOSK_DISPATCHED
,EQP.EQUIP_CUSTOMER_CODE AS LINKED_EQUIPMENT_ALIAS
,EQP.EQUIP_ID AS LINKED_EQUIPMENT_ID
,EQP.EQUIP_TEXT AS LINKED_EQUIPMENT_NAME
,DECODE(JT_ORIGINATOR_TYPE_ID,1000,'PROJECT MOVE REQUEST'
,138834,'CUSTOMER INITIATED CORRECTION'
,138835,'CUSTOMER INITIATED REQUEST'
,138836,'CORRECTIVE MAINTENANCE'
,138837,'CONFERENCE ROOM BOOKING'
,138838,'PROJECT INITIATED REQUEST'
,138839,'PLANNED PREVENTIVE MAINTENANCE'
,138840,'SELF INITATED REQUEST',NULL,' ') AS ORIGINATOR_TYPE
-- ,' ' AS PAYMENT_TERMS
,PRIORITY_TEXT AS PRIORITY_CODE
,SWOTY.SWORKTYPE_TEXT AS PROBLEM_TYPE
,PROP.PROPERTY_NAME_CC AS PROPERTY
,JT.JT_COST_QUOTE_TOTAL AS QUOTE_TOTAL
,PAR.LEVELS_NAME AS REGION
,DECODE(JT.JT_REPDEF_ID,141534,'ADJUSTED SETTING'
,141535,'TRAINING FOR END'
,141536,'NEW REQUEST'
,141537,'NO REPAIR REQUIR'
,141538,'REPLACED PARTS'
,141539,'REPLACE EQUIPMEN'
,1000699,'NEW REQUEST',NULL,' ') AS REPAIR_DEFINITIONS
,JT.JT_REPAIRDESC AS REPAIR_DESCRIPTION
,JT.JT_REQUESTOR AS REQUESTOR
-- ,' ' AS REQUESTOR_COST_CENTER
,JT.JT_REQUESTOR_EMAIL AS REQUESTOR_EMAIL
,JT.JT_REQUESTOR_NAME_FIRST AS REQUESTOR_NAME
,JT.JT_REQUESTOR_PHONE AS REQUESTOR_PHONE
-- ,' ' AS RESPONSE_TIME
,RM.ROOM_NAME_CC AS ROOM
,P1.PEO_PROVIDER_CODE1 AS SERVICE_PROVIDER
,P1.PEO_ADDRESS_1 AS SERVICE_PROVIDER_ADDRESS
,PEOCITY.CITY_TEXT SERVICE_PROVIDER_CITY
,P1.PEO_PROVIDER_CODE1 AS SERVICE_PROVIDER_CODE
,PEOCITY.CITY_COUNTRY_NAME AS SERVICE_PROVIDER_COUNTRY
,PEOCUR.CURRENCY_TEXT AS SERVICE_PROVIDER_CURRENCY
,P1.PEO_NAME AS SERVICE_PROVIDER_DESCRIPTION
,P1.PEO_DISPATCH_METHOD AS SERV_PROV_DISPATC_HMETHOD
,P1.PEO_RATE_DOUBLE AS SERV_PROV_DOUBLE_TIME_RATE
,P1.PEO_EMAIL AS SERVICE_PROVIDER_EMAIL
,P1.PEO_EMERGENCY_PHONE AS SERV_PROV_EMERGENCY_PHONE
,P1.PEO_FAX AS SERVICE_PROVIDER_FAX_NUMBER
,P1.PEO_HOME_PHONE AS SERVICE_PROVIDER_HOME_PHONE
,P1.PEO_RATE_HOURLY AS SERVICE_PROVIDER_HOURLY_RATE
,P1.PEO_TITLE AS SERVICE_PROVIDER_JOB_TITLE
,P1.PEO_METHOD_ID AS SERVICE_PROVIDER_METHOD
,P1.PEO_CELL_PHONE AS SERVICE_PROVIDER_MOBILE_PHONE
,P1.PEO_PAGER AS SERVICE_PROVIDER_PAGER
,P1.PEO_RATE_DIFFERENTIAL AS SERVICE_PROVIDER_RATES
,P1.PEO_RATE_DIFFERENTIAL AS SER_PROV_SHIFT_DIFFERENTIAL
,PEOCITY.CITY_STATE_PROV_TEXT AS SERV_PROV_STATE_PROVINCE
,DECODE(P1.PEO_ACTIVE, 'Y', 'ACTIVE', 'INACTIVE') AS SERVICE_PROVIDER_STATUS
,P1.PEO_URL AS SERV_PROV_WEB_SITE_ADDRESS
,P1.PEO_PHONE AS SERVICE_PROVIDER_WORK_PHONE
,P1.PEO_POSTAL_CODE AS SERV_PROV_ZIP_POSTAL_CODE
-- ,' ' AS SHIFT
-- ,' ' AS SKILL
,DECODE(JT.JT_BIGSTATUS_ID,138813,'NEW'
,138814,'PENDING'
,138815,'OPEN'
,138816,'COMPLETED'
,138817,'CLOSED'
,138818,'CANCELLED',NULL,' ') AS STATUS
,LEV.LEVELS_NAME AS SUBREGION
-- ,' ' AS TRADE
,P1.PEO_LS_INTERFACE_CODE1 AS VENDOR_ID
,P1.PEO_FAX AS VENDOR_PURCHASING_FAX
,P1.PEO_VENDOR_SITE_CODE AS VENDOR_SITECODE
,JT.JT_ID AS VENDOR_TICKET
,P1.PEO_NAME AS VENDOR_COMPANYNAME
,JT.JT_REQUESTOR_VIP AS VIP
,WO.WO_ID AS WORK_ORDER_NO
,JT.JT_ID AS WORK_REQUEST
,JT.JT_CLASS_ID AS WORK_REQUEST_CLASS
,WOTY.WORKTYPE_TEXT AS WORK_TYPE
-- ,' ' AS WR_COST
,JT.JT_DESCRIPTION AS WR_DESCRIPTION
-- ,' ' AS WR_DISPATCH_METHOD
,DECODE(JT.JT_BIGSTATUS_ID,138813,'NEW'
,138814,'PENDING'
,138815,'OPEN'
,138816,'COMPLETED'
,138817,'CLOSED'
,138818,'CANCELLED',NULL,' ') AS WR_STATUS
,CTRY.COUNTRY_NAME AS COUNTRY
,SYSDATE --LD_CURR_TIME
FROM CITI.JOBTICKET JT,
CITI.PROPERTY PROP,
CITI.BLDG BL,
CITI.BLDG_LEVELS BLDGLVL,
CITI.LEVELS LEV,
CITI.LEVELS PAR,
(SELECT CRSTOOLS.STRAGG(PEO_NAME) FACILITY_MANAGER,
BLDGCON_BLDG_ID
FROM CITI.BLDG_CONTACTS, CITI.PEOPLE
WHERE BLDGCON_PEO_ID = PEO_ID
AND BLDGCON_CONTYPE_ID IN (40181, 10142)
GROUP BY BLDGCON_BLDG_ID) FMG,
CITI.FLOORS FL,
CITI.ROOM RM,
CITI.GENERAL_LEDGER GL,
CITI.LEGAL_ENTITY LE,
CITI.COST_CENTER_CODES CC,
CITI.EQUIPMENT EQP,
CITI.WORKTYPE WOTY,
CITI.SUBWORKTYPE SWOTY,
CITI.WORK_ORDER WO,
CITI.JT_WORKERS JTWO,
CITI.PRIORITY,
CITI.COUNTRY CTRY,
CITI.PEOPLE P1,
CITI.PEOPLE PEO3,
CITI.PEOPLE PEO1,
CITI.CITY PEOCITY,
CITI.CURRENCY PEOCUR
WHERE JT.JT_BLDG_ID = BL.BLDG_ID
AND BL.BLDG_ID = BLDGLVL.BLDG_LEVELS_BLDG_ID
AND BLDGLVL.BLDG_LEVELS_LEVELS_ID = LEV.LEVELS_ID
AND LEV.LEVELS_PARENT = PAR.LEVELS_ID(+)
AND PROP.PROPERTY_ID = BL.BLDG_PROPERTY_ID
AND BL.BLDG_ACTIVE_LS = 'N'
AND JT.JT_FLOORS_ID = FL.FLOORS_ID(+)
AND JT.JT_ROOM_ID = RM.ROOM_ID(+)
AND JT.JT_BLDG_ID = FMG.BLDGCON_BLDG_ID(+)
AND JT.JT_GENLED_ID = GL.GENLED_ID(+)
AND GL.GENLED_LGLENT_ID = LE.LGLENT_ID(+)
AND JT.JT_CSTCTRCD_ID = CC.CSTCTRCD_ID(+)
AND JT.JT_EQUIP_ID = EQP.EQUIP_ID(+)
AND JT.JT_ID = JTWO.JTW_JT_ID(+)
AND JT.JT_WORKTYPE_ID = WOTY.WORKTYPE_ID(+)
AND JT.JT_SWORKTYPE_ID = SWOTY.SWORKTYPE_ID(+)
AND JT.JT_WO_ID = WO.WO_ID
AND JT.JT_PRIORITY_ID = PRIORITY_ID(+)
--AND jt.jt_date_requested >= ADD_MONTHS (SYSDATE, -12)
AND JT.JT_LAST_UPDATE >= ADD_MONTHS(LD_CURR_TIME, -12)
AND BL.BLDG_COUNTRY_ID = CTRY.COUNTRY_ID
AND JTWO.JTW_PEO_ID = P1.PEO_ID(+)
AND P1.PEO_CITY_ID = PEOCITY.CITY_ID(+)
AND JT.JT_COMPLETED_BY_PEO_ID = PEO3.PEO_ID(+)
AND P1.PEO_RATE_CURRENCY_ID = PEOCUR.CURRENCY_ID(+)
AND JT.JT_AGENT_PEO_ID = PEO1.PEO_ID(+)
COMMIT;
EXCEPTION
WHEN OTHERS THEN
ROLLBACK;
DBMS_OUTPUT.PUT_LINE('SQLCODE :' || SQLCODE || ' Error :' || SQLERRM);
END WORK_KIOSK_FULL;Here's the link for infor on the [Oracle Direct-Path INSERT |http://download.oracle.com/docs/cd/B10501_01/server.920/a96524/c21dlins.htm#10778].
Also, if you are truly intent on using a CURSOR FOR LOOP with the BULK COLLECT, I suggest you read Steven Feuerstein's article [PL/SQL Practices: On BULK COLLECT |http://www.oracle.com/technology/oramag/oracle/08-mar/o28plsql.html].
Hope this helps.
Craig...
If my response or the response of another was helpful, please mark it accordingly
Maybe you are looking for
-
Hyper-V replica vs Shared Nothing Live Migration
Shared Nothing Live Migration allows to transport your VM over the WAN without shutting it down (how much time it takes on io intensive vm is another story) Hyper-V replica does not allow to perform the DR switch without shutdown operation on pri
-
Stacked bar chart with single group
Post Author: rt50896 CA Forum: Charts and Graphs Dear all, I have a question about stacked bar chart with one group value(normally more than one group value is ok) ex. YYYYMM PRODUCT AMT - 200601 ABC 100
-
FaceTime calls not received when iPad sleep
FaceTime does not wake my iPad when it rings. The ringer works fine when I'm using the iPad and it's awake. It just seems to me that I shouldn't have to call/text a person to ask them to make sure their iPad is awake so they're able to receive my c
-
Can we deploy a mapping through Command Prompt
Can we deploy a mapping through Command Prompt. If so pls tell me how Thanks in Advance
-
i can't locate my playlist after adding a flashdrive because my c drive was full