ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to find record in Oracle (https://www.excelbanter.com/excel-programming/382574-how-find-record-oracle.html)

Sakol

How to find record in Oracle
 
Hi,

If the excel sheet1 have item unique more than 10,000 item_numbers.
Could you please help to find the way how to find record in Oracle Object.
due to i need to fill out sum qty in excel sheet1.

Example :-
Excel Sheet1
Item_number Quantity
A1 ?
1250-9999 ?
B1 ?
B2 ?
..
..
..
total 10,000 rows

Oracle Object(sort by item_number)

Item_number Quantity
1259-9999 200
A1 100
A1 200
B2 100
X1 100
X2 300
..
..

Program

sub FindOCL()

SQL_Text = €śSELECT item_number, Item_Description FROM mtl_system_items_b€ť
Set objSession = CreateObject("OracleInProcServer.XOraSession")
Set objDatabase = objSession.OpenDatabase("prod", "ap/aps", 0)
Set oraDynaSet = objDatabase.DBCreateDynaset(SQL_Text, 0)

If oraDynaSet.RecordCount 0 Then
oraDynaSet.MoveFirst
End If

what i can do next to find record like below excusion

1st Loop:
Excel sheet1 item_number = "A1"
go to find data in Oracle object that item_number = "A1", if found
sum quantity all record that contain "A1" in Oracle object and fill out back
to Excel Sheet1 at line that contain "A1"
movenext to 2nd line

2nd Loop:
Excel sheet1 item_number = "1250-9999" 'at 2nd line of excel sheet1
go to find data in Oracle object that item_number = "1250-9999", if found
sum quantity all record that contain "1250-9999" in Oracle object and fill
out back to Excel Sheet1 at line that contain "1250-9999"
movenext to 3rd line

--do it until excel sheets end of record

any can help would be appreciate very much.




--
Sakol


All times are GMT +1. The time now is 01:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com