XML data insert into Oracle
Hi all,
I have some xml data which i would like to insert into oracle tables.
Where to start up with this?
Hi,
Here's another good place to start: [XML DB FAQ|http://forums.oracle.com/forums/thread.jspa?threadID=410714&tstart=0]
You seem to be especially interested in second post in there.
Regards
Peter
Similar Messages
-
How to extract data from xml and insert into Oracle table
Hi,
I have a large xml file. which will have hundreds of the following transaction tags having column names and there values.
There is a table one of the schema with coulums "actualCostRate","billRate"....etc.
I need to extract the values of these columns and insert into the table
<Transaction actualCostRate="0" billRate="0" chargeable="1" clientID="NikuUK" chargeCode="LCOCD1" externalID="L-RESCODE_UK1-PROJ_UK_CNT_GBP-37289-8" importStatus="N" projectID="TESTPROJ" resourceID="admin" transactionDate="2002-02-12" transactionType="L" units="11" taskID="5017601" inputTypeCode="SALES" groupId="123" voucherNumber="ABCVDD" transactionClass="ABCD"/>
<Transaction actualCostRate="0" billRate="0" chargeable="1" clientID="NikuEU" chargeCode="LCOCD1" externalID="L-RESCODE_US1-PROJ_EU_STD2-37291-4" importStatus="N" projectID="TESTPROJ" resourceID="admin" transactionDate="2002-02-04" transactionType="L" units="4" taskID="5017601" inputTypeCode="SALES" groupId="124" voucherNumber="EEE222" transactionClass="DEFG"/>Re: Insert from XML to relational table
http://www.google.ae/search?hl=ar&q=extract+data+from+xml+and+insert+into+Oracle+table+&btnG=%D8%A8%D8%AD%D8%AB+Google&meta= -
I have xml data in this format and need to store in the lineitem table by generating three new values for each row ie line identifier(sys_guid),begin_date and end_date.
<LineItems>
<LineItem>
<BASE_TYPE>SRV</BASE_TYPE>
<ORDER_NUM>124089304</ORDER_NUM>
<WIP_STATUS>S</WIP_STATUS>
<WIP_STATUS_DATE>8/1/2006 8:44:55 PM</WIP_STATUS_DATE>
<order_date>6/21/2006 12:00:00 AM</order_date>
<IP_DATE>6/21/2006 12:00:00 AM</IP_DATE>
</LineItem>
<LineItem>
<BASE_TYPE>SRV</BASE_TYPE>
<ORDER_NUM>124089304</ORDER_NUM>
<WIP_STATUS>S</WIP_STATUS>
<WIP_STATUS_DATE>8/1/2006 8:44:55 PM</WIP_STATUS_DATE>
<order_date>6/21/2006 12:00:00 AM</order_date>
<IP_DATE>6/21/2006 12:00:00 AM</IP_DATE>
</LineItem>
</LineItems>
and using this method to insert
SELECT EXTRACTVALUE(VALUE(T), 'LineItem/BASE_TYPE'),
EXTRACTVALUE(VALUE(T), 'LineItem/ORDER_NUM'),
EXTRACTVALUE(VALUE(T), 'LineItem/WIP_STATUS'),
EXTRACTVALUE(VALUE(T), 'LineItem/WIP_STATUS_DATE')),
EXTRACTVALUE(VALUE(T), 'LineItem/ORDER_DATE')),
EXTRACTVALUE(VALUE(T), 'LineItem/IP_DATE')),
EXTRACTVALUE(VALUE(T), 'LineItem/SHIP_BY_DATE')),
EXTRACTVALUE(VALUE(T), 'LineItem/CUSTOMER_SRC'),
EXTRACTVALUE(VALUE(T), 'LineItem/CUSTOMER_LOC'),
EXTRACTVALUE(VALUE(T), 'LineItem/CUSTOMER_NUM'),
EXTRACTVALUE(VALUE(T), 'LineItem/ACCOUNT_TYPE'),
EXTRACTVALUE(VALUE(T), 'LineItem/OVERPACK_FLAG'),
EXTRACTVALUE(VALUE(T), 'LineItem/INTERNATIONAL_FLAG'),
EXTRACTVALUE(VALUE(T), 'LineItem/MULTIPLE_SYSTEM_TIES'),
EXTRACTVALUE(VALUE(T), 'LineItem/ORDER_TIE_NUM'),
EXTRACTVALUE(VALUE(T), 'LineItem/TIE_STATUS'),
EXTRACTVALUE(VALUE(T), 'LineItem/PK_GEN'),
EXTRACTVALUE(VALUE(T), 'LineItem/QTY_REQD'),
EXTRACTVALUE(VALUE(T), 'LineItem/WORKCENTER_ID'),
EXTRACTVALUE(VALUE(T), 'LineItem/SI_NUMBER'),
EXTRACTVALUE(VALUE(T), 'LineItem/MFG_SCHED_FACILITY_ID'),
EXTRACTVALUE(VALUE(T), 'LineItem/MFG_FACILITY_ID'),
EXTRACTVALUE(VALUE(T), 'LineItem/PILOT_NAME'),
EXTRACTVALUE(VALUE(T), 'LineItem/ENG_HOLD_FLAG'),
EXTRACTVALUE(VALUE(T), 'LineItem/SHORT_FLAG'),
EXTRACTVALUE(VALUE(T), 'LineItem/OVR_SHORTAGE'),
EXTRACTVALUE(VALUE(T), 'LineItem/USER_HOLD_FLAG'),
EXTRACTVALUE(VALUE(T), 'LineItem/SHIP_TO_ADDRESS_SEQ_NUM'),
EXTRACTVALUE(VALUE(T), 'LineItem/CALICO_REF_NUM'),
EXTRACTVALUE(VALUE(T), 'LineItem/CONFIG_ID'),
EXTRACTVALUE(VALUE(T), 'LineItem/TOTAL_UNITS_QTY'),
EXTRACTVALUE(VALUE(T), 'LineItem/ORDER_TYPE'),
EXTRACTVALUE(VALUE(T), 'LineItem/SKU'),
EXTRACTVALUE(VALUE(T), 'LineItem/SUB_ASSEMBLY_NUMBER'),
EXTRACTVALUE(VALUE(T), 'LineItem/BASE_ASM_FLAG'),
EXTRACTVALUE(VALUE(T), 'LineItem/QTY_REQ'),
EXTRACTVALUE(VALUE(T), 'LineItem/ORIGINAL_PART_NUMBER'),
EXTRACTVALUE(VALUE(T), 'LineItem/SUBSTITUTE_PART_NUMBER'),
EXTRACTVALUE(VALUE(T), 'LineItem/QTY_EXTENDED'),
EXTRACTVALUE(VALUE(T), 'LineItem/ISSUE_CODE'),
EXTRACTVALUE(VALUE(T), 'LineItem/ORIG_PART_DESC'),
EXTRACTVALUE(VALUE(T), 'LineItem/ORIG_COMMODITY_CODE'),
EXTRACTVALUE(VALUE(T), 'LineItem/ORIG_PRINT_ON_TRAVELER_FLAG'),
EXTRACTVALUE(VALUE(T), 'LineItem/ORIG_BOX_CODE'),
EXTRACTVALUE(VALUE(T), 'LineItem/SUBST_PART_DESC'),
EXTRACTVALUE(VALUE(T), 'LineItem/SUBST_COMMODITY_CODE'),
EXTRACTVALUE(VALUE(T), 'LineItem/SUBST_PRINT_ON_TRAVELER_FLAG'),
EXTRACTVALUE(VALUE(T), 'LineItem/SUBST_BOX_CODE')
BULK COLLECT INTO
V_BASE_TYPE,
V_ORDER_NUM,
V_WIP_STATUS,
V_WIP_STATUS_DATE,
V_ORDER_DATE,
V_IP_DATE,
V_SHIP_BY_DATE,
V_CUSTOMER_SRC,
V_CUSTOMER_LOC,
V_CUSTOMER_NUM,
V_ACCOUNT_TYPE,
V_OVERPACK_FLAG,
V_INTERNATIONAL_FLAG,
V_MULTIPLE_SYSTEM_TIES,
V_ORDER_TIE_NUM,
V_TIE_STATUS,
V_PK_GEN,
V_QTY_REQD,
V_WORKCENTER_ID,
V_SI_NUMBER,
V_MFG_SCHED_FACILITY_ID,
V_MFG_FACILITY_ID,
V_PILOT_NAME,
V_ENG_HOLD_FLAG,
V_SHORT_FLAG,
V_OVR_SHORTAGE,
V_USER_HOLD_FLAG,
V_SHIP_TO_ADDRESS_SEQ_NUM,
V_CALICO_REF_NUM,
V_CONFIG_ID,
V_TOTAL_UNITS_QTY,
V_ORDER_TYPE,
V_SKU#,
V_SUB_ASSEMBLY_NUMBER,
V_BASE_ASM_FLAG,
V_QTY_REQ,
V_ORIGINAL_PART_NUMBER,
V_SUBSTITUTE_PART_NUMBER,
V_QTY_EXTENDED,
V_ISSUE_CODE,
V_ORIG_PART_DESC,
V_ORIG_COMMODITY_CODE,
V_ORIG_PRINT_ON_TRAVELER_FLAG,
V_ORIG_BOX_CODE,
V_SUBST_PART_DESC,
V_SUBST_COMMODITY_CODE,
V_SUBST_PRINT_ON_TRAVELER_FLAG,
V_SUBST_BOX_CODE
FROM TABLE(XMLSEQUENCE(EXTRACT(P_PODETAILS_XML, '/LineItems/LineItem'))) T
but getting performace problem. I'm able to insert 100 lines items in 3 sec but requirement is further less.
Any help..... ????
thanks in adavance..hi..
me too having same type of XML data to be inserted into oracle table
i've to write procedure for this
can u help me plz..... -
Parsing XML file & insert into Oracle Tables
Hi,
Following is a sample xml file which is an input for a oracle procedure :
<Sales ID="1" CreatedDate="16-Jan-2007" CreatedTime="16:09:40">
<Customer ID="1" Name="Scott" Address="City1">
<Order ID="1" Date="15-Jan-2007" TotItems="2" Value="200">
<Item ID="01" Name="Chocolate" Qty="2" Amount="80" />
<Item ID="03" Name="Biscuit" Qty="5" Amount="120" />
</Order>
</Customer>
<Customer ID="2" Name="Tiger" Address="City2">
<Order ID="1" Date="15-Jan-2007" TotItems="1" Value="500">
<Item ID="01" Name="Pizza" Qty="3" Amount="500" />
</Order>
</Customer>
<User ID="ABC" Name="TestUser" LastLogin="16-Jan-2007" />
<City Code="NY" Name="New York" />
<City Code="NJ" Name="New Jersy" />
</Sales>
I have individual tables for Sales, Customer, Order, Item, User & City tags with proper referential constraints. I have to parse the xml & have to insert the corresponsing tables for each & every tag if the ID in individual tag does not exists in the table. If the ID already exist, then, I have to update other attributes in the table for the corresponding ID.
Can anyone suggest me the simplest way to perform the above said scenario?Dera Michael,
Sorry for the confusing previous reply. I went through your solution again and tried for my XML File.
I have stored the XML File in table XXLF_DS_XML.Should I make use of the table in the below query.
Here is my SQL Query erroring Out
SQL> SELECT EXTRACTVALUE(s.COLUMN_VALUE,
2 '/Header@orderID') ID
3 ,EXTRACTVALUE(c.COLUMN_VALUE,
4 '/Detail@lineNumber') lienum
5 ,EXTRACTVALUE(t.COLUMN_VALUE,
6 '/Detail/Tax@currency') currency
7 ,EXTRACTVALUE(t.COLUMN_VALUE,
8 '/Detail/Tax/Money') customer_name
9 FROM TABLE(XMLSEQUENCE(EXTRACT(XMLTYPE('- <Recordset>
10 - <Header dueDate="2007-01-17T16:09:05" orderDate="2004-01-17" orderID="0009" transactionID="1389"
type="new">
11 <KeyIndex>2</KeyIndex>
12 - <BillTo>
13 - <Address addressID="5619" isoCountryCode="US">
14 <Name>fMat</Name>
15 - <PostalAddress name="default">
16 <Street>34545</Street>
17 <City>dfgfg</City>
18 <State>AZ</State>
19 <PostalCode>85086-1693</PostalCode>
20 <County>Maricopa</County>
21 <Country>US</Country>
22 </PostalAddress>
23 <Email name="default">[email protected]</Email>
24 </Address>
25 </BillTo>
26 <PromotionCode />
27 - <SubTotal>
28 <Money currency="USD">32.49</Money>
29 </SubTotal>
30 - <Tax>
31 <Money currency="USD">2.32</Money>
32 <Description />
33 </Tax>
34 - <Shipping>
35 <Money currency="USD">8.95</Money>
36 <Description />
37 </Shipping>
38 </Header>
39 - <Detail lineNumber="1" quantity="1">
40 - <ItemDetail>
41 - <UnitPrice>
42 <Money currency="USD">29.99</Money>
43 </UnitPrice>
44 <ShortName>Little;reg; pxxxx® Learning System</ShortName>
45 </ItemDetail>
46 - <Tax>
47 <Money currency="USD">1.68</Money>
48 <Description />
49 - <TaxDetail category="sales">
50 - <TaxAmount>
51 <Money currency="USD">1.68</Money>
52 </TaxAmount>
53 <TaxLocation>AZ</TaxLocation>
54 </TaxDetail>
55 </Tax>
56 </Detail>
57 - <Detail lineNumber="2" quantity="1">
58 - <ItemDetail>
59 - <UnitPrice>
60 <Money currency="USD">29.99</Money>
61 </UnitPrice>
62 <ShortName>Little;reg; pxxxx® Learning System</ShortName>
63 </ItemDetail>
64 - <Tax>
65 <Money currency="USD">1.68</Money>
66 <Description />
67 - <TaxDetail category="sales">
68 - <TaxAmount>
69 <Money currency="USD">1.68</Money>
70 </TaxAmount>
71 <TaxLocation>AZ</TaxLocation>
72 </TaxDetail>
73 </Tax>
74 - <Tax>
75 <Money currency="USD">0.68</Money>
76 <Description />
77 - <TaxDetail category="sales">
78 - <TaxAmount>
79 <Money currency="USD">0.68</Money>
80 </TaxAmount>
81 <TaxLocation>DISTRICT</TaxLocation>
82 </TaxDetail>
83 </Tax>
84 </Detail>
85 </Recordset>'),'/Recordset/Header'))) s
86 ,TABLE(XMLSEQUENCE(EXTRACT(c.COLUMN_VALUE,
87 '/Recordset/Detail'))) c
88 ,TABLE(XMLSEQUENCE(EXTRACT(t.COLUMN_VALUE,
89 '/Recordset/Detail/Tax'))) t
90 /
,TABLE(XMLSEQUENCE(EXTRACT(c.COLUMN_VALUE,
ERROR at line 86:
ORA-00904: "C"."COLUMN_VALUE": invalid identifier
Here is my XML Data
<Recordset>
<Header dueDate="2007-01-17T16:09:05" orderDate="2004-01-17" orderID="0009" transactionID="1389"
type="new">
<KeyIndex>2</KeyIndex>
<BillTo>
<Address addressID="5619" isoCountryCode="US">
<Name>fMat</Name>
<PostalAddress name="default">
<Street>34545 </Street>
<City>dfgfg</City>
<State>AZ</State>
<PostalCode>85086-1693</PostalCode>
<County>Maricopa</County>
<Country>US</Country>
</PostalAddress>
<Email name="default">[email protected]</Email>
</Address>
</BillTo>
<PromotionCode/>
<SubTotal>
<Money currency="USD">32.49</Money>
</SubTotal>
<Tax>
<Money currency="USD">2.32</Money>
<Description/>
</Tax>
<Shipping>
<Money currency="USD">8.95</Money>
<Description/>
</Shipping>
</Header>
<Detail lineNumber="1" quantity="1">
<ItemDetail>
<UnitPrice>
<Money currency="USD">29.99</Money>
</UnitPrice>
<ShortName>Little;reg; pxxxx® Learning System </ShortName>
</ItemDetail>
<Tax>
<Money currency="USD">1.68</Money>
<Description/>
<TaxDetail category="sales">
<TaxAmount>
<Money currency="USD">1.68</Money>
</TaxAmount>
<TaxLocation>AZ</TaxLocation>
</TaxDetail>
</Tax>
</Detail>
<Detail lineNumber="2" quantity="1">
<ItemDetail>
<UnitPrice>
<Money currency="USD">29.99</Money>
</UnitPrice>
<ShortName>Little;reg; pxxxx® Learning System </ShortName>
</ItemDetail>
<Tax>
<Money currency="USD">1.68</Money>
<Description/>
<TaxDetail category="sales">
<TaxAmount>
<Money currency="USD">1.68</Money>
</TaxAmount>
<TaxLocation>AZ</TaxLocation>
</TaxDetail>
</Tax>
<Tax>
<Money currency="USD">0.68</Money>
<Description/>
<TaxDetail category="sales">
<TaxAmount>
<Money currency="USD">0.68</Money>
</TaxAmount>
<TaxLocation>DISTRICT</TaxLocation>
</TaxDetail>
</Tax>
</Detail>
</Recordset>
Thanks -
Problem with XML doc inserting into oracle 10g
Hi Guys, I have some knowledge in oracle 10g.
We are doing an application, when we were trying to insert XML document (I was trying to insert XML as un-structured way.) into oracle 10g as a datatype called XMLTYPE column.
My XML is having namespace attributes(Target namespaces) in that. So when i was trying to insert that into database , it is giving some error ,and not letting me to push that into database.
So Can any body please help me in this. My constraint is that I have to insert the document as un-structured way.
You help would be appriciated.
Vish
Message was edited by:
user567405
Message was edited by:
user567405
Message was edited by:
user567405
Message was edited by:
user567405
Message was edited by:
user567405, it is giving some error Hmmm, six attempts and you still didn't manage to tell us what the actuall error message and number was. Oracle has thousands of error messages. If you would like us to help you, make it easy for us to figure out what's going on. Don't make us guess.
Regards, APC -
XML Data Inserts into Tables???
hi there,
will i be able to an insertXML call onto a table wherein i need to just insert a few node values into couple of fields in the table and leave the other fields unpopulated? - aka - i need to grab the node values from the XML file and then store it to respective fields in the table with the insertXML call - something like::
OracleXMLSave.insertXML(value-of(node1), value-of(node2)) table1.field1, table1.field2;
is something like the above statement possible?
Thanks..
nullIf your XML Document looks like:
<ROWSET>
<ROW>
<FIELD1>val-1</FIELD1>
<FIELD12>val-12</FIELD12>
</ROW>
</ROWSET>
it will insert into just those two
fields, the rest will be null for
the purposes of the insert. -
XML data inserting into Master, not Page
First, I fully admit that I jumped into the deep end of the pool. This is my first InDesign project and I'm trying to set up a 2-page spread master to support loading my content from XML.
Thanks to the great online help, these forums/community resources, and my growing bookshelf, I've successfully (or so it seems) created my Master layout, with frames appropriately tagged for my XML (as confirmed by the Structure). Since I'm very novice at InDesign, my testing isn't always unambiguous, but I HAVE successfully loaded my external XML (including graphics and anchored text, plus the story) into my document.
The problem is that the data seems to be flowing into the Master, and not the Page. So if I create all the pages I need ahead of time (right now just 2 spreads for my test), both pages are populated with the first record.
If I only create the first spread, then the data flows and I get the magic "+" for overflow, but I can't click on it in the Page. If I change to the Master I can click on it, which seems the major clue as to why this isn't working. I just have no idea how to fix it.
From everything I've read it seems that I should be able to tag my frames in the Master (which I want to reuse for other documents) and have the data flow into the Pages.
Am I missing something obvious?
Or is what I'm trying to do just not possible? (if so, does that mean I have to keep re-tagging the frames every time I make a new Document? ugh)
I've spent hours trying to resolve this, and would really appreciate a pointer to get me moving again.
Thanks!
julieHm, that seems contradictory to everything I've read and the examples I've seen (although I may have misunderstood the examples - none are quite as complicated as my layout). My text frame has several anchors for XML data that doesn't just flow with the story. How do I set up the tagged anchor frames I need if the story text frame is in the Master but not tagged?
I thought that the story text frame and the anchor frames (some graphics and some text) all needed to be in the same context. If I put them in the Master I get the XML flowing into the Master. If I put them into the Page then the new pages created don't have the proper frames. If I just put the story text frame in the Master, how do I associate it with the anchor frames (I only know how to do this by using the Story editor on the tagged frame as described in A Designer's Guide To Adobe InDesign and XML)?
I'll go back and work through the samples again, but I definitely don't understand how it all fits together.
Thanks!
j -
How to read the data from XML file and insert into oracle DB
Hi All,
I have below require ment.
I will receive data in the XML file. then i need to read that data and insert into oracle tables. please let me know how this can be handled.
Many Thanks.Sounds a lot like this question, only with less details.
how to read data from XML variable and insert into table variable
We can only help if you provide us details to help as we cannot see what you are doing and only know what you tell us. Plenty of examples abound on the forums that cover the topics you seek as well. -
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 -
Insert statement with Date, time into Oracle
Hi,
I've got the following statement that I'm trying to insert into Oracle. Actually had to change up the format to dd-mm-yy to get it to insert the date correctly, not sure why, but I've got it "supposedly" formatted to also insert the hours, min., seconds into the db record, but it's not catching it.
My code:
INSERT INTO VOTETBL
(CHANGE_CTRL_ID,BUSVP,BRANCH,VOTE,VOTE_TIMESTAMP)
VALUES (?, ?,?,?,to_date(sysdate, 'dd-mm-yy hh24:mi:ss'));Shouldn't the sysdate capture all those elements sufficiently? The day, month, year get inserted correctly with this, but not so for the time portion.
Any suggestions is welcomed.
Thx.ok, thanks.
I tried making a result set with the following:
Statement stmt = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
ResultSet rst = stmt.executeQuery("select to_char(sysdate) from dual");
Date dualtimestamp = (rst.getDate("sysdate"));But it makes the servlet blow up! Not sure why either, because if I enter that exact statement in Oracle, it pulls back the date and time just like I aim to. But not embedded in the result set statement within the servlet.
It breaks up somehow and doesn't get that result! -
XML Data Load into releational structures
Hi,
I am very unexperienced in using XML and have the problem
to import very large XML data files into existing reletional structures.
In our production DB we don't use the java engine, so
that PL/SQL an the SQL Loader are the only available ways to import the data.
At the moment we get flat files and use the SQL Loader utility. But an interface to a new system send XML data now and I have to fill the same old releational structure with the new data.
Can anybody give me a hint about the best technic for an high performance import. Are there any existing tools for the relational mapping?
Regards RalphThank you for your reply.
You are right. We only want to break the XML to fill our relational structures. We don't need the XML data further on. But we have to load the data in temporary structures, because we have to transform the data in our own format. (The system which delivers the XML data is external and uses another data model)
Is there no more elegant way with use of databse built in technics? The XML data we get can be validated against a XML schema.
So I thought, it could be a way to load the XML in the XDB and register the schema in the database. After that store the XML data in the default generated object relational structures and then programm the data transformation and the data flow between these default structures to our target data structures with PL/SQL.
I don't know if this way is performant enough.
If I use an external tool i have to code the relational mapping outside the database and insert the data with use of ODBC in temporary structures which i have to create manualy.
So I hoped to find a way to load the data in any relational structure using the advantages of XML and XML schema and code the neccasary logic inside the DB.
Do you have any further hints for my problem?
Regards Ralph -
Insert into oracle DB using vb2005
I have a form that has click button1. The problem with this code is after insert command something should be inserted into oracle DB but nothing there(so how to execute insert command and commit it using VB2005), any suggestion should refer to the code.
Imports System
Imports System.Data ' VB.NET
Imports Oracle.DataAccess.Client ' ODP.NET Oracle data provider
Imports Excel = Microsoft.Office.Interop.Excel
Public Class Form1
'System.Data.OracleClient lets you access Oracle databases.
Public con As System.Data.OracleClient.OracleConnection = New System.Data.OracleClient.OracleConnection() 'Oracle.DataAccess.Client.OracleConnection()
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim xlApp As Excel.Application
Dim xlWorkBook As Excel.Workbook
Dim xlWorkSheet As Excel.Worksheet
Dim range As Excel.Range
Dim rCnt As Integer
Dim cCnt As Integer
Dim Obj As Object
xlApp = New Excel.ApplicationClass
xlApp.Visible = True
xlWorkBook = xlApp.Workbooks.Open("c:\employee.xls")
xlWorkSheet = xlWorkBook.Worksheets("sheet1")
range = xlWorkSheet.UsedRange
For rCnt = 2 To range.Rows.Count
For cCnt = 1 To range.Columns.Count
Obj = CType(range.Cells(rCnt, cCnt), Excel.Range)
'MsgBox(Obj.value)
Next
Next
xlWorkBook.Close()
xlApp.Quit()
releaseObject(xlApp)
releaseObject(xlWorkBook)
releaseObject(xlWorkSheet)
End Sub
Private Sub releaseObject(ByVal obj As Object)
Try
System.Runtime.InteropServices.Marshal.ReleaseComObject(obj)
obj = Nothing
Catch ex As Exception
obj = Nothing
Finally
GC.Collect()
End Try
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim daOracle As New OracleDataAdapter
Dim InsertCommand As New OracleCommand
daOracle.InsertCommand = New OracleCommand
'1.Create connection object to Oracle database
Dim con As OracleConnection = New OracleConnection()
Try
'2.Specify connection string
con.ConnectionString = ("Data Source=mgra;User Id=tmar; Password=grams")
'3. Open the connection through ODP.NET
con.Open()
Catch ex As Exception
'4.display if any error occurs
MsgBox(ex.Message, Microsoft.VisualBasic.MsgBoxStyle.Exclamation, "OraScan")
'3.Create command object to perform a query against the database:
Dim cmdQuery As String = "SELECT * FROM employee"
InsertCommand.CommandText = "insert into meta_objecttypes values(4,'table','table','ERStudio','Demo')"
daOracle.InsertCommand = InsertCommand
' Create the OracleCommand object to work with select
Dim cmd As OracleCommand = New OracleCommand(cmdQuery)
cmd.Connection = con
cmd.CommandType = CommandType.Text
'get the DataReader object from command object
Dim rdr As OracleDataReader = cmd.ExecuteReader(CommandBehavior.CloseConnection)
cmd.ExecuteNonQuery()
'check if it has any row
While rdr.Read()
rdr.Close()
End While
Finally
' Close and Dispose OracleConnection object
con.Close()
con.Dispose()
End Try
End Sub
End ClassFor best results, please repost this to the ODP.NET forum.
-
I am a developer in .NET with having experience working on SQL server.
I want to know whether there is an xml data type in oracle.
I have an xml in my front end and want to insert record in the database for the values inside that xml. What i am doing currently is that i am retreiving the value in the xml in the .NET code and passing the values a parameter to a stored procedure in oracle. what i want to do is to pass the xml directly to stored procedure in oracle and retrieve the values there (using Xquery) and insert the records.
This is possible with SQL server 2005. I want to know is this possible with Oracle.
Thanks and regards,
Sameer J NarkarWonderful - a documentation question!
You will find your answer by going to the general documentation portal at http://tahiti.oracle.com following the path to the database version of interest, and looking in the SQL Reference manual. Chapter 2 discusses all data types, including the several supported for XML.
In addition, under the 'Books' tab, there are several XML-developer specific reference manuals.
(Oracle's support for XML generally blows away the others. The price for the extreme flexibility is an ease-of-use hit.)
Message was edited by:
Hans Forbrich
removed the punctuation from the displayed URL which resulted in an automatically included trailing comma. -
Loading xml data to a oracle database problem in style sheet
Hi,
I Have one small Problem While loading xml data to a oracle database.
In the XML i have the Columns and Data Like this.
<Data>
<TRAN>
<Type_Trs>A</Type_Trs>
<T1>2</T1>
<T2>3</T2>
</TRAN>
<TRAN>
<Type_Trs>B</Type_Trs>
<T1>2</T1>
<T2>3</T2>
</TRAN>
</Data>
I have TRAN Table having Field Like this.
TRAN(Type_Trs,T1,F)
Note:- The XML Column T2 is Not matching with TRAN Table Column F
I want to fetch T2 data into F column.
When I am fetching the xml data into oracle table only
one row is fetching.
Can You help me
To load the the all the record of XML data into the Oracle Table
What will be my XLS Style Sheet File Please
suggest me.
Regards
MBR
Thnks in AdvanceHi MBR
You would be better posting your question to the general XML forums:
http://forums.oracle.com/forums/category.jspa?categoryID=51
This is purely for XML/BI Publisher where we get the data back out of the db :o)
Tim -
Bulk insert into oracle using ssis
Hi ,
Can someone please suggest me the way to Bulk insert data into oracle database? I'm using oledb which doesnt support bulk insert into oracle.
Pls note I cant use Oracle ATTUnity as it requires enterprise edition but i have only Standard edition and hence that option is ruled out.
Is there any other way that I can accompolish BULK insert?
Please help me out.
Thanks,
PrabhuHi Prabhu,
I am very late to help you solve the query but following is the solution to 'Bulk Insert into Oracle' that worked for me.
To use below code for SSIS 2008 R2 in a
Script Task component you would need following API references.
Prerequisites:
1. C:\Program Files (x86)\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SQLServer.DTSRuntimeWrap.dll
2. Install "Oracle Data Provider For .NET 11.2.0.1.0" and add a reference to
Oracle.DataAccess.dll.
Microsoft SQL Server Integration Services Script Task
Write scripts using Microsoft Visual C# 2008.
The ScriptMain is the entry point class of the script.
* Description : SQL to Oracle Bulk Copy/Insert
* Created By : Mitulkumar Brahmbhatt
* Created Date: 08/14/2014
* Modified Date Modified By Description
using System;
using System.Data;
using Microsoft.SqlServer.Dts.Runtime;
using System.Windows.Forms;
using Oracle.DataAccess.Client;
using Microsoft.SqlServer.Dts.Runtime.Wrapper;
using System.Data.OleDb;
namespace ST_6e18a76102dd4312868504c4ef95279d.csproj
[System.AddIn.AddIn("ScriptMain", Version = "1.0", Publisher = "", Description = "")]
public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
#region VSTA generated code
enum ScriptResults
Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
#endregion
public void Main()
ConnectionManager cm;
IDTSConnectionManagerDatabaseParameters100 cmParams;
OleDbConnection oledbConn;
DataSet ds = new DataSet();
string sql;
try
/********** Pull Sql Source Data into a Dataset *************/
cm = Dts.Connections["SRC_CONN"];
cmParams = cm.InnerObject as IDTSConnectionManagerDatabaseParameters100;
oledbConn = (OleDbConnection)cmParams.GetConnectionForSchema() as OleDbConnection;
sql = @"Select * from [sourcetblname]'';
OleDbCommand sqlComm = new OleDbCommand(sql, oledbConn);
OleDbDataAdapter da = new OleDbDataAdapter(sqlComm);
da.Fill(ds);
cm.ReleaseConnection(oledbConn);
/***************** Bulk Insert to Oracle *********************/
cm = Dts.Connections["DEST_CONN"];
cmParams = cm.InnerObject as IDTSConnectionManagerDatabaseParameters100;
string connStr = ((OleDbConnection)cmParams.GetConnectionForSchema() as OleDbConnection).ConnectionString;
cm.ReleaseConnection(oledbConn);
sql = "destinationtblname";
using (OracleBulkCopy bulkCopy = new OracleBulkCopy(connStr.Replace("Provider=OraOLEDB.Oracle.1", "")))
bulkCopy.DestinationTableName = sql;
bulkCopy.BatchSize = 50000;
bulkCopy.BulkCopyTimeout = 20000;
bulkCopy.WriteToServer(ds.Tables[0]);
/***************** Return Result - Success *********************/
Dts.TaskResult = (int)ScriptResults.Success;
catch (Exception x)
Dts.Events.FireError(0, "BulkCopyToOracle", x.Message, String.Empty, 0);
Dts.TaskResult = (int)ScriptResults.Failure;
finally
ds.Dispose();
Mitulkumar Brahmbhatt | Please mark the post(s) that answered your question.
Maybe you are looking for
-
Mail will no longer receive on Entourage, only on my iPhone. Help!!
I've just got an iPhone and have recently got a new Macbook. I use entourage to collect my business emails, and have set my iPhone up to also recieve them. Mail is coming through find on the iPhone, but not on the Mac through Entourage. It gives me a
-
Hi All, I am using Receiver Mail Adapter to send mails. When i choose Message Protocol the mail goes. But when i change it to XIPAYLOAD the mail doesnt go. I cannot find any errors in SXI_MONITOR or in adapter monitoring. My file is in this format..
-
After Configuring JBoss 4.2 for LiveCycle 8.2 using preinstallsingle.pdf documentation on Linux platform . Deployed the following Jars to Jboss deploy/ adobe-livecycle-jboss.ear adobe-livecycle-native-jboss-x86_linux.ear Statred the JBoss and succes
-
My iphone is stuck on apple logo homescreen
It is stuck on the apple home screen, it won't even turn off when pressing the home sleep/lock button so i can't even do apple reboot thingy that everyone's suggesting...some one please help D:
-
Hi I think its not a good idea to have "airplane mode" in Control center because if you lost your iphone person who find it could active it easy and you never find it