Insert a value into bol attribut
Hiii,
I will insert a value into a bol attribut with the method "SET_PROPERTY".
Here is my code so far.
lr_entity ?= me->typed_context->builheader->collection_wrapper->get_current( ).
if lr_entity is bound.
lr_entity->set_property( EXPORTING
iv_attr_name = 'TITLE_KEY'
iv_value = '0100'
endif.
The problem here is, I can the in the debug mode, that the value is inserted.
But by running the debug mode again, the value of the attribut 'TITLE_KEY' is empty.
My question here is, how can I save the value of attribut?
Can anybody help me please?
regards,
John
Hallo Ashish,
I already tried to do this with
DATA lr_core TYPE REF TO cl_crm_bol_core.
lr_core = cl_crm_bol_core=>get_instance( ).
lr_core->modify( ).
It is also interessting that, after
lr_core->modify( ).
I cann't look into the bol entity builheader during debugging.
Durring debugging, ATTRIBUTE_REF(Container Proxy->DATA REF-> ATTR_REF)
Do you have any other idea?
reagards,
John
Similar Messages
-
Inserting a Value into otherTable using an App. Proc. from a Date Picker
I'm trying to call an Application Process that will insert an Attribute of a Row, into another table, after selecting a date from a Date Picker cell.
I don't know why this shouldn't be possible. I think I've got all of my "Ducks in a Row", so to speak,
but the Value that is being inserted into the other table is this:.. [object HTMLTableCellElement]
(Ultimately, I'd like my Application Process to include Page element values with the insert as well, but I'm trying to handle one problem at a time)
Here's a list of all the steps I've covered:
1. I've Created an Application Process, (popDevices). The Process Point is "On-Demand". The Type is "PL/SQL Anonymous Block".
The Process is defined as such:
BEGIN
Insert into P_DEVICES
NAME,
IP_ADDRESS,
MODEL
) values
'Unassigned',
'Unassigned',
:P153_MODEL
COMMIT;
END;
2. I've Included the Javascript in the Page HTML Header.
The Javascript is written as such: (minus the tags)
function popDevices(PART_NO)
var get = new htmldb_Get(null,$x('pFlowId').value,'APPLICATION_PROCESS=popDevices',0);
get.add('P153_MODEL',PART_NO);
gReturn = get.get();
get = null;
3. I've included the following in the "Element Attributes" field of the Date-Picker Item (Date_Delivered).
The Region Type is "SQL Query (Updatable Report)"
onChange="javascript:popDevices(PART_NO);"
THE RESULTS
A. A row does get inserted into the other (P_Devices) table,
But the value of the Attribute from the Page Region is not valid.
The Inserted value is this: [object HTMLTableCellElement]
B. I have tried Every conceivable combination of characters in the "Element Attributes" field, such as:
...(PART_NO), (#PART_NO#), (||PART_NO||), (+PART_NO+)
C. The Javascript in the Page HTML Header appears to be correct, since I have written it this same way for other applications without any problems.
D. If this simply cannot be done by referencing the "onChange" Javascript from the "Element Attributes" field,
Then can you help me to write the code into the Select statement of the region.
Thanks for any help you can give me.
-GaryThis may not be the most direct approach to the solution. But, none the less, it is a solution.
For those other novices, like myself, I hope this can be useful at some point in your development:
MY DESIRED RESULT:
A. To Insert into another tablle values derived from both; Page Item (i.e. P153_x) and Attributes of a Row in an Updatable Report from which I have selected the Date-Picker.
B. I want the insert to occur automatically after the user Selects the date from the Date-Picker.
SOLUTIONS:
1. I usea Javascript prompt window to prompt for information and store the information in Pre-Created Page Items.
This is the Javascript as I've entered it into the Page HTML Header region: (Minus the Tags)
function received_javaprompt () {
var Serial_Number = prompt("Enter the Serial Number");
var Bldg_Id = prompt("Enter the Bldg_Id");
var Clst_Id = prompt("Enter the Clst_Id");
$x('P153_SERIAL_NO').value = Serial_Number;
$x('P153_BLDG_ID').value = Bldg_Id;
$x('P153_CLST_ID').value = Clst_Id;
2. I needed to identify the (Manufacturer and Part_No) Column Attribute in the Row from which I selected the Date-Picker.
A. To do this, I enumerated the Columns in the order they were listed in the Select Statement of the region (Click on the Region Definition Tab).
B. Then (Click on the Report Attributes Tab). Count, In the numerical order which these columns are selected, ONLY the columns that are Editable.
C. When I counted down as far as the Column I wanted to capture the value of, Then I made a mental note of that number and used it in the following (2) Javascripts (findMaker and findModel).
3. findMaker (Minus the tags)
function findMaker (pThis) {
var vRow = pThis.id.substr(pThis.id.indexOf('_')+1);
var Maker = html_GetElement('f15_'+vRow).value
$x('P153_MAKER').value = Maker;
4. findModel (Minus the tags)
function findModel (pThis) {
var vRow = pThis.id.substr(pThis.id.indexOf('_')+1);
var Model = html_GetElement('f16_'+vRow).value
$x('P153_MODEL').value = Model;
5. I added one more Javascript, to the Page HTML Header, that references the Application Process which will Insert the values into the "Other" table:
function popDevices(P153_SERIAL_NO,P153_BLDG_ID,P153_CLST_ID,P153_MAKER,P153_MODEL)
var get = new htmldb_Get(null,$x('pFlowId').value,'APPLICATION_PROCESS=popDevices',0);
get.add('P153_SERIAL_NO',P153_SERIAL_NO);
get.add('P153_BLDG_ID',P153_BLDG_ID);
get.add('P153_CLST_ID',P153_CLST_ID);
get.add('P153_MAKER',P153_MAKER);
get.add('P153_MODEL',P153_MODEL);
gReturn = get.get();
get = null;
6. I added the "onChange" process to the Element Attributes field of the Table item which utilizes the Date-Picker:
A. Click on the Report Attributes Tab of the Region.
B. Click on the Edit icon of the column which utilized the Date-Picker
C. I added this "onChange" reference to the Element Attributes field, which is found in the Tabular Form section.
onChange="javascript:received_javaprompt();findModel(this);findMaker(this);popDevices((P153_SERIAL_NO).value,(P153_BLDG_ID).value,(P153_CLST_ID).value,(P153_MAKER).value,(P153_MODEL).value);"
7. The Application Process which inserts the collected data into the table is as follows:
(Name= popDevices: Process Point= On-Demand: Type= PL/SQL Anonymous Block)
BEGIN
Insert into P_DEVICES
BLDG_ID,
CLST_ID,
NAME,
IP_ADDRESS,
SERIAL_NO,
MAKER,
MODEL
) values
:P153_BLDG_ID,
:P153_CLST_ID,
'Unassigned',
'Unassigned',
:P153_SERIAL_NO,
:P153_MAKER,
:P153_MODEL
COMMIT;
END;
Well, I hope this may help someone else like me.
I usually arrive at my solutions by getting help here on the Discussion Forum and also Google. Google inevitably points me to a previous Apex Discussion Forum session.
Edited by: garyNboston on Mar 15, 2010 10:55 AM -
How to insert column values into database as rows
Hi,
I have 8 columns and some not null columns. Based on not null columns I want to insert into table as rows. The 8 columns may contain values or no value. If the first column contains data, then I have to insert into one row. if the second column contains data I have to insert a row and in second column. respectively...So How can I insert column values into rows. Can I write 8 insert statements. (OR) is it possible to insert data from columns using where clause.
Please help me out....
Thanks in AdvanceLines Table:
line_id, orcl_bank_account_num, product_type, service_type, lease_type,
funding_type, cpi, billing_frequency_unit_cd , annual_due_date ,
pricing_start_date, pricing_end_date, install_date, contract_end_date ,
prdct_replacement_cost_amt, cradle_replacement_amt, supranet_contract,
issuance_fee, board_inactive_date, header_id, creation_date, last_modified_date,
created_by_nam, modified_by_nam, activeinactive_flg, prdct_bill_amt_yr1,
prdct_bill_amt_yr2, prdct_bill_amt_yr3, prdct_bill_amt_yr4, prdct_bill_amt_yr5,
prdct_bill_amt_yr6, prdct_bill_amt_yr7, prdct_bill_amt_yr8, activation_fee_yr1,
activation_fee_yr2, activation_fee_yr3, activation_fee_yr4, activation_fee_yr5,
activation_fee_yr6, activation_fee_yr7, activation_fee_yr8,
In this table the columns structure is :
-- PRDCT_BILL_AMT_YR (1 to 8) NUMBER(14,4)
-- ACTIVATION_FEE_YR (1 to 8) NUMBER(8,2)
I have one more table:
PRDCT_INS_AMT NUMBER(14,4)
ACTIVATION_FEE_AMT NUMBER(14,4)
I want to insert prdct_bill_amt_yr (1 to 8) columns data into PRDCT_INS_AMT column. similarly activation_fee (1 to 8) columns data.
But the data should be inserted based product_type, service_type, lease_type columns values. (These 3 columns may contain upto 45 combinations). -
How Can I Set a Javascript Value into an Attribute of BSP PAGE
Hi
Can anyone tell me.
How Can I Set a Javascript Value into an Attribute of BSP PAGEHi Mithlesh,
javascript runs on client side and you cannot assign the value to a Page attribute directly.
As a workaround,you can use an Inputfield,hidden if required,and set the value using javascript.Then the form will have to be submit to be able to read the value in onInputProcessing and then can be assigned to any variable.
In Layout
<head>
<script language="javascript">
function pass()
txt1 = document.getElementById("ip_mrf");
txt.value = "hello" ;
</script>
</head>
<htmlb:inputField id="ip_mrf"
value="<%=mrf_number%>"
visible="FALSE"/>
in onInputProcessing
cha1 = request->get_form_field( 'ip_mrf' ).
where cha1 is the page attribute
hope this helps,
Regards,
Siddhartha
Message was edited by: Siddhartha Jain -
How to insert parameter value into multiple columns and rows
Hi All,
I have one procedure insert_tab and I am passing
100~101~102:103~104~105:106~107~108 as a parameter to that procedure. I wanted to insert each numeric value into one column. The output of the table should contain
Table:
Col1 Col2 Col3
100 101 102
103 104 105
106 107 108
Awaiting for your reply..That's not more clear for me...
Anyway, if you really want a procedure for that, try :
SQL> create table tblstr (col1 number,col2 number,col3 number);
Table created.
SQL>
SQL> create or replace procedure insert_fct (p_string IN varchar2)
2 as
3 v_string varchar2(4000):=p_string||':';
4 v_substring varchar2(4000);
5
6 begin
7 while instr(v_string,':') > 0 loop
8 v_substring := substr(v_string,1,instr(v_string,':')-1)||'~';
9 insert into tblstr(col1,col2,col3)
10 values (substr(v_substring,1,instr(v_substring,'~',1,1)-1),
11 substr(v_substring,instr(v_substring,'~',1,1)+1,instr(v_substring,'~',1,2)-instr(v_substring,'~',1,1)-1),
12 substr(v_substring,instr(v_substring,'~',1,2)+1,instr(v_substring,'~',1,3)-instr(v_substring,'~',1,2)-1));
13 v_string:=substr(v_string,instr(v_string,':')+1);
14 end loop;
15 end;
16 /
Procedure created.
SQL>
SQL> show err
No errors.
SQL>
SQL> select * from tblstr;
no rows selected
SQL> exec insert_fct('100~101~102:103~104~105:106~107~108')
PL/SQL procedure successfully completed.
SQL> select * from tblstr;
COL1 COL2 COL3
100 101 102
103 104 105
106 107 108
SQL> exec insert_fct('109~~')
PL/SQL procedure successfully completed.
SQL> exec insert_fct('~110~')
PL/SQL procedure successfully completed.
SQL> exec insert_fct('~~111')
PL/SQL procedure successfully completed.
SQL> select * from tblstr;
COL1 COL2 COL3
100 101 102
103 104 105
106 107 108
109
110
111
6 rows selected.
SQL> Nicolas. -
How do I insert multiple values into different fields in a stored procedure
I am writing a Stored Procedure where I select data from various queries, insert the results into a variable and then I insert the variables into final target table. This works fine when the queries return only one row. However I have some queries that return multiple rows and I am trying to insert them into different fields in the target table. My query is like
SELECT DESCRIPTION, SUM(AMOUNT)
INTO v_description, v_amount
FROM SOURCE_TABLE
GROUP BY DESCRIPTION;
This returns values like
Value A , 100
Value B, 200
Value C, 300
The Target Table has fields for each of the above types e.g.
VALUE_A, VALUE_B, VALUE_C
I am inserting the data from a query like
INSERT INTO TARGET_TABLE (VALUE_A, VALUE_B, VALUE_C)
VALUES (...)
How do I split out the values returned by the first query to insert into the Insert Statement? Or do I need to split the data in the statement that inserts into the variables?
Thanks
GB"Some of the amounts returned are negative so the MAX in the select statement returns 0 instead of the negative value. If I use MIN instead of MAX it returns the correct negative value. However I might not know when the amount is going to be positive or negative. Do you have any suggestions on how I can resolve this?"
Perhaps something like this could be done in combination with the pivot queries above, although it seems cumbersome.
SQL> with data as (
2 select 0 a, 0 b, 0 c from dual -- So column a has values {0, 1, 4},
3 union select 1 a, 2 b, -3 c from dual -- column b has values {0, 2, 5},
4 union select 4 a, 5 b, -6 c from dual ) -- column c has values {0, -3, -6}.
5 --
6 select ( case when max.a > 0 then max.a else min.a end) abs_max_a
7 , ( case when max.b > 0 then max.b else min.b end) abs_max_b
8 , ( case when max.c > 0 then max.c else min.c end) abs_max_c
9 from ( select ( select max(a) from data ) a
10 , ( select max(b) from data ) b
11 , ( select max(c) from data ) c
12 from dual ) max
13 , ( select ( select min(a) from data ) a
14 , ( select min(b) from data ) b
15 , ( select min(c) from data ) c
16 from dual ) min
17 /
ABS_MAX_A ABS_MAX_B ABS_MAX_C
4 5 -6
SQL> -
Insert float value into ms sql server
Hi.
How do I insert a float value into my ms sql db.
The Code:
select.setFloat( 4, theForm.getVaerdi() );ERROR:
"MakeClapetInsertAction.java": Error #: 300 : method setFloat(int, java.lang.Float) not found in interface java.sql.PreparedStatement at line 89, column 12setFloat takes a float primitive, not a Float object.
select.setFloat( 4, theForm.getVaerdi().floatValue() ); -
Reading BFile datatype value to insert corresponding value into blob
Hi,
I have oracle 10.2.0 database.
I have this table with 3 columns of datatypes
TableA(id, Blob, BFile)
now i have pdf files stored in a directory for every id which ranges from 1 till 100.
for example for id=10, the pdf file name is cr10.pdf
except that for some id there is no correpsonding pdf's.
and i have a written a query where for a particular id, i link the corresponding pdf into the BFile. now is there a way where i can view the value of the bfile locator and find whether the bfile is null or not(i mean whether there is a pdf or not existing for that particular id)
what i need to do is, based on the bfile value i will insert the pdf into the blob column.
so based on the bfile value(ie whethe rthe pdf exisit or not) i will open the pdf and read the contents into the blob column.
and somehow i have figure out that a pdf is not exisiting based on the bfile value and then insert a null into the blob column instead of getting an error by trying to read a pdf which doesn't exist.
Can someone help me, how to find out existance of a file based on bfile value and insert value into blob.
I want this is script to be automated instead of checking manually a file exists or not.
Thanks,
Philip.Hi,
I have oracle 10.2.0 database.
I have this table with 3 columns of datatypes
TableA(id, Blob, BFile)
now i have pdf files stored in a directory for every id which ranges from 1 till 100.
for example for id=10, the pdf file name is cr10.pdf
except that for some id there is no correpsonding pdf's.
and i have a written a query where for a particular id, i link the corresponding pdf into the BFile. now is there a way where i can view the value of the bfile locator and find whether the bfile is null or not(i mean whether there is a pdf or not existing for that particular id)
what i need to do is, based on the bfile value i will insert the pdf into the blob column.
so based on the bfile value(ie whethe rthe pdf exisit or not) i will open the pdf and read the contents into the blob column.
and somehow i have figure out that a pdf is not exisiting based on the bfile value and then insert a null into the blob column instead of getting an error by trying to read a pdf which doesn't exist.
Can someone help me, how to find out existance of a file based on bfile value and insert value into blob.
I want this is script to be automated instead of checking manually a file exists or not.
Thanks,
Philip. -
How can I insert a value into the Oracle Date column using JDBC?
Suppose I have a table TEST created by "create table TEST (c1 INT, c2 Date);"
Now I want to insert some proper value into the table TEST's column c2. I couldn't do that by TRYing using Java.sql.Date, Java.Util.Date, Java.String.
Could anyone give me some suggestions by providing the sample code?
Many thanks for your help!
WendyWhat about building the java string:
"Insert into test (c1,d1) values ("+
Integer.toString(var)+
", TO_DATE("
formatYourDateVariableWithCalendarMethods
",'DD-MON-YYYY')"
and executing it ?? -
How to insert a value into a field of binary type?
I've been using Oracle for a while now but never dealt with BLOB
or long raw type before. Does anyone here know how to insert a
record into a field of either blob or long raw type?
Any suggestions would be very appreicated.
Thanks.pls used the loadfromfile procedure which is in the DBMS_LOB
package to insert the data from external os file into blob data
type column.
Kunjan -
Spaces removed when inserting a value into a text item
Dear members,
(Forms 6i c/s)
I have a databased function returning a string of characters (varchar2). This value can have spaces at its end.
When I put this value into a text item in Forms, the spaces at the end are removed.
How can I avoid that ?
Thanks for your help.Hi,
There is no elegant solution for this. Metalink has a discussion of the topic in note nr 247715.1
/Michael -
CREATE OR REPLACE
PACKAGE BODY xxcsi_ib_data_ob_ecs_pkg
v_update_date DATE := SYSDATE;
PROCEDURE print_log(
i_message IN VARCHAR2)
IS
BEGIN
-- dbms_output.put_line('Log '||TO_CHAR(sysdate,'DD-MON-YYYY HH24:MI:SS :')||i_message);
fnd_file.put_line(fnd_file.LOG,'Log '||TO_CHAR(SYSDATE,'DD-MON-YYYY HH24:MI:SS :')||i_message);
EXCEPTION
WHEN no_data_found THEN
NULL;
WHEN OTHERS THEN
NULL;
END;
PROCEDURE main_prc(
o_chr_errbuff OUT VARCHAR2 ,
o_num_retcode OUT NUMBER ,
i_org_id IN NUMBER)
IS
CURSOR cur_get_parent_ib_rec(c_from DATE ,c_to DATE)
IS
SELECT
/*+ index(a CSI_ITEM_INSTANCES_X3)*/
---CREATE MODE ITEM
A.creation_date ,
A.last_update_date ,
A.last_oe_order_line_id line_id ,
A.inventory_item_id ,
A.instance_id ,
A.instance_type_code ,
msib.segment1
FROM csi_item_instances A ,
mtl_system_items_b msib
WHERE 1=1
-- AND a.instance_id = 33371916
--AND a.instance_id in (33371920,33371921,33371922,33371923,33371924,33371925,33371926,33371927,33371928,33371929,33371930)
AND msib.inventory_item_id=A.inventory_item_id
AND msib.organization_id =
(SELECT mp.organization_id
FROM mtl_parameters mp
WHERE mp.organization_code = 'IMO'
-- AND msib.organization_id = 85
-- and msib.segment1 like '475%'
--AND msib.segment1 like 'TREX%'
AND EXISTS
(SELECT 1
FROM fnd_lookup_values
WHERE lookup_type = 'EMR CSI OUTBOUND INTERFACE PSG'
AND language = 'US'
AND lookup_code = msib.segment1
--and DESCRIPTION = 'Items to be Interfaced from Oracle EBS to ECS'
AND A.last_update_date BETWEEN NVL(c_from ,to_date('07-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS')) AND NVL(c_to ,to_date('22-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS'))
UNION
SELECT
/*+ index(a CSI_ITEM_INSTANCES_X3)*/
---CREATE MODE SEARCH
A.creation_date ,
A.last_update_date ,
A.last_oe_order_line_id line_id ,
A.inventory_item_id ,
A.instance_id ,
A.instance_type_code ,
msib.segment1
FROM csi_item_instances A ,
mtl_system_items_b msib
WHERE 1=1
--AND a.instance_id = 33371916
--AND a.instance_id in (33371920,33371921,33371922,33371923,33371924,33371925,33371926,33371927,33371928,33371929,33371930)
AND msib.inventory_item_id=A.inventory_item_id
AND msib.organization_id =
(SELECT mp.organization_id
FROM mtl_parameters mp
WHERE mp.organization_code = 'IMO'
-- AND msib.organization_id = 85
-- and msib.segment1 like '475%'
--AND msib.segment1 like 'TREX%'
AND EXISTS
(SELECT 1
FROM fnd_lookup_values
WHERE lookup_type = 'EMR CSI OUTBOUND INTERFACE PSG'
AND language = 'US'
AND tag ='ALL TREX ITEMS'
AND SUBSTR(lookup_code,1,4) = SUBSTR(msib.segment1,1,4)
--and DESCRIPTION = 'Items to be Interfaced from Oracle EBS to ECS'
AND A.last_update_date BETWEEN NVL(c_from ,to_date('07-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS')) AND NVL(c_to ,to_date('22-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS'))
UNION
SELECT
/*+ index(a CSI_ITEM_INSTANCES_X3)*/
---UPDATE MODE ITEM
A.creation_date ,
A.last_update_date ,
A.last_oe_order_line_id line_id ,
A.inventory_item_id ,
A.instance_id ,
A.instance_type_code ,
msib.segment1
FROM csi_item_instances A ,
mtl_system_items_b msib
WHERE 1=1
--AND a.instance_id = 33371916
--AND a.instance_id in (33371920,33371921,33371922,33371923,33371924,33371925,33371926,33371927,33371928,33371929,33371930)
AND msib.inventory_item_id=A.inventory_item_id
AND msib.organization_id =
(SELECT mp.organization_id
FROM mtl_parameters mp
WHERE mp.organization_code = 'IMO'
-- AND msib.organization_id = 85
-- and msib.segment1 like '475%'
--AND msib.segment1 like 'TREX%'
AND EXISTS
(SELECT 1
FROM fnd_lookup_values
WHERE lookup_type = 'EMR CSI OUTBOUND INTERFACE PSG'
AND language = 'US'
AND lookup_code = msib.segment1
--and DESCRIPTION = 'Items to be Interfaced from Oracle EBS to ECS'
AND A.last_update_date BETWEEN NVL(c_from ,to_date('07-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS')) AND NVL(c_to ,to_date('22-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS'))
AND EXISTS
(SELECT
/*+ index(ct CSI_TRANSACTIONS_U01)*/
1
FROM csi_item_instances_h h ,
csi_transactions ct
WHERE 1 =1
AND ct.transaction_type_id IN (1)
AND ct.transaction_id = h.transaction_id
AND ct.last_update_date BETWEEN NVL(c_from ,to_date('07-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS')) AND NVL(c_to ,to_date('22-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS'))
AND A.instance_id =h.instance_id
UNION
SELECT
/*+ index(a CSI_ITEM_INSTANCES_X3)*/
---UPDATE MODE SEARCH
A.creation_date ,
A.last_update_date ,
A.last_oe_order_line_id line_id ,
A.inventory_item_id ,
A.instance_id ,
A.instance_type_code ,
msib.segment1
FROM csi_item_instances A ,
mtl_system_items_b msib
WHERE 1=1
--AND a.instance_id = 33371916
--AND a.instance_id in (33371920,33371921,33371922,33371923,33371924,33371925,33371926,33371927,33371928,33371929,33371930)
AND msib.inventory_item_id=A.inventory_item_id
AND msib.organization_id =
(SELECT mp.organization_id
FROM mtl_parameters mp
WHERE mp.organization_code = 'IMO'
-- AND msib.organization_id = 85
-- and msib.segment1 like '475%'
--AND msib.segment1 like 'TREX%'
AND EXISTS
(SELECT 1
FROM fnd_lookup_values
WHERE lookup_type = 'EMR CSI OUTBOUND INTERFACE PSG'
AND language = 'US'
AND tag ='ALL TREX ITEMS'
AND SUBSTR(lookup_code,1,4) = SUBSTR(msib.segment1,1,4)
--and DESCRIPTION = 'Items to be Interfaced from Oracle EBS to ECS'
AND A.last_update_date BETWEEN NVL(c_from ,to_date('07-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS')) AND NVL(c_to ,to_date('22-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS'))
AND EXISTS
(SELECT
/*+ index(ct CSI_TRANSACTIONS_U01)*/
1
FROM csi_item_instances_h h ,
csi_transactions ct
WHERE 1 =1
AND ct.transaction_type_id IN (1)
AND ct.transaction_id = h.transaction_id
AND ct.last_update_date BETWEEN NVL(c_from ,to_date('07-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS')) AND NVL(c_to ,to_date('22-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS'))
AND A.instance_id =h.instance_id
ORDER BY 1 DESC,
2 ;
CURSOR cur_get_child_ib_rec(c_instance_id NUMBER)
IS
SELECT cir.subject_id
FROM csi.csi_ii_relationships cir
WHERE cir.object_id = c_instance_id;
CURSOR cur_get_outbound_data(c_instance_id NUMBER)
IS
SELECT cii.instance_id instance_id,
cii.instance_number instance_number,
cii.inventory_item_id inventory_item_id,
msi.segment1 segment1, --CONCATENATED_SEGMENTS,
msi.description description, --DESCRIPTION,
cii.inv_master_organization_id master_organization_id,
cii.serial_number serial_number,
cii.system_id system_id,
cst.NAME system_name,
cii.quantity quantity,
cii.unit_of_measure uom,
cii.active_start_date active_start_date,
cii.active_end_date active_end_date,
cii.install_date install_date,
cii.object_version_number object_version_number,
cii.last_vld_organization_id,
hou.NAME pre_registration_location,
looh.header_id last_header_id,
looh.order_number emerson_order_number,
cii.last_oe_order_line_id order_line_id,
NVL(lool.actual_shipment_date, lool.fulfillment_date) actual_shipment_date,
(SELECT DISTINCT pap.email_address
FROM fnd_user fu ,
per_all_people_f pap
WHERE fu.employee_id = pap.person_id
and sysdate between pap.effective_start_date and nvl(pap.effective_end_date, sysdate)
AND fu.user_id = NVL(wdd.created_by,lool.created_by)
) email_address,
(SELECT DISTINCT hp.party_name
FROM hz_parties hp,
hz_party_sites hps ,
hz_party_site_uses hpsu ,
hz_locations hl
WHERE hp.party_id = hps.party_id
AND hps.location_id = hl.location_id
AND hps.party_site_id = hpsu.party_site_id(+)
AND hps.party_site_id =
(SELECT hcasa.party_site_id
FROM apps.hz_cust_acct_sites hcasa
WHERE hcasa.cust_acct_site_id =
(SELECT hcsua.cust_acct_site_id
FROM apps.hz_cust_site_uses hcsua
WHERE cia.bill_to_address = hcsua.site_use_id
) AS "Bill_To_company_name",--------------------------CH-ID-1.1 STARTS-----------
(SELECT DISTINCT hps.party_site_id
FROM hz_parties hp,
hz_party_sites hps ,
hz_party_site_uses hpsu ,
hz_locations hl
WHERE hp.party_id = hps.party_id
AND hps.location_id = hl.location_id
AND hps.party_site_id = hpsu.party_site_id(+)
AND hps.party_site_id =
(SELECT hcasa.party_site_id
FROM apps.hz_cust_acct_sites hcasa
WHERE hcasa.cust_acct_site_id =
(SELECT hcsua.cust_acct_site_id
FROM apps.hz_cust_site_uses hcsua
WHERE cia.bill_to_address = hcsua.site_use_id
) AS "BILL_TO_party_SITE_ID",
(SELECT DISTINCT hl.state
FROM hz_parties hp,
hz_party_sites hps ,
hz_party_site_uses hpsu ,
hz_locations hl
WHERE hp.party_id = hps.party_id
AND hps.location_id = hl.location_id
AND hps.party_site_id = hpsu.party_site_id(+)
AND hps.party_site_id =
(SELECT hcasa.party_site_id
FROM apps.hz_cust_acct_sites hcasa
WHERE hcasa.cust_acct_site_id =
(SELECT hcsua.cust_acct_site_id
FROM apps.hz_cust_site_uses hcsua
WHERE cia.bill_to_address = hcsua.site_use_id
) AS "BILL_TO_STATE",
(SELECT DISTINCT hl.country
FROM hz_parties hp,
hz_party_sites hps ,
hz_party_site_uses hpsu ,
hz_locations hl
WHERE hp.party_id = hps.party_id
AND hps.location_id = hl.location_id
AND hps.party_site_id = hpsu.party_site_id(+)
AND hps.party_site_id =
(SELECT hcasa.party_site_id
FROM apps.hz_cust_acct_sites hcasa
WHERE hcasa.cust_acct_site_id =
(SELECT hcsua.cust_acct_site_id
FROM apps.hz_cust_site_uses hcsua
WHERE cia.bill_to_address = hcsua.site_use_id
) AS "BILL_TO_COUNTRY",
(SELECT DISTINCT hl.city
FROM hz_parties hp,
hz_party_sites hps ,
hz_party_site_uses hpsu ,
hz_locations hl
WHERE hp.party_id = hps.party_id
AND hps.location_id = hl.location_id
AND hps.party_site_id = hpsu.party_site_id(+)
AND hps.party_site_id =
(SELECT hcasa.party_site_id
FROM apps.hz_cust_acct_sites hcasa
WHERE hcasa.cust_acct_site_id =
(SELECT hcsua.cust_acct_site_id
FROM apps.hz_cust_site_uses hcsua
WHERE cia.bill_to_address = hcsua.site_use_id
) AS "BILL_TO_CITY",
(SELECT DISTINCT hl.address1
FROM hz_parties hp,
hz_party_sites hps ,
hz_party_site_uses hpsu ,
hz_locations hl
WHERE hp.party_id = hps.party_id
AND hps.location_id = hl.location_id
AND hps.party_site_id = hpsu.party_site_id(+)
AND hps.party_site_id =
(SELECT hcasa.party_site_id
FROM apps.hz_cust_acct_sites hcasa
WHERE hcasa.cust_acct_site_id =
(SELECT hcsua.cust_acct_site_id
FROM apps.hz_cust_site_uses hcsua
WHERE cia.bill_to_address = hcsua.site_use_id
) AS "BILL_TO_LOCATION",
(SELECT DISTINCT hp.party_name
FROM hz_parties hp,
hz_party_sites hps,
hz_party_site_uses hpsu,
hz_locations hl
WHERE hp.party_id = hps.party_id
AND hps.location_id = hl.location_id
AND hps.party_site_id = hpsu.party_site_id(+)
AND hps.party_site_id =
(SELECT hcasa.party_site_id
FROM apps.hz_cust_acct_sites hcasa
WHERE hcasa.cust_acct_site_id =
(SELECT hcsua.cust_acct_site_id
FROM apps.hz_cust_site_uses hcsua
WHERE cia.ship_to_address = hcsua.site_use_id
) AS "Ship_to_company_name",
(SELECT DISTINCT hps.party_site_id
FROM hz_parties hp,
hz_party_sites hps ,
hz_party_site_uses hpsu ,
hz_locations hl
WHERE hp.party_id = hps.party_id
AND hps.location_id = hl.location_id
AND hps.party_site_id = hpsu.party_site_id(+)
AND hps.party_site_id =
(SELECT hcasa.party_site_id
FROM apps.hz_cust_acct_sites hcasa
WHERE hcasa.cust_acct_site_id =
(SELECT hcsua.cust_acct_site_id
FROM apps.hz_cust_site_uses hcsua
WHERE cia.bill_to_address = hcsua.site_use_id
) AS "SHIP_TO_party_SITE_ID",
(SELECT DISTINCT hl.state
FROM hz_parties hp,
hz_party_sites hps ,
hz_party_site_uses hpsu ,
hz_locations hl
WHERE hp.party_id = hps.party_id
AND hps.location_id = hl.location_id
AND hps.party_site_id = hpsu.party_site_id(+)
AND hps.party_site_id =
(SELECT hcasa.party_site_id
FROM apps.hz_cust_acct_sites hcasa
WHERE hcasa.cust_acct_site_id =
(SELECT hcsua.cust_acct_site_id
FROM apps.hz_cust_site_uses hcsua
WHERE cia.bill_to_address = hcsua.site_use_id
) AS "SHIP_TO_STATE",
(SELECT DISTINCT hl.country
FROM hz_parties hp,
hz_party_sites hps ,
hz_party_site_uses hpsu ,
hz_locations hl
WHERE hp.party_id = hps.party_id
AND hps.location_id = hl.location_id
AND hps.party_site_id = hpsu.party_site_id(+)
AND hps.party_site_id =
(SELECT hcasa.party_site_id
FROM apps.hz_cust_acct_sites hcasa
WHERE hcasa.cust_acct_site_id =
(SELECT hcsua.cust_acct_site_id
FROM apps.hz_cust_site_uses hcsua
WHERE cia.bill_to_address = hcsua.site_use_id
) AS "SHIP_TO_COUNTRY",
(SELECT DISTINCT hl.city
FROM hz_parties hp,
hz_party_sites hps ,
hz_party_site_uses hpsu ,
hz_locations hl
WHERE hp.party_id = hps.party_id
AND hps.location_id = hl.location_id
AND hps.party_site_id = hpsu.party_site_id(+)
AND hps.party_site_id =
(SELECT hcasa.party_site_id
FROM apps.hz_cust_acct_sites hcasa
WHERE hcasa.cust_acct_site_id =
(SELECT hcsua.cust_acct_site_id
FROM apps.hz_cust_site_uses hcsua
WHERE cia.bill_to_address = hcsua.site_use_id
) AS "SHIP_TO_CITY",
(SELECT DISTINCT hl.address1
FROM hz_parties hp,
hz_party_sites hps ,
hz_party_site_uses hpsu ,
hz_locations hl
WHERE hp.party_id = hps.party_id
AND hps.location_id = hl.location_id
AND hps.party_site_id = hpsu.party_site_id(+)
AND hps.party_site_id =
(SELECT hcasa.party_site_id
FROM apps.hz_cust_acct_sites hcasa
WHERE hcasa.cust_acct_site_id =
(SELECT hcsua.cust_acct_site_id
FROM apps.hz_cust_site_uses hcsua
WHERE cia.bill_to_address = hcsua.site_use_id
) AS "SHIP_TO_LOCATION",
(SELECT DISTINCT hl.postal_code
FROM hz_parties hp,
hz_party_sites hps ,
hz_party_site_uses hpsu ,
hz_locations hl
WHERE hp.party_id = hps.party_id
AND hps.location_id = hl.location_id
AND hps.party_site_id = hpsu.party_site_id(+)
AND hps.party_site_id =
(SELECT hcasa.party_site_id
FROM apps.hz_cust_acct_sites hcasa
WHERE hcasa.cust_acct_site_id =
(SELECT hcsua.cust_acct_site_id
FROM apps.hz_cust_site_uses hcsua
WHERE cia.bill_to_address = hcsua.site_use_id
) AS "SHIP_TO_PIN_CODE",
(SELECT DISTINCT hl.postal_code
FROM hz_parties hp,
hz_party_sites hps ,
hz_party_site_uses hpsu ,
hz_locations hl
WHERE hp.party_id = hps.party_id
AND hps.location_id = hl.location_id
AND hps.party_site_id = hpsu.party_site_id(+)
AND hps.party_site_id =
(SELECT hcasa.party_site_id
FROM apps.hz_cust_acct_sites hcasa
WHERE hcasa.cust_acct_site_id =
(SELECT hcsua.cust_acct_site_id
FROM apps.hz_cust_site_uses hcsua
WHERE cia.bill_to_address = hcsua.site_use_id
) AS "BILL_TO_PIN_CODE",
(SELECT hcsua.LOCATION
FROM apps.hz_cust_site_uses_all hcsua
WHERE cia.ship_to_address = hcsua.site_use_id
) "SHIP_TO_NUMBER",
(SELECT hcsua.LOCATION
FROM apps.hz_cust_site_uses_all hcsua
WHERE cia.bill_to_address = hcsua.site_use_id
) "BILL_TO_NUMBER",
(SELECT DISTINCT hca.account_number
FROM hz_cust_accounts hca
WHERE hca.cust_account_id =
(SELECT hcasa.cust_account_id
FROM apps.hz_cust_acct_sites hcasa
WHERE hcasa.cust_acct_site_id =
(SELECT hcsua.cust_acct_site_id
FROM apps.hz_cust_site_uses hcsua
WHERE cia.bill_to_address = hcsua.site_use_id
)AS "CUSTOMER_NUMBER", --------------------------CH-ID-1.1 ENDS -----------
(SELECT civ.attribute_value
FROM csi_iea_values civ,
csi_i_extended_attribs ciea
WHERE civ.attribute_id = ciea.attribute_id
AND ciea.attribute_code = '011 LICENSE NUMBER'
AND civ.instance_id = cii.instance_id
) AS "EA_LICENSE_NUMBER",
(SELECT civ.attribute_value
FROM csi_iea_values civ,
csi_i_extended_attribs ciea
WHERE civ.attribute_id = ciea.attribute_id
AND ciea.attribute_code = 'VA_SALES_ORDER_NUMBER'
AND civ.instance_id = cii.instance_id
) AS "EA_VA_SALES_ORDER_NUM",
(SELECT NAME
FROM hr_all_organization_units
WHERE organization_id = cii.inv_master_organization_id
) master_organization_name
FROM csi_item_instances cii,
csi_systems_tl cst,
-- MTL_SYSTEM_ITEMS_VL MSIKFV,
-- MTL_SYSTEM_ITEMS MSI,
mtl_system_items_b msi,
hr_all_organization_units hou,
oe_order_lines lool,
oe_order_headers looh,
wsh_delivery_details wdd,
csi_i_parties cip,
csi_ip_accounts cia
WHERE cii.last_vld_organization_id = msi.organization_id
AND cii.inventory_item_id = msi.inventory_item_id
-- AND CII.LAST_VLD_ORGANIZATION_ID = MSIKFV.ORGANIZATION_ID
-- AND CII.INVENTORY_ITEM_ID = MSIKFV.INVENTORY_ITEM_ID
AND hou.organization_id(+) = cii.last_vld_organization_id
AND cii.last_oe_order_line_id = lool.line_id
AND lool.header_id = looh.header_id
AND cii.last_oe_order_line_id = wdd.source_line_id
-- AND WDD.SOURCE_LINE_ID = LOOL.LINE_ID
-- AND WDD.SOURCE_HEADER_ID = LOOH.HEADER_ID
AND cii.instance_id = cip.instance_id
AND cii.system_id = cst.system_id(+)
AND cip.party_source_table = 'HZ_PARTIES'
AND cip.relationship_type_code = 'OWNER'
AND cip.instance_party_id = cia.instance_party_id
AND cia.relationship_type_code(+) = 'OWNER'
AND cii.instance_status_id = 1052
AND cst.language(+) = 'US'
AND cii.instance_id = c_instance_id;
CURSOR cur_get_ib_warranty (c_instance_id NUMBER)
IS
SELECT kh.contract_number,
kh.scs_code,
kh.start_date,
kh.end_date,
(kh.end_date-kh.start_date) duration,
clet.NAME coverage_name,
clet.item_description coverage_desc,
b.segment1 service_name,
t.description service_desc
FROM okc_k_headers_b kh,
okc_k_lines_b kl,
okc_k_items ki,
csi_item_instances c,
mtl_system_items_b i,
okc_k_lines_b cleb,
okc_k_lines_tl clet,
okc_k_items ki1,
mtl_system_items_b_kfv b,
mtl_system_items_tl t
WHERE kh.contract_number_modifier IS NULL
AND kh.ID = kl.dnz_chr_id
AND kh.ID = ki.dnz_chr_id
AND kl.ID = ki.cle_id
AND ki.jtot_object1_code IN ('OKX_CUSTPROD')
AND c.last_vld_organization_id = i.organization_id
AND ki.object1_id1 = TO_CHAR(c.instance_id)
AND c.inventory_item_id = i.inventory_item_id
AND kl.cle_id = cleb.cle_id
AND cleb.ID = clet.ID
AND clet.language = userenv('LANG')
AND cleb.lse_id IN (2,15,20)
AND cleb.cle_id = ki1.cle_id
AND b.inventory_item_id = t.inventory_item_id
AND b.organization_id = t.organization_id
AND t.language = userenv('LANG')
AND to_number(ki1.object1_id1) = b.inventory_item_id
AND to_number(ki1.object1_id2) = b.organization_id
AND c.instance_id = c_instance_id;
--v1.2 comment ends
CURSOR cur_get_to_date( c_req_id NUMBER,c_conc_prog_id NUMBER)
IS
SELECT requested_start_date
FROM fnd_concurrent_requests
WHERE request_id = c_req_id
AND concurrent_program_id = c_conc_prog_id;
/*Record Type Declaration*/
TYPE ib_ecs_dat_record
IS
record
instance_id csi_item_instances.instance_id%TYPE,
instance_number csi_item_instances.instance_number%TYPE,
inventory_item_id csi_item_instances.inventory_item_id%TYPE,
segment1 mtl_system_items_b.segment1%TYPE,
description mtl_system_items_b.description%TYPE,
master_organization_id csi_item_instances.inv_master_organization_id%TYPE,
serial_number csi_item_instances.serial_number%TYPE,
system_id csi_item_instances.system_id%TYPE,
system_name csi_systems_tl.NAME%TYPE,
quantity csi_item_instances.quantity%TYPE,
uom csi_item_instances.unit_of_measure%TYPE,
active_start_date csi_item_instances.active_start_date%TYPE,
active_end_date csi_item_instances.active_end_date%TYPE,
install_date csi_item_instances.install_date%TYPE,
obj_version_num csi_item_instances.object_version_number%TYPE,
last_vld_organization_id csi_item_instances.last_vld_organization_id%TYPE,
pre_registration_location VARCHAR2(500),
order_header_id oe_order_headers_all.header_id%TYPE,
order_number oe_order_headers_all.order_number%TYPE,
order_line_id csi_item_instances.last_oe_order_line_id%TYPE,
actual_shipment_date oe_order_lines_all.actual_shipment_date%TYPE,
email_address per_all_people_f.email_address%TYPE,
bill_to_company_name hz_parties.party_name%TYPE,
bill_to_site_id hz_party_sites.party_site_id%TYPE,
bill_to_state hz_locations.state%TYPE,
bill_to_country hz_locations.country%TYPE,
bill_to_city hz_locations.city%TYPE,
bill_to_location hz_locations.address1%TYPE,
ship_to_company_name hz_parties.party_name%TYPE,
ship_to_site_id hz_party_sites.party_site_id%TYPE,
ship_to_state hz_locations.state%TYPE,
ship_to_country hz_locations.country%TYPE,
ship_to_city hz_locations.city%TYPE,
ship_to_location hz_locations.address1%TYPE,
ship_to_pin_code hz_locations.postal_code%TYPE,
bill_to_pin_code hz_locations.postal_code%TYPE,
ship_to_number hz_cust_site_uses_all.LOCATION%TYPE,
bill_to_number hz_cust_site_uses_all.LOCATION%TYPE,
customer_number hz_cust_accounts.account_number%TYPE,
ea_license_number csi_iea_values.attribute_value%TYPE,
ea_va_sales_order_num csi_iea_values.attribute_value%TYPE,
master_organization_name hr_all_organization_units.NAME%TYPE );
TYPE tab_typ_ib_ecs_dat
IS
TABLE OF ib_ecs_dat_record INDEX BY binary_integer;
TYPE ib_parent_dat_record
IS
record
creation_date DATE,
last_update_date DATE,
order_line_id csi_item_instances.last_oe_order_line_id%TYPE,
inventory_item_id csi_item_instances.inventory_item_id%TYPE,
instance_id csi_item_instances.instance_id%TYPE,
instance_type_code csi_item_instances.instance_type_code%TYPE,
segment1 mtl_system_items_b.segment1%TYPE );
TYPE tab_typ_ib_parent_dat
IS
TABLE OF ib_parent_dat_record INDEX BY binary_integer;
--/*Record Type Declaration*/
-- TYPE parent_ib_record IS RECORD (
-- creation_date csi_item_instances.creation_date%TYPE,
-- last_update_date csi_item_instances.last_update_date%TYPE,
-- inventory_item_id csi_item_instances.inventory_item_id%TYPE,
-- instance_id csi_item_instances.instance_id%TYPE,
-- instance_type_code csi_item_instances.instance_type_code%TYPE,
-- segment1 mtl_system_items_b.segment1%type
-- TYPE tab_typ_par_ib_collection IS TABLE OF parent_ib_record
-- INDEX BY BINARY_INTEGER;
-- tab_par_ib_rec tab_typ_par_ib_collection;
v_segment1 mtl_system_items_b.segment1%TYPE;
v_request_id NUMBER := fnd_global.conc_request_id;
v_conc_prog_id NUMBER := fnd_global.conc_program_id;
v_created_by NUMBER := fnd_profile.VALUE('USER_ID');
v_last_update_login NUMBER := fnd_global.login_id;
v_to DATE := SYSDATE;
v_from DATE := SYSDATE-100;
v_count NUMBER := NULL;
-- v_header_id NUMBER := NULL;
-- v_line_id NUMBER := NULL;
-- v_org_id NUMBER := NULL;
-- v_ship_from_org_id NUMBER := NULL;
--v1.2 begin
-- v_master_org_id NUMBER := NULL;
-- v_item_type VARCHAR2(100) := null;
-- v_top_model_line_id NUMBER := NULL;
-- v_serial_tag_number VARCHAR2(100) := null;
TYPE tbl_req_start_date_type
IS
TABLE OF DATE INDEX BY pls_integer;
tbl_req_start_date tbl_req_start_date_type;
--v1.2 ends
--v1.3 starts
-- v_flow_status_code VARCHAR2(100) := null;
-- v_line_number NUMBER := NULL;
-- v_shipment_number NUMBER := NULL;
-- v_option_number NUMBER := NULL;
-- v_component_number NUMBER := NULL;
-- v_service_number NUMBER := NULL;
--v1.3 ends
-- v_model_string VARCHAR2(100) := NULL;
-- v_end_cust NUMBER := NULL;
-- v_end_cust_site_id NUMBER := NULL;
-- v_location_type_code VARCHAR2(100) := null;
-- v_location_id NUMBER := NULL;
-- v_tag VARCHAR2(100) := NULL;
-- v_inventory_item_status VARCHAR2(100) := NULL;
-- v_serial_number VARCHAR2(100) := NULL;
-- v_serial_return VARCHAR2(200) := NULL;
--rec_ext_attr Rec_Ext_Attr_type ;
v_ret_error_message VARCHAR2(2000):= NULL;
v_ret_error_flag VARCHAR2(1) := NULL;
v_error_message VARCHAR2(2000):= NULL;
v_error_flag VARCHAR2(1) := NULL;
v_error_at VARCHAR2(100) := NULL;
-- v_to1 DATE := sysdate;
-- v_from1 DATE := sysdate-45;
tab_ib_parent_dat tab_typ_ib_parent_dat;
tab_ib_ecs_dat tab_typ_ib_ecs_dat;
tab_ib_ecs_dat_c tab_typ_ib_ecs_dat;
BEGIN
print_log('*********************************************************************');
print_log('print log message 01');
print_log('Process Starts... : '||to_date(SYSDATE,'DD-MON-YYYY HH24:MI:SS'));
v_error_at := 'Start of the process';
fnd_client_info.set_org_context(i_org_id);
-- v1.2 begins, to get from date ----==----
BEGIN
print_log('print log message 02');
--OPEN get_from_date( v_request_id,v_conc_prog_id);
--FETCH get_from_date INTO v_from;
--CLOSE get_from_date;
v_error_at := 'main Process/ before from ';
-- v_from := Sysdate-15;
v_from := SYSDATE-45;
--Added v1.4 ,AND ARGUMENT1 = i_org_id
SELECT
/*+ index(a FND_CONCURRENT_REQUESTS_N6) index(a FND_CONCURRENT_REQUESTS_N7)*/
requested_start_date BULK COLLECT
INTO tbl_req_start_date
FROM fnd_concurrent_requests
WHERE request_id < v_request_id
AND concurrent_program_id = v_conc_prog_id
AND argument1 = i_org_id
AND status_code ='C'
AND phase_code ='C';
v_error_at := 'main Process/ after from selection ';
IF tbl_req_start_date.count >0 THEN
FOR i IN tbl_req_start_date.FIRST .. tbl_req_start_date.LAST
LOOP
IF v_from < tbl_req_start_date(i) THEN
v_from := tbl_req_start_date(i);
print_log( 'Tabel Req StartDate : '||tbl_req_start_date(i));
print_log( 'In the Loop VFrom : '||v_from);
END IF;
END LOOP;
END IF;
v_error_at := 'main Process/ after from Loop ';
print_log( 'Out the loop v_from is : '||v_from);
EXCEPTION
WHEN no_data_found THEN
print_log('Error in from_date process exception : '||sqlerrm);
print_log('Error at : '||v_error_at);
v_from := NULL;
WHEN OTHERS THEN
print_log('Error in from_date process exception : '||sqlerrm);
print_log('Error at : '||v_error_at);
v_from := NULL;
END;
-- v1.2 ends---==----
print_log('print log message 03');
BEGIN
OPEN cur_get_to_date ( v_request_id,v_conc_prog_id);
FETCH cur_get_to_date INTO v_to;
CLOSE cur_get_to_date;
--v1.3 starts
v_update_date := v_to -(1/86400);
--v1.3 ends
v_error_at := 'main Process/ after from and to date';
print_log('v_from1... : '||TO_CHAR(v_from,'DD-MON-YYYY HH24:MI:SS'));
print_log('v_to1 ... : '||TO_CHAR(v_to ,'DD-MON-YYYY HH24:MI:SS'));
--v1.3 starts
print_log('Updated v_to ... : '||TO_CHAR(v_update_date ,'DD-MON-YYYY HH24:MI:SS'));
--v1.3 ends
EXCEPTION
WHEN no_data_found THEN
print_log('Error in main process1 : '||sqlerrm);
print_log('Error at : '||v_error_at);
WHEN OTHERS THEN
print_log('Error in main process1 : '||sqlerrm);
print_log('Error at : '||v_error_at);
END;
BEGIN
print_log('print log message 04');
OPEN cur_get_parent_ib_rec(v_from ,v_to);
LOOP
print_log('After Loop Get Records v_from... : '||TO_CHAR(v_from,'DD-MON-YYYY HH24:MI:SS'));
print_log('After Loop Get Records v_to ... : '||TO_CHAR(v_to ,'DD-MON-YYYY HH24:MI:SS'));
FETCH cur_get_parent_ib_rec BULK COLLECT INTO tab_ib_parent_dat;
print_log('Parent Instance first : ');
-- FOR i IN 1 .. tab_ib_parent_dat.COUNT
print_log('print log message 05');
FOR i IN tab_ib_parent_dat.FIRST .. tab_ib_parent_dat.LAST
LOOP
BEGIN
print_log('Parent Instance : '||tab_ib_parent_dat(i).instance_id);
print_log('====================================================================');
v_error_at := 'main Process/ start of the loop';
v_ret_error_flag := NULL;
v_segment1 := NULL;
EXCEPTION
WHEN no_data_found THEN
print_log('Error in main process exception1 : '||sqlerrm);
print_log('Error at : '||v_error_at);
WHEN OTHERS THEN
print_log('Error in main process exception1 : '||sqlerrm);
print_log('Error at : '||v_error_at);
END;
OPEN cur_get_outbound_data(tab_ib_parent_dat(i).instance_id);
LOOP
FETCH cur_get_outbound_data BULK COLLECT INTO tab_ib_ecs_dat;
--FOR j IN 1 .. tab_ib_ecs_dat.COUNT
FOR j IN tab_ib_ecs_dat.FIRST .. tab_ib_ecs_dat.LAST
LOOP
BEGIN
BEGIN
SELECT COUNT(1)
INTO v_count
FROM apps.xxcsi_trex_ob_ecs_mhm
WHERE instance_id = NVL(tab_ib_ecs_dat_c(j).instance_id,'');
EXCEPTION
WHEN OTHERS THEN
v_count := 0;
END;
print_log('v_count : '||v_count);
IF v_count = 0 THEN
-- print_log('PARENT_DAT: '||NVL(tab_ib_ecs_dat(j).instance_id);
print_log('print log message 06');
INSERT
INTO xxcsi_trex_ob_ecs_mhm
instance_id,
instance_number,
inventory_item_id,
unit,
unit_name,
master_organization_id,
serial_number,
quantity,
uom,
active_start_date,
active_end_date,
install_date,
object_version_number,
last_vld_organization_id,
pre_registration_location,
order_header_id,
order_number,
order_line_id,
pre_registration_date,
pre_registration_operator,
bill_to_customer_name,
bill_to_site_id ,
bill_to_state ,
bill_to_country ,
bill_to_city ,
bill_to_location ,
ship_to_customer_name,
ship_to_site_id ,
ship_to_state ,
ship_to_country ,
ship_to_city ,
ship_to_location,
ship_to_pin_code,
bill_to_pin_code,
ship_to_number,
bill_to_number,
customer_number,
ea_license_number,
ea_va_sales_order_number,
parent_instance_id,
parent_y_n,
process_flag,
error_code,
error_details,
request_id,
created_by,
creation_date,
last_updated_by,
last_update_date,
last_update_login,
eai_process_flag,
master_organization_name,
system_id,
system_name
VALUES
NVL(tab_ib_ecs_dat(j).instance_id,''),
NVL(tab_ib_ecs_dat(j).instance_number,''),
NVL(tab_ib_ecs_dat(j).inventory_item_id,''),
NVL(tab_ib_ecs_dat(j).segment1,''),
NVL(tab_ib_ecs_dat(j).description,''),
NVL(tab_ib_ecs_dat(j).master_organization_id,''),
NVL(tab_ib_ecs_dat(j).serial_number,''),
NVL(tab_ib_ecs_dat(j).quantity,''),
NVL(tab_ib_ecs_dat(j).uom,''),
NVL(tab_ib_ecs_dat(j).active_start_date,''),
NVL(tab_ib_ecs_dat(j).active_end_date,''),
NVL(tab_ib_ecs_dat(j).install_date,''),
NVL(tab_ib_ecs_dat(j).obj_version_num,''),
NVL(tab_ib_ecs_dat(j).last_vld_organization_id,''),
NVL(tab_ib_ecs_dat(j).pre_registration_location,''),
NVL(tab_ib_ecs_dat(j).order_header_id,''),
NVL(tab_ib_ecs_dat(j).order_number,''),
NVL(tab_ib_ecs_dat(j).order_line_id,''),
NVL(tab_ib_ecs_dat(j).actual_shipment_date,''),
NVL(tab_ib_ecs_dat(j).email_address,''),
NVL(tab_ib_ecs_dat(j).bill_to_company_name,''),
NVL(tab_ib_ecs_dat(j).bill_to_site_id,''),
NVL(tab_ib_ecs_dat(j).bill_to_state,''),
NVL(tab_ib_ecs_dat(j).bill_to_country,''),
NVL(tab_ib_ecs_dat(j).bill_to_city,''),
NVL(tab_ib_ecs_dat(j).bill_to_location,''),
NVL(tab_ib_ecs_dat(j).ship_to_company_name,''),
NVL(tab_ib_ecs_dat(j).ship_to_site_id,''),
NVL(tab_ib_ecs_dat(j).ship_to_state,''),
NVL(tab_ib_ecs_dat(j).ship_to_country,''),
NVL(tab_ib_ecs_dat(j).ship_to_city,''),
NVL(tab_ib_ecs_dat(j).ship_to_location,''),
NVL(tab_ib_ecs_dat(j).ship_to_pin_code,''),
NVL(tab_ib_ecs_dat(j).bill_to_pin_code,''),
NVL(tab_ib_ecs_dat(j).ship_to_number,''),
NVL(tab_ib_ecs_dat(j).bill_to_number,''),
NVL(tab_ib_ecs_dat(j).customer_number,''),
NVL(tab_ib_ecs_dat(j).ea_license_number,''),
NVL(tab_ib_ecs_dat(j).ea_va_sales_order_num,''),
NULL,
'P',
'N',
NULL,
NULL,
v_request_id,
v_created_by,
SYSDATE,
v_created_by,
SYSDATE,
v_last_update_login,
'N',
NVL(tab_ib_ecs_dat(j).master_organization_name,''),
NVL(tab_ib_ecs_dat(j).system_id,''),
NVL(tab_ib_ecs_dat(j).system_name,'')
ELSE
Update apps.xxcsi_trex_ob_ecs_mhm set
instance_id=NVL(tab_ib_ecs_dat_c(j).instance_id,''),
instance_number= NVL(tab_ib_ecs_dat_c(j).instance_number,''),
inventory_item_id= NVL(tab_ib_ecs_dat_c(j).inventory_item_id,''),
unit = NVL(tab_ib_ecs_dat_c(j).segment1,''),
unit_name = NVL(tab_ib_ecs_dat_c(j).description,''),
master_organization_id=NVL(tab_ib_ecs_dat_c(j).master_organization_id,''),
--serial_number=NVL(tab_ib_ecs_dat_c(j).serial_number,''),
quantity= NVL(tab_ib_ecs_dat_c(j).quantity,''),
uom=NVL(tab_ib_ecs_dat_c(j).uom,''),
active_start_date= NVL(tab_ib_ecs_dat_c(j).active_start_date,''),
active_end_date= NVL(tab_ib_ecs_dat_c(j).active_end_date,''),
install_date= NVL(tab_ib_ecs_dat_c(j).install_date,''),
object_version_number=NVL(tab_ib_ecs_dat_c(j).obj_version_num,''),
last_vld_organization_id= NVL(tab_ib_ecs_dat_c(j).last_vld_organization_id,''),
pre_registration_location=NVL(tab_ib_ecs_dat_c(j).pre_registration_location,''),
order_header_id=NVL(tab_ib_ecs_dat_c(j).order_header_id,''),
order_number= NVL(tab_ib_ecs_dat_c(j).order_number,''),
order_line_id=NVL(tab_ib_ecs_dat_c(j).order_line_id,''),
pre_registration_date= NVL(tab_ib_ecs_dat_c(j).actual_shipment_date,''),
pre_registration_operator= NVL(tab_ib_ecs_dat_c(j).email_address,''),
bill_to_customer_name=NVL(tab_ib_ecs_dat_c(j).bill_to_company_name,''),
bill_to_site_id = NVL(tab_ib_ecs_dat_c(j).bill_to_site_id,''),
bill_to_state = NVL(tab_ib_ecs_dat_c(j).bill_to_state,''),
bill_to_country =NVL(tab_ib_ecs_dat_c(j).bill_to_country,''),
bill_to_city = NVL(tab_ib_ecs_dat_c(j).bill_to_city,''),
bill_to_location = NVL(tab_ib_ecs_dat_c(j).bill_to_location,''),
ship_to_customer_name=NVL(tab_ib_ecs_dat_c(j).ship_to_company_name,''),
ship_to_site_id = NVL(tab_ib_ecs_dat_c(j).ship_to_site_id,''),
ship_to_state =NVL(tab_ib_ecs_dat_c(j).ship_to_state,''),
ship_to_country=NVL(tab_ib_ecs_dat_c(j).ship_to_country,''),
ship_to_city =NVL(tab_ib_ecs_dat_c(j).ship_to_city,''),
ship_to_location= NVL(tab_ib_ecs_dat_c(j).ship_to_location,''),
ship_to_pin_code= NVL(tab_ib_ecs_dat_c(j).ship_to_pin_code,''),
bill_to_pin_code=NVL(tab_ib_ecs_dat_c(j).bill_to_pin_code,''),
ship_to_number=NVL(tab_ib_ecs_dat_c(j).ship_to_number,''),
bill_to_number= NVL(tab_ib_ecs_dat_c(j).bill_to_number,''),
customer_number= NVL(tab_ib_ecs_dat_c(j).customer_number,''),
ea_license_number= NVL(tab_ib_ecs_dat_c(j).ea_license_number,''),
ea_va_sales_order_number= NVL(tab_ib_ecs_dat_c(j).ea_va_sales_order_num,''),
parent_instance_id=NVL(tab_ib_parent_dat(i).instance_id,''),
parent_y_n='C',
process_flag='N',
error_code= NULL,
error_details= NULL,
request_id=v_request_id,
created_by=v_created_by,
creation_date= SYSDATE,
last_updated_by=v_created_by,
last_update_date=SYSDATE,
last_update_login= v_last_update_login,
eai_process_flag='Y',
master_organization_name=NVL(tab_ib_ecs_dat_c(j).master_organization_name,''),
system_id= NVL(tab_ib_ecs_dat_c(j).system_id,''),
system_name= NVL(tab_ib_ecs_dat_c(j).system_name,'')
WHERE instance_id = NVL(tab_ib_ecs_dat_c(j).instance_id,'');
END IF; --V_COUNT
EXCEPTION
WHEN no_data_found THEN
print_log('Error in inserting Parent Instance : '||tab_ib_ecs_dat(j).instance_id||': '||sqlerrm);
WHEN OTHERS THEN
print_log('Error in inserting Parent Instance : '||tab_ib_ecs_dat(j).instance_id||': '||sqlerrm);
END;
-- END LOOP;
END LOOP;
EXIT
WHEN cur_get_outbound_data%notfound;
END LOOP;
CLOSE cur_get_outbound_data;
print_log('print log message 07');
BEGIN
FOR rec_get_child_ib_rec IN cur_get_child_ib_rec
tab_ib_parent_dat(i).instance_id
LOOP
print_log
'cur_get_child_ib_rec : '||tab_ib_parent_dat(i).instance_id
OPEN cur_get_outbound_data(rec_get_child_ib_rec.subject_id);
LOOP
FETCH cur_get_outbound_data BULK COLLECT INTO tab_ib_ecs_dat_c;
-- tab_ib_ecs_dat_c1 := tab_ib_ecs_dat_c;
-- FOR k IN 1 .. tab_ib_ecs_dat_c.COUNT
FOR k IN tab_ib_ecs_dat_c.FIRST .. tab_ib_ecs_dat_c.LAST
LOOP
print_log('Child Instance : '||tab_ib_ecs_dat_c(k).instance_id);
-- BEGIN
BEGIN
SELECT COUNT(1)
INTO v_count
FROM apps.xxcsi_trex_ob_ecs_mhm
WHERE instance_id = NVL(tab_ib_ecs_dat_c(k).instance_id,'');
EXCEPTION
WHEN OTHERS THEN
v_count := 0;
END;
print_log('v_count : '||v_count);
IF v_count = 0 THEN
BEGIN
INSERT
INTO xxcsi_trex_ob_ecs_mhm
instance_id,
instance_number,
inventory_item_id,
unit,
unit_name,
master_organization_id,
serial_number,
quantity,
uom,
active_start_date,
active_end_date,
install_date,
object_version_number,
last_vld_organization_id,
pre_registration_location,
order_header_id,
order_number,
order_line_id,
pre_registration_date,
pre_registration_operator,
bill_to_customer_name,
bill_to_site_id ,
bill_to_state ,
bill_to_country ,
bill_to_city ,
bill_to_location ,
ship_to_customer_name,
ship_to_site_id ,
ship_to_state ,
ship_to_country ,
ship_to_city ,
ship_to_location ,
ship_to_pin_code,
bill_to_pin_code,
ship_to_number,
bill_to_number,
customer_number,
ea_license_number,
ea_va_sales_order_number,
parent_instance_id,
parent_y_n,
process_flag,
error_code,
error_details,
request_id,
created_by,
creation_date,
last_updated_by,
last_update_date,
last_update_login,
eai_process_flag,
master_organization_name,
system_id,
system_name
VALUES
NVL(tab_ib_ecs_dat_c(k).instance_id,''),
NVL(tab_ib_ecs_dat_c(k).instance_number,''),
NVL(tab_ib_ecs_dat_c(k).inventory_item_id,''),
NVL(tab_ib_ecs_dat_c(k).segment1,''),
NVL(tab_ib_ecs_dat_c(k).description,''),
NVL(tab_ib_ecs_dat_c(k).master_organization_id,''),
NVL(tab_ib_ecs_dat_c(k).serial_number,''),
NVL(tab_ib_ecs_dat_c(k).quantity,''),
NVL(tab_ib_ecs_dat_c(k).uom,''),
NVL(tab_ib_ecs_dat_c(k).active_start_date,''),
NVL(tab_ib_ecs_dat_c(k).active_end_date,''),
NVL(tab_ib_ecs_dat_c(k).install_date,''),
NVL(tab_ib_ecs_dat_c(k).obj_version_num,''),
NVL(tab_ib_ecs_dat_c(k).last_vld_organization_id,''),
NVL(tab_ib_ecs_dat_c(k).pre_registration_location,''),
NVL(tab_ib_ecs_dat_c(k).order_header_id,''),
NVL(tab_ib_ecs_dat_c(k).order_number,''),
NVL(tab_ib_ecs_dat_c(k).order_line_id,''),
NVL(tab_ib_ecs_dat_c(k).actual_shipment_date,''),
NVL(tab_ib_ecs_dat_c(k).email_address,''),
NVL(tab_ib_ecs_dat_c(k).bill_to_company_name,''),
NVL(tab_ib_ecs_dat_c(k).bill_to_site_id,''),
NVL(tab_ib_ecs_dat_c(k).bill_to_state,''),
NVL(tab_ib_ecs_dat_c(k).bill_to_counThe logic is:
1. Create any new lookup table rows that may be needed
2. Create new data rows that reference the lookup table
All you did was post a buch of code. You didn't post ANYTHING that shows how you executed that code or what the result was.
You need to SHOW US (not tell us):
1. WHAT you do
2. HOW you do it
3. WHAT results you get
4. WHAT results you expected to get
The code you posted has some SERIOUS ISSUES. Here are just three of them
1. You are using BULK COLLECT without a LIMIT clause
2. You are using unnecessary IF . . .COUNT statements to test collections for values. The FOR clause will simply NOT execute if the collection is empty so the IF statements add unnecessary clutter.
3. The first loop iterates a collection but sets a single SCALAR value - making that loop totally USELESS
LOOP
IF v_from < tbl_req_start_date(i) THEN
v_from := tbl_req_start_date(i);
print_log( 'Tabel Req StartDate : '||tbl_req_start_date(i));
print_log( 'In the Loop VFrom : '||v_from);
END IF;
END LOOP;
That checks EVERY row in the collection and appears to save the MAX value of 'tbl_req_state_date' into the 'v_from' variable.
What is the point of that? -
How to insert object values into table.
Hi All,
I have a problem with passing java object to procedure. Procedure is running properly when I execute in oracle,but it is not executing when I call from Java.
I am getting Error :
java.sql.SQLException: invalid name pattern: Pkg_Bulk_Insert.ITW_EMP_OBJ_ARRAY
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java)
at oracle.jdbc.oracore.OracleTypeADT.initMetadata(OracleTypeADT.java)
at oracle.jdbc.oracore.OracleTypeADT.init(OracleTypeADT.java)
at oracle.sql.ArrayDescriptor.initPickler(ArrayDescriptor.java)
at oracle.sql.ArrayDescriptor.<init>(ArrayDescriptor.java)
at oracle.sql.ArrayDescriptor.createDescriptor(ArrayDescriptor.java)
at JavaObjectToOracle.main(JavaObjectToOracle.java:31)
Here I am copying my procedure,oracle version is 9i.
Package specification:
CREATE OR REPLACE PACKAGE Pkg_Bulk_Insert AS
TYPE ITW_EMP_OBJ_ARRAY IS VARRAY(20) OF VARCHAR2(200);
PROCEDURE BULK_INSERT_TEST(strTable IN ITW_EMP_OBJ_ARRAY);
END Pkg_Bulk_Insert;
package body:
CREATE OR REPLACE PACKAGE BODY Pkg_Bulk_Insert AS
PROCEDURE BULK_INSERT_TEST(strTable IN ITW_EMP_OBJ_ARRAY) AS
i BINARY_INTEGER;
BEGIN
FORALL i IN 1..strTable.COUNT
INSERT INTO TEMP(NAME)
VALUES(strTable(i));
COMMIT;
END BULK_INSERT_TEST;
END Pkg_Bulk_Insert;
Here I am invoking the procedure:
DECLARE
x Pkg_Bulk_Insert.ITW_EMP_OBJ_ARRAY;
BEGIN
x := Pkg_Bulk_Insert.ITW_EMP_OBJ_ARRAY('A','B','C');
Pkg_Bulk_Insert.BULK_INSERT_TEST(x);
DBMS_OUTPUT.PUT_LINE('AFTER INSERTION');
END;
Please any body can help me on this regard.Your PL/SQL seems reasonable.
My suspicion would be that the oracle.sql.ArrayDescriptor.createDescriptor class only supports persistent collection types, i.e. those declared at the schema level with CREATE TYPE. -
Inserting duplicate values into mysql
I'm inserting rows of data into a mysql database using the mysql "ON DUPLICATE KEY UPDATE" syntax. I need to perform additional functions if a duplicate is found. How can I know that a duplicate update has been done?
set = ("insert into db values" + "('"+val1+"','"+val2+"','"+val3+"') ON DUPLICATE KEY UPDATE dup =" + "'"+var+"'");
statement.executeUpdate( set );I'm inserting rows of data into a mysql database
using the mysql "ON DUPLICATE KEY UPDATE" syntax. I
need to perform additional functions if a duplicate
is found. How can I know that a duplicate update has
been done?
set = ("insert into db values" +
"('"+val1+"','"+val2+"','"+val3+"') ON DUPLICATE KEY
UPDATE dup =" + "'"+var+"'");
statement.executeUpdate( set );you can check before inserting/updating if the record exists for instance... or even manage it all in your code (remove the "ON DUPLICATE..." and manage duplicates in your data access code) -
How to insert date value into oracle?
hi,
iam reading date from xml using vb.net and inserting it into oracle table.
the date value in xml file is in the format of "01012003".
i want to insert into oracle table.but iam getting an error "ORA-1843: not a valid month".
how to solve this problem.
Any suggestions or examples...That's not a date. It's just a string. Convert it to a date using,
DateTime d = DateTime.ParseExact("01022003", "MMddyyyy", null);
or
Dim d As DateTime = DateTime.ParseExact("01022003", "MMddyyyy", Nothing)
and then bind it to a parameter. ODP.NET will take it from there.
You should never be hard-coding the date literal into your SQL query.
David
Maybe you are looking for
-
When I got the Mac, iLife was installed. But as I slowly looked into my Mac, iWeb and iDVD was missing. I still can't find it and I really need to use it. They are not in the Mac App Store as well.
-
i tried to install master collection cs6, but it says one file is missing, download adobe support adviser. i did download. it said cpsid_82829s5 error. i tried all the solutions with bootstrapper but didnt work.
-
How to include not firmed receipt elements (PRs) in the LTP
Hi Experts, I have ran the LTP MRP using a particular planning scenario, but the results doesn't show any Purchase requisitions, Planned Orders, etc in the long-term window. It shows only firm receipt elements like Purchase Orders, Production Orders
-
Add a custom-field in the table MARC and manage it in MM01/MM02/MM03
Good day to all of you! I have this task: To add a custom-field to the table MARC. This custom-field will be managed through the MM01/MM02/MM03 transaction as follows: In the Basic Data 1 or Basic Data 2 the custom-field data will be added. Let's say
-
I am trying to set up a simple system for archiving and backing up photos using the best combination of iview and iphoto. As far as i understand, iphoto makes copies of the original photos to store in its own folder, and iview simply mnakes pointers