Create a procedure and inovke it to insert those values in to table
Hii
i created a procedure with parameters modes in it.
1 CREATE OR REPLACE PROCEDURE proc_salaris(emp_no IN emp.empno%type, sal_mon OUT emp.sal%type,hiredat_day OUT emp.hiredate%type) IS
BEGIN
SELECT hiredate, sal INTO hiredat_day, sal_mon from emp where empno = emp_no;
INSERT into emp_2(empno, sal, hiredate) values(emp_no, sal_mon,hiredat_day);
end;
SQL> /
Procedure created.
now ia m trying to invoke this procedure to populate the values in to table emp_2 which as structure of emp but no values.
declare
sal_mon emp.sal%type;
hiredat_day emp.hiredate%type;
begin
proc_sal(7844,sal_mon, hiredat_day);
end;
PL/SQL procedure successfully completed.
but when i see the data in the table i see no rows selected.
SQL> select * from emp_2;
no rows selected.
plz help
thanks
sharath
Strange procedure but cannot reproduce what you have posted here.
SQL> create table emp_2 as select * from emp where 1 = 2;
Table created.
Procedure created.
SQL> ed
Wrote file afiedt.buf
1 declare
2 sal_mon emp.sal%type;
3 hiredat_day emp.hiredate%type;
4 begin
5 proc_salaris(7844,sal_mon, hiredat_day);
6* end;
SQL> /
PL/SQL procedure successfully completed.
SQL> select * from emp_2;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7844 08.09.1981 00:00:00 1500
Similar Messages
-
Hello,
I want to create stored procedure which will give output rows from "values that are passed as one parameter (comma seperated) to store procedure".
Suppose ,
Parameter value : person 1,person2,person3
table structure :
Project Name | officers 1 | officers 2
here, officers 1 or officers 2 may contain names of multiple people.
expected OUTPUT : distinct list(rows) of projects where person 1 or person 2 or person 3 is either officer1 or officer 2.
please explain or provide solution in detail
- ThanksHi Visakh,
Thanks for reply.
But the solution you provided giving me right output only if officer 1 or officer 2 contains single value , not with comma seperated value.
Your solution is working fine for following scenario :
Project
Officers 1
Officers 2
p1
of11
off21
p2
of12
off22
with parameter : of11,off22 : it will give expected output
And its not working in case of :
Project
Officers 1
Officers 2
p1
of11,of12
off21,off23
p2
of12,of13
off22,off24
with parameter : of11,off22 : it will not give any row in output
I need patten matching not exact match :)
ok
if thats the case use this modified logic
CREATE PROC GetProjectDetails
@PersonList varchar(5000)
AS
SELECT p.*
FROM ProjectTable p
INNER JOIN dbo.ParseValues(@PersonList,',')f
ON ',' + p.[officers 1] + ',' LIKE '%,' + f.val + ',%'
OR ',' + p.[officers 2] + ',' LIKE '%,' + f.val + ',%'
GO
Keep in mind that what you've done is a wrong design approach
You should not be storing multiples values like this as comma separated list in a single column. Learn about normalization . This is in violation of 1st Normal Form
Please Mark This As Answer if it solved your issue
Please Mark This As Helpful if it helps to solve your issue
Visakh
My MSDN Page
My Personal Blog
My Facebook Page -
How to create and execute a function whose return value is a table
hi folks ,
i would like know how to create and execute a function whose return value is a table ,
am new to pl/sql ,
my statement for the function is
SELECT ct.credential_code, c.expiration_date
FROM certifications c, credential_types ct
WHERE ct.crdnt_id = c.crdnt_id
AND c.person_id = person_id;
i would like to have the result of the above query as return value for the function.
Thanks in advance ,
Ashok.chi Ps ,
Can you please do small sample ,
that would help me in clear understanding
thanks in advance
ashok.c -
How to create stored procedures and use those in Crystal reports
Hi All,
Can anyone explain me how to create a stored procedure and use that stored procedure in Crystal reports. As I have few doubts in this process, It would be great if you can explain me with a small stored proc example.
Thanks in advance.Hello,
There is a document explainining how to use Oracle stored proc with Crystal reports.
Check at:
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/1084c536-711e-2b10-e48a-924a60745253
It is for older version but it should work and you can refer to it to get general idea how to start with it. It has a sample oracle stored proc and how to connect it from Crystal Reports. -
Create Store Procedure to Count Number of records in Database for each table
Hello,
I have created the code which counts the number of records for each table in database. However, I want create store procedure for this code this code that when ever use execute the Store Procedure can provide the database name to execute it and as a result
table will display number of records in each table.
Below you will find the code its working:
CREATE
TABLE #TEMPCOUNT
(TABLENAME
NVARCHAR(128),
RECORD_COUNT BIGINT)
-- Creating a TEMP table
EXEC
sp_msforeachtable
'insert #tempcount select ''?'', count(*) from ? with (nolock)'
SELECT
* FROM
#TEMPCOUNT
ORDER
BY TABLENAME
DROP
TABLE #TEMPCOUNT
This code need to be convert in store procedure and user can give database name when execute the procedure in order to count the records.
Looking forward for your support.
Thanks.
SharePoint_Consultant_EMEASomething like:
set quoted_identifier off
go
create procedure usp_TableCounts
@DBName as varchar(1000)
as
set nocount on
declare @SQLToExecute varchar(1000)
CREATE TABLE #TEMPCOUNT (TABLENAME NVARCHAR(128), RECORD_COUNT BIGINT) -- Creating a TEMP table
set @SQLToExecute = @DBName + ".dbo.sp_msforeachtable 'insert into #tempcount select ''?'', count(*) from ? with (nolock)'"
print @SQLToExecute
exec (@SQLToExecute)
SELECT * FROM #TEMPCOUNT
ORDER BY TABLENAME
DROP TABLE #TEMPCOUNT
GO
Satish Kartan www.sqlfood.com -
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? -
Insert the values form one table to another
Hi.,
I am using jdev11.1.5
I had created a reaadonly VO using the follwing querry
select distinct fp_bu,fp_year,fp_period, decode(gdh_status,'R','Yes','No') distribution,decode (aj_status ,'N','Yes','No') Recursion,
decode(RSUPHD_STATUS,'P','Yes','No') Supplier,decode(RCDOC_STATUS,'P','Yes','No') Customer
from gl_dist_hd,fin_periods,appl_journals,rec_suplr_doc_hd,rec_cust_doc_hd
where fp_bu = gdh_bu(+) and
gdh_bu = aj_bu(+) and
aj_bu = RSUPHD_BU(+) and
RSUPHD_BU = RCDOC_BU(+) and
fp_year = gdh_year(+) and
gdh_year = aj_year(+) and
aj_year = RSUPHD_DOC_YEAR(+) and
RSUPHD_DOC_YEAR = RCDOC_DOC_YEAR(+) and
fp_period = gdh_period(+) and
gdh_period = aj_period(+) and
aj_period = RSUPHD_DOC_PERIOD(+) and
RSUPHD_DOC_PERIOD = RCDOC_DOC_PERIOD(+)
ORDER BY fp_period asci had created a button [post]
when the user clicks the button it must insert the values of table CursorC1 into GlJrnlHd
i had tried a querry in AMImpl
ViewObjectImpl vo = this.getGlJrnlHd1();
Row newRow = vo.createRow();
ViewObjectImpl c1 = this.getCursorC1_1();
Row cr1 = c1.getCurrentRow();
newRow.setAttribute("GjhBu", cr1.getAttribute("GrhBu"));
newRow.setAttribute("GjhPlant", cr1.getAttribute("GrhPlant"));
newRow.setAttribute("GjhJrnlType", cr1.getAttribute("GrvlJrnlType"));
newRow.setAttribute("GjhJrnlNo", cr1.getAttribute("GrvlJrnlNo"));
newRow.setAttribute("GjhJrnlSfx", cr1.getAttribute("GrhJrnlSfx"));
newRow.setAttribute("GjhJrnlDate", "Null");
newRow.setAttribute("GjhYear", cr1.getAttribute("GrvlYear"));
newRow.setAttribute("GjhPeriod", cr1.getAttribute("GrvlPeriod"));
newRow.setAttribute("GjhDesc", cr1.getAttribute("GrhDesc"));
newRow.setAttribute("GjhAppl", "GLM");
newRow.setAttribute("GjhReversal", "N");
newRow.setAttribute("GjhStatus","N");
newRow.setAttribute("GjhCreBy", "NULL");
newRow.setAttribute("GjhCreDate", "NULL");
newRow.setAttribute("GjhUpdBy", "NULL");
newRow.setAttribute("GjhUpdDate", "NULL");
this.getTransaction().commit();i am getting null pointer exception at this line
newRow.setAttribute("GjhBu", cr1.getAttribute("GrhBu"));could anyone please help me to resolve this errorHi,
give a NPE check
ViewObjectImpl vo = this.getGlJrnlHd1();
Row newRow = vo.createRow();
ViewObjectImpl c1 = this.getCursorC1_1();
Row cr1 = c1.getCurrentRow();
if (cr1 != null){
newRow.setAttribute("GjhBu", cr1.getAttribute("GrhBu"));
newRow.setAttribute("GjhPlant", cr1.getAttribute("GrhPlant"));
newRow.setAttribute("GjhJrnlType", cr1.getAttribute("GrvlJrnlType"));
newRow.setAttribute("GjhJrnlNo", cr1.getAttribute("GrvlJrnlNo"));
newRow.setAttribute("GjhJrnlSfx", cr1.getAttribute("GrhJrnlSfx"));
newRow.setAttribute("GjhJrnlDate", "Null");
newRow.setAttribute("GjhYear", cr1.getAttribute("GrvlYear"));
newRow.setAttribute("GjhPeriod", cr1.getAttribute("GrvlPeriod"));
newRow.setAttribute("GjhDesc", cr1.getAttribute("GrhDesc"));
newRow.setAttribute("GjhAppl", "GLM");
newRow.setAttribute("GjhReversal", "N");
newRow.setAttribute("GjhStatus","N");
newRow.setAttribute("GjhCreBy", "NULL");
newRow.setAttribute("GjhCreDate", "NULL");
newRow.setAttribute("GjhUpdBy", "NULL");
newRow.setAttribute("GjhUpdDate", "NULL");
this.getTransaction().commit();
} -
How to insert a value into a table
I have an ordering system. It displays all the orders by
customer ID. If an order is complete, a check number is entered for
the corresponding line item, otherwise it is left blank.
My code uses the following code to display the form. All are
display fields only, except for the last one, where the check
number can be entered.
<cfoutput query="qryDetail" group="partNumber">
<tr>
<td valign="top" class="TitleText"
align="center">#lineItem#</td>
<td valign="top" class="TitleText"
align="center">#OrderNumber#</td>
<td valign="top" class="TitleText"
align="center">#partNumber#</td>
<td valign="top" class="TitleText"
align="center">#dollarformat(qryDetail.unitValue)#</td>
<td valign="top" class="TitleText" align="center">
<cfinput type="text" name="checkNumber#keyID#">
<input type="hidden" name="keyID"
value="#qryDetail.keyID#">
</td>
I use something like the following to update the table with
the check numbers entered.
<cfloop index="KeyID" list="#form.KeyID#"
delimiters=",">
<cfquery name="qryUpdate" datasource="dbName">
update tblChecks
set checkNumber = '#Evaluate("form.checkNumber#KeyID#")#'
where custID = '#form.custID#'
and KeyID = '#KeyID#'
</cfquery>
</cfloop>
Now we have another table that will contain the customer
order history. If the check number was entered for a particular
line item, I need to insert that line item nubmer into this table,
along with some other columns. I tried to use the same loop, then
other loops, but cannot seem to get this to work. Seems simple
enough, but I obvisouly am missing something.
How would I insert the line item number (only if a check
number was entered for that line item) into the table ?Here is the code with the queries commented out :
<cfloop list="#form.fieldnames#" index="field">
<cfif left(field, 11) is "checkNumber" AND
len(trim(form[field]))>
<cfset keyID = listlast(field, '_')>
<cfset lineItem = listgetat(field, 2, '_')>
<cfset checknum = form[field]>
<!---cfquery name="qryUpdate" datasource="dbName">
UPDATE tblChecks
SET checkNumber = '#checknum#'
WHERE custID = #form.custID#
AND KeyID = #keyid#
</cfquery--->
<cfoutput> loop is
field: <b>#field#</b><br>
checknum: #checknum#<br>
lineitem: #lineitem#<br>
keyID: #keyID#<br>
</cfoutput>
<cfelse>
<cfoutput>Else is
field: <b>#field#</b><br>
form[field]: #form[field]#<br>
len: #len(trim(form[field]))#<br>
</cfoutput><cfabort>
</cfif>
</cfloop>
This is the output. If I do not put in cfabort, the code just
drops thru and I never see any output display, so I use cfabort to
stop so I can see the output.
loop is field: CHECKNUMBER_11_218
CHECKNum: xxxxxxxxxxxxxxxxxxxx
lineitem: 11
keyID: 218
Else is field: CHECKNUMBER_1_24
form[field]:
I entered the x's into checknum for line item 11, so that is
correct.
I then took out the comments from the update query and tried
it again and it updated for line item 11 (you were right, I had to
take out the single quotes in the query). I then removed the
commets for the insert query and it did not insert. I tried the
whole thing again and tried to add to line item 10 and it dropped
straight to the else part, displaying :
Else is field: CHECKNUMBER_1_24
form[field]:
len: 0
So it seems the if statement if failing the second time thru
the loop :
<cfif left(field, 11) is "checkNumber" AND
len(trim(form[field]))>
This is my input statement :
<cfinput type="text"
name="checkNumber_#lineItem#_#keyID#">
I am really confused now. It seems to work the first time
thru the loop, then the second time it fails. -
Data pump + inserting new values in a table
Hello Everybody!!
My question is : is it possible to insert new row into a table which is included in running DataPump process (export data) ?
Best regards
Marcin MigdalHave a look here, never done it myself but seems kind of cool :)
http://www.pythian.com/blogs/766/oracle-data-pump-11g-little-known-new-feature -
Can i create a button that allows users to insert a line into a table if neede more space
if so how in step by step please and thank you
Hi,
In Acrobat Form, you create a hidden Text Field which will only get visible on a Button click for inserting additional text.
Regards,
Anoop -
How to Create a Procedure/Function to Return more than one value
How I can write a function/Procedure to which one value is passed and it will return nine values. How I can use these values
Syed,
I would use PL_SQL table versus a VARRAY for this purpose as you will have an advantage of joining PL_SQL table if you want to in your SQL statements in the procedure.
1. At the SQL prompt, create a type using,
create or replace type myTable as table of VARCHAR2(100);
2. Pass the table to your procedure as IN OUT parameter,
Create or replace procedure
myProc(pvar1 IN Number, passingArray IN OUT myTable) AS
Begin
--Fill the array with your logic
for i in 1..9
loop
passingArray.extend;
passingArray(passingArray.count) := 'what ever';
end loop;
End;
3. From your Main prog, you call Myproc
--declare a variable for type first
passingArray myTable := myTable();
begin
myProc(10, passingArray());
--At this point, You would be able to Join the PL_SQL table
--which gives you the power of using SQL with PL_SQL tables
end; -- end of main program
4. All done!I have not shown how to use PL_SQL tables in SELECT statements, as that is not the subject here.
At the end of the story, I would say, if you know the number of arguments that you are going to pass to a procedure, Simply use "that many" IN OUT parameters to finish your task(9 in your case). Although the proc call looks large with this, it is much simpler. The above approach is VERY helpful if YOU DO NOT KNOW THE NUMBER OF ARGUMENTS that you are sending AND receiving From a procedure.
Thx,
SriDHAR -
Can admin.jar create oc4j users and connection pools that use those users
Hi
I have an ADF BC application written in jdev 10.1.3.3 deployed to standalone oc4j 10.1.3
When I deploy the application I use the enterprise manager to create the users on the security provider/realms tab. I then set up the connection pools in jdbc resources to use those users via the username and indirect password fields. I also set the minimum number of connections on the attributes tab.
I have read the following document but I cannot find any reference to setting up users, connection pools with indirect passwords or minimum number of connections.
http://download-uk.oracle.com/docs/cd/B31017_01/web.1013/b28950/adminclient.htm#BABHJAFE
Is it possible to do using admin.jar?
thanks
paul schweigerI'm not sure about setting indirect passwords on the connection pool creation -- never tried it. It's probably treated purely as a lexical string, so may well be able to to issue the CP creation command with the "->USER" entry as the password.
To create realms, users, groups, etc. you need to use the $ORACLE_HOME/j2ee/home/jazn.jar utility: http://download.oracle.com/docs/cd/B25221_04/web.1013/b14429/admintool.htm#g1022417
The options for connection pool parameters such as min/max connections aren't directly expressable in the command. I'll need to look at the code and see if they can be passed in as non checked options via the factoryproperties. If not, then you can create a JMX client to use the MBeans that are created for the CP post deployment to change its behaviour.
-steve- -
I Cant insert all values to the table But only Default Values r inserted?
Hai,
i can insert only default values to the database. Other values are not shown in DB.
Steps I have done so far:
I have created EO based on VO and VO has the query : select * from emp. Attached to AM.
That AM is attached to the Page. The page consists of employeed details and SAVE button.
Set controller for that page and CO-PR calls create method in AM .
Default values for who columns and SLNo also set through sequence.
In CO-PFR I call apply method which commits the data.
when i run the page and giving values it is not inserted into table but only default values are inserted.
I checked with System.out.println(getattribute("my attr").toString()). It send output correctly.
But y other values are not inserted.?
Anybody plz plz help me in this regard. I am struggling with this for last 1 week. I have to apply this to another realtime scenorio? Deadline is near.
Regards,
Lakshmi ChandiranHai Prince,
Thanks for your immediate response. pls find my codes written in EO,AM,CO.
In VO i havent added anythig xcept the query.
The following fields are only getting inserted in the table.
My EOImpl code:
public void create(AttributeList attributeList) {
super.create(attributeList);
System.out.println("NOW I AM IN CREATE METHOD");
OADBTransaction transaction = getOADBTransaction();
Number EMP_ID = transaction.getSequenceValue("Employeeid");
setEmpId(EMP_ID);
setCreationDate(transaction.getCurrentDBDate());
setStartDate(transaction.getCurrentDBDate());
setLastUpdateDate(transaction.getCurrentDBDate());
setCreationDate(transaction.getCurrentDBDate());
VO:
select * from emp1
AM:
public void saveForm()
OAViewObjectImpl empvo = getEMP_VO();
System.out.println("NOW I AM IN AM SAVEFORM OF EMTS");
if ( !empvo.isPreparedForExecution())
empvo .executeQuery();
Row prow = empvo .createRow();
empvo .insertRow(prow);
prow.setNewRowState(Row.STATUS_INITIALIZED) ;
System.out.println("NOW I AM IN ROW CREATED");
public void commitdata()
System.out.println("commitMethod()") ;
getDBTransaction().commit();
CO:PR & PFR:
public void processRequest(OAPageContext pageContext, OAWebBean webBean)
super.processRequest(pageContext, webBean);
if(!pageContext.isFormSubmission())
pageContext.getApplicationModule(webBean).invokeMethod("saveForm",null);
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
super.processFormRequest(pageContext, webBean);
OAApplicationModule EMP_AM = pageContext.getApplicationModule(webBean);
OAViewObject vo = (OAViewObject)EMP_AM.findViewObject("EMP_VO");
if ( pageContext.getParameter("BtnSave") != null )
pageContext.getApplicationModule(webBean).invokeMethod("commitdata");
s1 = (String)vo.first().getAttribute("Empname");
s12 = (String)vo.first().getAttribute("Emptype");
s3 = (String)vo.first().getAttribute("Emporg");
s4 = (String)vo.first().getAttribute("Empcity");
System.out.println(" values are " + s1+s2+s3+s4);
here i can get the values correctly printed in output as entered in the form.
I dont know where the problem is.
plz help me.
Thanks in advance,
Regards,
Lakshmi Chandiran -
How to Insert the value in oitm table
Dear Members,
In Item Master, i have created a combobox next to Price List through SDK. if i select a particular value in the combobox and click Add Button in itemMaster, the selected value has to go to oitm table. i dont want to put separate table for that.any body can help me in this regard.
Thanks in Advancehi,
for eg create a field in OITM table as UDF
TOOLS >>> UserDefinedFields >>> Manage User Fields >>> Master Data >>> Items >>> Items
create UDF Field so that a field UDF will be created in the table OITM (Table for ItemMaster).
Use the Following Code in ItemEvent.
If pVal.FormType = 150 pVal.BeforeAction = False And pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_LOAD Then
Try
Dim oitem As SAPbouiCOM.Item = SBO_Application.Forms.Item(pVal.FormUID).Items.Item("214")
Dim oitem2 As SAPbouiCOM.Item = SBO_Application.Forms.Item(pVal.FormUID).Items.Item("107")
Dim oitem1 As SAPbouiCOM.Item = SBO_Application.Forms.Item(pVal.FormUID).Items.Add("UserItem", SAPbouiCOM.BoFormItemTypes.it_COMBO_BOX)
oitem1.Left = oitem2.Left
oitem1.Width = oitem2.Width
oitem1.Top = oitem.Top
oitem1.Height = oitem.Height
oitem1.LinkTo = "215"
oitem1.Visible = True
oitem1.DisplayDesc = True
Dim oCombo As SAPbouiCOM.ComboBox = oitem1.Specific
oCombo.DataBind.SetBound(True, "OITM", "U_UDF")
oCombo.ValidValues.Add("M", "M")
oCombo.ValidValues.Add("L", "L")
oCombo.ValidValues.Add("E", "E")
Catch ex As Exception
SBO_Application.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
End Try
End If
after binding UDF field to Combobox it adds to database automatically on clicking add.
regards,
varma -
Can we call a webservice to insert a value to r3 table - using XI ?
Hi friends ,
At present we are directly going to the r3 screen and we are giving input to the particular table.After succcesfull insertion that will return a status as 's' .
Can we do it through weservices ?
How xi can play a role here ?
Best Regards .,
V.RangarajanHi ranga Rajan,
Yes we can achive this, by using SOAP adapter at sender side so that u can send data from webservices to XI which inturn will pass to R/3.
if u need acknowledgement, u can use RFC at receiver side.
regards
harsha
**if u found this, assign points**
Maybe you are looking for
-
How get all released production orders
Hi experts, I need to get all released Production Orders for a specific plant. I noticed that usually you don´t select directly from table AUFK. Most of people use function module WCFS_STTXT_GET to get the status of an order. I know that table AUFK h
-
Wireless stopped working on my e2000
I am not a computer genius, but I have deduced that my wireless was working fine for 1 month (how long I've had the router), and after my computer fell asleep today for the millionth time because I was surfing while cleaning, the wireless connection
-
Does office hd work on Apple VGA Adapter and what is anther app work with this cable
does office hd work on Apple VGA Adapter and what is anther app work with this cable i have persentation and i like to buy this cable but i don't like Kenote i love PowerPoint can it work with VGA Adepter
-
Convert pdf file (vendor order confirmation) to excel for use as a worksheet
anyone ? can you help me? I keep getting an error message but not what is wrong
-
Adobe Flash Player Surround Sound
Cannot figure out why, oh why, does Adobe Flash, the almighty web ruler, NOT do surround sound. Just does not do it. I have browsed around and learned that, at least among the forum and google, Adobe is aware of it. I can take a **** on my keyboard,