Skip to Main Content
  • Questions
  • Loading XML Into Tables Using Pl/SQL

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Lisa.

Asked: November 07, 2004 - 6:52 pm UTC

Last updated: January 15, 2024 - 5:03 am UTC

Version: 9.2

Viewed 50K+ times! This question is

You Asked

Dear Tom,

I am new to XML and don't know Java and, unfortunately, do not have time to learn
it right now as I need to have a little prototype done of this in a couple
of days. I did a lot of reading on your site and reviewed many of the OTN
references but I was not able to connect to my problem, probably because
I don't know enough. I am using Oracle 9i release 2 at patch 4 on a Windows 2000 server.
I also want to do this all in PL/SQL. Here is my requirement:

1) I download an XML file from the Internet and save it to a network drive.
2) I also have users who may, if the website is down, enter the data via
a .NET application, which assembles it into an XML document that gets saved to the file.
3) I then put the XML document into a table (I have done this step with using a CLOB and a column of XMLType). I then need to write a PL/SQL procedure that does some preliminary validation
on some of the fields. For example, issue date must occur before maturity
date, auction date must occur after issue date, etc.
This procedure will be called by both the .NET application to
do the preliminary validation and will also be executed as a batch process
against those files that are downloaded from the Internet.
4) Ultimately, once the preliminary validation is complete the data from the XML file needs to
be loaded into legacy database tables. The existing tables do not have field names that
correspond anywhere near the XML field names as we used to type most of the data in
manually. But I do not have to go directly to the end table. I am perfectly
happy creating a table that corresponds to the XML fields and then inserting the relevant
data into the end tables from the table that corresponds to the XML fields is that is easier.

I am including an example of the type of XML document I am dealing with.
What is a good way to do this given that I want to do this in PL/SQL? I have played with a number of test cases (registering the
schema, creating an XSLT, etc. but I have not been having much luck).
Any help would be greatly appreciated. Thank you.

<?xml version="1.0" encoding="UTF-8" ?>
- <bpd:AICAuctionData xmlns:bpd="</code> http://www.publicdebt.treas.gov/"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://publicdebt.treas.gov/ http://publicdebt.treas.gov/xsd/AICAuction.xsd" > <code>
- <AuctionAnnouncement>
<SecurityTermWeekYear>4-WEEK</SecurityTermWeekYear>
<SecurityTermDayMonth>29-DAY</SecurityTermDayMonth>
<SecurityType>BILL</SecurityType>
<CUSIP>912795RN3</CUSIP>
<AnnouncementDate>2004-10-25</AnnouncementDate>
<AuctionDate>2004-10-26</AuctionDate>
<IssueDate>2004-10-28</IssueDate>
<MaturityDate>2004-11-26</MaturityDate>
<OfferingAmount>20.0</OfferingAmount>
<CompetitiveTenderAccepted>Y</CompetitiveTenderAccepted>
<NonCompetitiveTenderAccepted>Y</NonCompetitiveTenderAccepted>
<TreasuryDirectTenderAccepted>N</TreasuryDirectTenderAccepted>
<AllTenderAccepted>N</AllTenderAccepted>
<TypeOfAuction>SINGLE PRICE</TypeOfAuction>
<CompetitiveClosingTime>11:30</CompetitiveClosingTime>
<NonCompetitiveClosingTime>11:00</NonCompetitiveClosingTime>
<NetLongPositionReport>7000000000</NetLongPositionReport>
<MaxCompetitiveBid>35</MaxCompetitiveBid>
<MaxSingleBid>35</MaxSingleBid>
<CompetitiveBidDecimals>3</CompetitiveBidDecimals>
<AllocationPercentageDecimals>2</AllocationPercentageDecimals>
<MinCompetitiveAmount>1000</MinCompetitiveAmount>
<MinNonCompetitiveAmount>1000</MinNonCompetitiveAmount>
<MultiplesToBid>1000</MultiplesToBid>
<MinToIssue>1000</MinToIssue>
<MultiplesToIssue>1000</MultiplesToIssue>
<MatureSecurityAmount>19001.0</MatureSecurityAmount>
<OutstandingAmount>46624</OutstandingAmount>
<SOMAIncluded>N</SOMAIncluded>
<FederalReserveHoldings>14991.0</FederalReserveHoldings>
<FIMAIncluded>Y</FIMAIncluded>
<ForeignInstitutionalHoldings />
<PayDownNewCashIndicator>NC</PayDownNewCashIndicator>
<PayDownNewCashAmount>999.0</PayDownNewCashAmount>
<Series />
<InterestRate />
<FirstInterestPaymentDate />
<StandardInterestPayment />
<FrequencyInterestPayment />
<StrippableIndicator />
<MinStripAmount />
<CorpusCUSIP />
<TINTCUSIP1 />
<TINTCUSIP2 />
<ReOpeningIndicator />
<OriginalIssueDate />
<BackDated />
<BackDatedDate />
<LongShortNormalCoupon />
<LongShortCouponFirstInterestPayment />
<Callable />
<CallDate />
<InflationIndexSecurity />
<ReferenceCPIDated />
<IndexRatioOnIssueDate />
<CPIBasePeriod />
<TIINConversionFactor />
<AccruedInterest />
<DatedDate>2004-05-27</DatedDate>
</AuctionAnnouncement>
</bpd:AICAuctionData>

and Tom said...

I asked Sean Dillon, my XML Technologist, to take a look at this and here's what he had to say:
---

Hi Lisa,

This should be relatively easy to accomplish, aside from the .NET app :). Let's take it a step at a time.

First, getting the XML into the database. There's no reason why you should go to the web, download the XML and save it off to some file on the hard drive, then put it into the database w/ some process. Why not just tell the database the URL and have it go and retrive the XML directly? You can do this w/ HTTPUri's:

----------------------------------------
sdillon@GRUVDB> declare
2 l_url httpuritype;
3 l_xml xmltype;
4 begin
5 l_url := httpuritype.createuri('</code> http://asktom.oracle.com/pls/ask/ask_tom.newest.rss'
;
  6    l_xml := l_url.getxml();
  7    --
  8    dbms_output.put_line(substr(l_xml.extract('/').getstringval(),1,250));
  9  end;
 10  /
<rss version="0.91">
  <channel>
    <title>Ask Tom MOST RECENT ARTICLES</title>
    <link>
http://asktom.oracle.com </link>

<description>These are the questions on Ask Tom that have the most comments</description>
    <language>en-us</language>

PL/SQL procedure successfully completed.
----------------------------------------

I assume the url changes from time to time, so you could simply pass the url into a function that retrieves the XML document and saves it as a new row in a table w/ an XMLType column.  You might store the timestamp of the request, the url of the xml request, and the content at the time of retrieval (with the thought that it might change over time).

That's ONE way to get the XML into your database w/o having to d/l it manually, store it into the db through a proc or whatnot.

Next you mentioned you have some business rules you want to check before you put the data in.  You can do this through the same procedure you use to retrieve the XML, or better yet you can do it through an insert trigger. (as you'll also be inserting XML from a .NET application that users can use to put XML into the table as well).

In this example, I'll create the table and add a trigger that checks the version of the RSS I'm inserting.  I'll call the asktom rss links two times, one for version .91 and one for version 2.  In the validation, if I get anything other than v2 rss, the insert will bail.

-----------------------------------
sdillon@GRUVDB> create table xmldocs( x xmltype )
  2  /
Table created.

sdillon@GRUVDB> create or replace trigger xmldocs_bifer
  2  before insert
  3  on xmldocs
  4  for each row
  5  declare
  6    l_rssver number;
  7    l_xml    xmltype := :new.x;
  8  begin
  9    l_rssver := l_xml.extract('/rss/@version').getNumberVal();
 10    if l_rssver <> '0.91' then
 11      raise_application_error(-20001,'Wrong RSS version!');
 12    end if;
 13  end xmldocs_bifer;
 14  /
Trigger created.

sdillon@GRUVDB> insert into xmldocs
  2  values (httpuritype.createuri('
http://asktom.oracle.com/pls/ask/ask_tom.newest.rss'
.getxml())
  3  /
1 row created.

sdillon@GRUVDB> -- we'll need this commit later
sdillon@GRUVDB> commit;
Commit complete.

sdillon@GRUVDB> insert into xmldocs
  2  values (httpuritype.createuri('
http://asktom.oracle.com/pls/ask/ask_tom.newest.rss?p_version=2'
.getxml())
  3  /
values (httpuritype.createuri('
http://asktom.oracle.com/pls/ask/ask_tom.newest.rss?p_version=2'
.getxml())
        *
ERROR at line 2:
ORA-20001: Wrong RSS version!
ORA-06512: at "DHS.XMLDOCS_BIFER", line 7
ORA-04088: error during execution of trigger 'DHS.XMLDOCS_BIFER'
-----------------------------------

Now, as for loading the data into a relational table.  You can do this any number of ways.  You can either query the document for xpath expressions and insert the data into the table based on the results, or you can simply use DOM to parse the document and insert the values based on the results you get.  You can search asktom for an example of using DOM to extract data from an XML document, as well as doing xpath queries.

-----------------------------------
sdillon@GRUVDB> create table xmldoc_values(
  2    title  varchar2(100),
  3    link      varchar2(100),
  4    descr  clob,
  5    lang      varchar2(100),
  6    copyr  varchar2(100)
  7  )
  8  /
Table created.

sdillon@GRUVDB> --now query the record we inserted (and committed) earlier
sdillon@GRUVDB> begin
  2    for i in (select xmltype.extract(x,'/rss/channel/title/text()').getStringVal() title,
  3                     xmltype.extract(x,'/rss/channel/link/text()').getStringVal() link,
  4                     xmltype.extract(x,'/rss/channel/description/text()').getStringVal() descr,
  5                     xmltype.extract(x,'/rss/channel/language/text()').getStringVal() lang,
  6                     xmltype.extract(x,'/rss/channel/copyright/text()').getStringVal() copyright
  7                from xmldocs) loop
  8      insert into xmldoc_values( title, link, descr, lang, copyr )
  9      values (i.title, i.link, i.descr, i.lang, i.copyright);
 10    end loop;
 11  end;
 12  /
PL/SQL procedure successfully completed.

sdillon@GRUVDB> select * from xmldoc_values
  2  /

TITLE
---------
LINK
---------
DESCR
---------
LANG
---------
COPYR
---------
Ask Tom MOST RECENT ARTICLES
http://asktom.oracle.com <code>
These are the questions on Ask Tom that have the most comments
en-us
Copyright 1999-2003, Oracle Corporation
-----------------------------

Hope that helps!

_smd_

Sean Dillon

Rating

  (29 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

What about this error?

Richard Xu, November 09, 2004 - 1:34 pm UTC

I followed your example but get an error when I tried to insert into a record in xmldocs.

SQL > insert into xmldocs
2 values (httpuritype.createuri('</code> http://localhost/xmldoc/xmlsampleV4a.xml'
);
  values (httpuritype.createuri('
http://localhost/xmldoc/xmlsampleV4a.xml' <code>)
*
ERROR at line 2:
ORA-00932: inconsistent datatypes: expected - got SYS.HTTPURITYPE


Tom Kyte
November 09, 2004 - 1:38 pm UTC

ops$tkyte@ORA9IR2> create table xmldocs( x xmltype );
 
Table created.
 
ops$tkyte@ORA9IR2> insert into xmldocs
  2  values (httpuritype.createuri
     ('http: //asktom.oracle.com/pls/ask/ask_tom.newest.rss').getxml() );
 
1 row created.
 
ops$tkyte@ORA9IR2>



<b>you seem to be missing the getxml() at the end</b>

(note: example has extra space after http: in order to make it so my auto-markup routine doesn't munge the URL, it would not be there in real life) 

XMLTYPE.extract

Richard, November 09, 2004 - 3:43 pm UTC

In your example, you retrieve piece information from XMLTYPE using:
xmltype.extract(x,'/rss/channel/title/text()').getStringVal(),
it includes 2 parameters to the extract function. But I check the XML API Reference documentation from oracle, it seems that statement should be like:
x.extract('/rss/channel/title/text()').getStringVal(),

And I tried it and failed.

What is your idea?

Tom Kyte
November 09, 2004 - 4:04 pm UTC

xmltype is an object type.

they all have a 'hidden' self parameter, part and parcel of being "an object".

it could have been coded as:

ops$tkyte@ORA10G> begin
  2    for i in (
    select A.x.extract('/rss/channel/title/text()').getStringVal() title,
  3        A.x.extract('/rss/channel/link/text()').getStringVal() link,
  4        A.x.extract('/rss/channel/description/text()').getStringVal() descr,
  5        A.x.extract('/rss/channel/language/text()').getStringVal() lang,
  6        A.x.extract('/rss/channel/copyright/text()').getStringVal() copyright
  7                from xmldocs A) loop
  8      insert into xmldoc_values( title, link, descr, lang, copyr )
  9      values (i.title, i.link, i.descr, i.lang, i.copyright);
 10    end loop;
 11  end;
 12  /


as well. 

Why

Richard, November 09, 2004 - 7:36 pm UTC

How do you explain this?

db92tp > select t.x.getrootelement() from xmldocs t;

T.X.GETROOTELEMENT()
--------------------------------------------------------
HBS

db92tp > select t.x.existsnode('/HBS') from xmldocs t;

T.X.EXISTSNODE('/HBS')
----------------------
0


Tom Kyte
November 09, 2004 - 8:51 pm UTC

well, given you must be using different data -- since rss would be our root element, I cannot explain a thing.


 
ops$tkyte@ORA9IR2>
ops$tkyte@ORA9IR2> select t.x.getrootelement() from xmldocs t;
 
T.X.GETROOTELEMENT()
-------------------------------------------------------------------------------
rss
 
ops$tkyte@ORA9IR2> select t.x.existsnode('/rss') from xmldocs t;
 
T.X.EXISTSNODE('/RSS')
----------------------
                     1
 

Inserting data Itemwise

Jignesh Karia, November 10, 2004 - 6:12 am UTC

I want to insert the data itemwise.

Inserted rows should looklike :

select xmltype.extract(x,'/rss/channel/item/description/text()').getStringVal() title from xmldocs;

TITLE
----------------------------------------------------------
Update statement and Null-values
update a table from another table
DIFFERENCES BETWEEN PROCESSES, SESSIONS AND CONNECTIONS
Backup and Recovery
Logical Reads vs Physical Reads
Loading XML Into Tables Using Pl/SQL
performance with index
Pivot Query
Your favorite 10g features
Import takes more timeV$session_wait

10 Rows Selected

---------------------


But when I do that I can see only one row.

select xmltype.extract(x,'/rss/channel/item/description/text()').getStringVal() title from xmldocs;

TITLE
----------------------------------------------------------
Update statement and Null-values -- update a table from another tableDIFFERENCES BETWEEN PROCESSES, SESSIONS AND CONNECTIONSBackup and RecoveryLogical Reads vs Physical ReadsLoading XML Into Tables Using Pl/SQLperformance with indexPivot QueryYour favorite 10g featuresImport takes more timeV$session_wait

What if I want to insert the data itemwise?


Tom Kyte
November 10, 2004 - 8:24 am UTC

Hi, Sean here.

Since you have multiple item nodes in that RSS, you'll have to cast the set of <item> nodes into a collection you can query. This is done by using a combination of the TABLE and XMLSEQUENCE operators.

sdillon@GRUVDB> col rownum for 999
sdillon@GRUVDB> col descr for a50 word_wrapped
sdillon@GRUVDB>
sdillon@GRUVDB> select rownum, extractvalue(value(i),
2 '/item/description/text()') descr
3 from xmldocs,
4 table( xmlsequence( extract(xmldocs.x, '/rss/channel/item') ) ) i
5 /

ROWNUM DESCR
------ --------------------------------------------------
1 Hi ,tom
Is there any way to estimate the performance
increased by adding index ?(I don't want to create
index before I know it's useful.Since my DB is
very huge)
Best Regards Daniel


2 I have a table from a 3rd party application that
is used to track
an order through the various manufacturing
operations. A subset of
the information looks like this:
ORDER OPN STATION CLOSE_DATE
----- --- ------- ----------
1...

3 Tom,
My basic requirement is like this : I need to
take a dump of a schema. But I don't want to
export certain tables which are really huge and I
don't want them in the dump. Since there is no
way to exclude tables in the export command, I
crea...

4 I've detected a few invalid objects in one of our
databases. How do I make them 'VALID'?

5 I am new in tuning sql statements. Can u give a
methodology of tuning
the sql statements.

6 Hi tom,
Here is the query
SQL&gt; select
segment_name,segment_type,owner,tablespace_name
from
2 dba_extents,v$session_wait
3 where file_id=p1
4 and p2 between block_id and block_id + blocks
-1;
SEGMENT_NAME ...

7 Tom,
When updating a column with an update-statement,
the value of some records (records that don't need
to be updated), are changed into the value NULL. I
use the next statement:
update table name B
set columnname =
( select value
...

8 I would like to know if it is possible to
configure the Oracle data format to also capture
the timezone that date and time orginated.

9 I have surfed OTN for 10g information, but believe
me it?s a lot of documentation :)
If possible can you just name few important
features that you loved most in Oracle 10g (as a
product designer or beta tester)
It will help me to read proper do...

10 Hi Tom
What's the difference between connections,
sessions and processes?
I read a note from Metalink about the difference
but I simply dont get it!
May you give a brief explanation?
Thank you


10 rows selected.

Hope that helps

XMltype and database link

KOpan, January 19, 2005 - 12:51 pm UTC



select
sl.IDScoringLog,
sl.IDScoring,
sl.IDRating,
from
rt_scoringlog@icstb sl;

select
sl.IDScoringLog,
sl.IDScoring,
sl.IDRating,
extractValue(sl.InputXML,'/APPLICATION/Applicants/MINACTDATE/text()') as bla
from
rt_scoringlog@icstb sl;


TOAD: Table or view doesn't exist.
But it really exist!
How to work with xmltype and DB link



xmltype.isschemavalid using a URI of a member function?

Harris, September 24, 2005 - 8:48 am UTC

Tom, I am developing a user defined "type" and member function that accepts an XMLTYPE for one of its parameters. I would like to be able to validate the passed XMLTYPE against an XSD before extracting its contents. However, I wish to also have the XSD internally bundled within the "type" that I am developing. To do this, I will include an additional static function to generate (spit out) the XSD. The problem I face is that the XMLTYPE.ISSCHEMAVALID function accepts a URI for the XSD - which could be a http, file or dburi. I can't work out how to either specify the DBURI as a "type.function()" output, or how to invoke XMLTYPE.ISSCHEMAVALID by passing the XSD as a clob. I don't want to be forced to put the XSD in a table or on the filesystem - as I want to keep it bundled in the "type" I am developing. Any ideas on how to make a DBURI reference this? Or, alternatively, can you pass a XSD clob to XMLTYPE.ISSCHEMAVALID?

Tom Kyte
September 24, 2005 - 11:20 am UTC

could you not just create a view

select yourtype.static_function() from dual;


and use a dburi in this case?

Round tripping XML for inter-system communication

Mike Friedman, September 25, 2005 - 3:26 am UTC

Tom,

We would like to set up a framework to allow easy round tripping between the database and XML. We're quite flexible about the XML format - we expect to use XSL to do any necessary transformations for connectivity with heterogeneous systems - but we want a consistent and reasonably easy way to do the round tripping.

Just so everyone is clear, round tripping is the ability to take a data structure in the DB, extract it to XML, and then take that XML and use it to load another database with the original relational data. So, for example, IMP and EXP support round tripping.

We want a common approach that we can use for multiple different data structures - basically a design pattern.

Any suggestions?

Loading data from xml file into Oracle10g R2

Laxman Kondal, January 19, 2006 - 3:15 pm UTC

Hi Tom,

On this thread Sean Dillon said:

"
Why not just tell the database the URL and have it go and retrive the XML directly?  You can do this w/ HTTPUri's:

----------------------------------------
sdillon@GRUVDB> declare
  2    l_url   httpuritype;
  3    l_xml   xmltype;
  4  begin
  5    l_url := httpuritype.createuri('
http://asktom.oracle.com/pls/ask/ask_tom.newest.rss';
  6    l_xml := l_url.getxml();
  7    --
  8    dbms_output.put_line(substr(l_xml.extract('/').getstringval(),1,250));
  9  end;
 10  /
----------------------------
"
I am not sure how security is maintained in this case.

Secondly I am testing this in Oracle10g R2 and got this error and not able to figure out where the error is: 

SQL> exec insert_xml_data
BEGIN insert_xml_data; END;

*
ERROR at line 1:
ORA-29532: Java call terminated by uncaught Java exception:
oracle.xml.sql.OracleXMLSQLException: Unexpected EOF.
ORA-06512: at "SYS.DBMS_XMLSAVE", line 115
ORA-06512: at "OPOM.DO_DML_XML_DATA", line 21
ORA-06512: at "OPOM.INSERT_XML_DATA", line 23
ORA-06512: at line 1
------------------------------------------------------------

Thanks and regards
 

Tom Kyte
January 19, 2006 - 4:45 pm UTC

what about "security" - that being a rather "broad term". What is the problem you forsee.

no example, no lookee - I've no idea what insert_xml_data is, does, looks like, etc.

Loading data from xml file into Oracle10g R2

Laxman Kondal, January 19, 2006 - 5:41 pm UTC

Hi Tom,

Thanks for reply and sorry for not giving example.

With this url any one can fetch file which may have senstive data. This do not have any username/pwd usless I am missing it.

l_url := httpuritype.createuri('</code> http://asktom.oracle.com/pls/ask/ask_tom.newest.rss' <code>
;

==========================================
Sorry for not givibg example:
==========================================
scott@ORCL10G> create or replace function insert_xml_emps(
2 p_tablename in varchar2,
3 p_in_tmpclob in number)
4 return number
5 is
6 l_ctx dbms_xmlsave.ctxType;
7 l_rows number;
8 begin
9 for c1 in (select theclob
10 from tmp_clob
11 where id = p_in_tmpclob) loop
12
13 l_ctx := dbms_xmlsave.newContext(p_tableName);
14 l_rows := dbms_xmlsave.insertxml(l_ctx,c1.theclob);
15 dbms_xmlsave.closeContext(l_ctx);
16
17 delete from tmp_clob
18 where id = p_in_tmpclob;
19 end loop;
20 return l_rows;
21 end insert_xml_emps;
22 /

Function created.

scott@ORCL10G> CREATE OR REPLACE PROCEDURE Load_Xml_File(
2 p_table_name IN VARCHAR2,
3 p_filename IN VARCHAR2)
4 AS
5 l_clob CLOB;
6 l_bfile BFILE;
7 --
8 BEGIN
9 INSERT INTO Tmp_Clob(ID) VALUES (1);
10 UPDATE Tmp_Clob SET theclob = EMPTY_CLOB()
11 WHERE ID = 1
12 RETURNING theclob INTO l_clob;
13 --
14 l_bfile := BFILENAME('MY_DIR', p_filename);
15 dbms_lob.fileopen(l_bfile );
16 dbms_lob.loadfromfile(l_clob, l_bfile,dbms_lob.getlength(l_bfile));
17 dbms_lob.fileclose(l_bfile);
18 END Load_Xml_File;
19 /

Procedure created.

scott@ORCL10G> create table emp_xml as select * from emp where 1=0;

Table created.

scott@ORCL10G>


-------------------------------------------------
This is the xml data file
-------------------------------------------------
<?xml version = '1.0'?>
<ROWSET>
<ROW num="1">
<EMPNO>7369</EMPNO>
<ENAME>SMITH</ENAME>
<JOB>CLERK</JOB>
<MGR>7902</MGR>
<HIREDATE>12/17/1980 0:0:0</HIREDATE
<SAL>800</SAL>
<DEPTNO>20</DEPTNO>
</ROW>
<ROW num="2">
<EMPNO>7499</EMPNO>
<ENAME>ALLEN</ENAME>
<JOB>SALESMAN</JOB>
<MGR>7698</MGR>
<HIREDATE>2/20/1981 0:0:0</HIREDATE>
<SAL>1600</SAL>
<COMM>300</COMM>
<DEPTNO>30</DEPTNO>
</ROW>
<ROW num="3">
<EMPNO>7521</EMPNO>
<ENAME>WARD</ENAME>
<JOB>SALESMAN</JOB>
<MGR>7698</MGR>
<HIREDATE>2/22/1981 0:0:0</HIREDATE>
<SAL>1250</SAL>
<COMM>500</COMM>
<DEPTNO>30</DEPTNO>
</ROW>
<ROW num="4">
<EMPNO>7566</EMPNO>
<ENAME>JONES</ENAME>
<JOB>MANAGER</JOB>
<MGR>7839</MGR>
<HIREDATE>4/2/1981 0:0:0</HIREDATE>
<SAL>2975</SAL>
<DEPTNO>20</DEPTNO>
</ROW>
<ROW num="5">
<EMPNO>7654</EMPNO>
<ENAME>MARTIN</ENAME>
<JOB>SALESMAN</JOB>
<MGR>7698</MGR>
<HIREDATE>9/28/1981 0:0:0</HIREDATE>
<SAL>1250</SAL>
<COMM>1400</COMM>
<DEPTNO>30</DEPTNO>
</ROW>
<ROW num="6">
<EMPNO>7698</EMPNO>
<ENAME>BLAKE</ENAME>
<JOB>MANAGER</JOB>
<MGR>7839</MGR>
<HIREDATE>5/1/1981 0:0:0</HIREDATE>
<SAL>2850</SAL>
<DEPTNO>30</DEPTNO>
</ROW>
<ROW num="7">
<EMPNO>7782</EMPNO>
<ENAME>CLARK</ENAME>
<JOB>MANAGER</JOB>
<MGR>7839</MGR>
<HIREDATE>6/9/1981 0:0:0</HIREDATE>
<SAL>2450</SAL>
<DEPTNO>10</DEPTNO>
</ROW>
<ROW num="8">
<EMPNO>7788</EMPNO>
<ENAME>SCOTT</ENAME>
<JOB>ANALYST</JOB>
<MGR>7566</MGR>
<HIREDATE>4/19/1987 0:0:0</HIREDATE>
<SAL>3000</SAL>
<DEPTNO>20</DEPTNO>
</ROW>
<ROW num="9">
<EMPNO>7839</EMPNO>
<ENAME>KING</ENAME>
<JOB>PRESIDENT</JOB>
<HIREDATE>11/17/1981 0:0:0</HIREDATE>
<SAL>5000</SAL>
<DEPTNO>10</DEPTNO>
</ROW>
<ROW num="10">
<EMPNO>7844</EMPNO>
<ENAME>TURNER</ENAME>
<JOB>SALESMAN</JOB>
<MGR>7698</MGR>
<HIREDATE>9/8/1981 0:0:0</HIREDATE>
<SAL>1500</SAL>
<COMM>0</COMM>
<DEPTNO>30</DEPTNO>
</ROW>
<ROW num="11">
<EMPNO>7876</EMPNO>
<ENAME>ADAMS</ENAME>
<JOB>CLERK</JOB>
<MGR>7788</MGR>
<HIREDATE>5/23/1987 0:0:0</HIREDATE>
<SAL>1100</SAL>
<DEPTNO>20</DEPTNO>
</ROW>
<ROW num="12">
<EMPNO>7900</EMPNO>
<ENAME>JAMES</ENAME>
<JOB>CLERK</JOB>
<MGR>7698</MGR>
<HIREDATE>12/3/1981 0:0:0</HIREDATE>
<SAL>950</SAL>
<DEPTNO>30</DEPTNO>
</ROW>
<ROW num="13">
<EMPNO>7902</EMPNO>
<ENAME>FORD</ENAME>
<JOB>ANALYST</JOB>
<MGR>7566</MGR>
<HIREDATE>12/3/1981 0:0:0</HIREDATE>
<SAL>3000</SAL>
<DEPTNO>20</DEPTNO>
</ROW>
<ROW num="14">
<EMPNO>7934</EMPNO>
<ENAME>MILLER</ENAME>
<JOB>CLERK</JOB>
<MGR>7782</MGR>
<HIREDATE>1/23/1982 0:0:0</HIREDATE>
<SAL>1300</SAL>
<DEPTNO>10</DEPTNO>
</ROW>
</ROWSET>
---------------------------------------------------------


scott@ORCL10G> select * from emp_xml;

no rows selected

scott@ORCL10G>

scott@ORCL10G> exec load_xml_file('insertemp')

PL/SQL procedure successfully completed.

scott@ORCL10G> commit;

Commit complete.

scott@ORCL10G> select * from tmp_clob;

ID THECLOB
---------- ------------------------------------------------
1 <?xml version = '1.0'?>
<ROWSET>
<ROW num="1">
<EMPNO>7369</EMPNO>



1 row selected.

scott@ORCL10G>
scott@ORCL10G> select insert_xml_emps('emp_xml',1) from dual;
select insert_xml_emps('emp_xml',1) from dual
*
ERROR at line 1:
ORA-29532: Java call terminated by uncaught Java exception: oracle.xml.sql.OracleXMLSQLException: '>' Missing from end
tag.
ORA-06512: at "SYS.DBMS_XMLSAVE", line 115
ORA-06512: at "SCOTT.INSERT_XML_EMPS", line 14


scott@ORCL10G>
================================================

When I debuged this one returns 0 in Insert_Xml_Emps function:
l_ctx := dbms_xmlsave.newContext(p_tableName);


Thanks and regards.


Tom Kyte
January 20, 2006 - 8:59 am UTC

unless a url NEEDS a username/password - so what. If it REQUIRES authentication, the example as posted would obviously not work (it is not like it gets around any authentication you have in place)

I do not have any authentication required, hence it is as secure as I've made it be.


...
<MGR>7902</MGR>
<HIREDATE>12/17/1980 0:0:0</HIREDATE
<SAL>800</SAL>
<DEPTNO>20</DEPTNO>
......

you are sort of missing a > from the end tag....

Loading data from XML filr into Oracle10g

Laxman Kondal, January 20, 2006 - 11:58 am UTC

Hi Tom,

Thanks for you help and it was the mistake, missing '>' tag.

It worked.

Thanks and regards.

need more help

Dilip Kuttuva Ganeshan, April 19, 2006 - 6:30 am UTC

Hi tom,
I want to copy data from one database to another database whose column is sys.xmltype datatype.The max length of the column is
select max(length(a.dd_xml.getclobval())) aa from dd a is

AA
----------
513482

so while copying it is giving error.so please give me some idea on this issue.I want to copy all the data from this database to another database table.

Tom Kyte
April 19, 2006 - 8:46 am UTC

"it is giving error"

interesting. but not of much use. We don't know what this vague "error" is, we don't know what you mean by "copy", we don't know what you have done.



Need More Help

Dilip Kuttuva Ganeshan, April 20, 2006 - 5:26 am UTC

Hi Tom,
   Sorry for not mentioning the problem clearly.here is my problem ..    I want to copy datas from one database to another database table.The source table is having many columns and out of that one column's datatype is sys.xmltype.The max lenght of the column is 513482 that i got from the following query..
select max(length(a.dd_xml.getclobval())) aa from dd a is

        AA
----------
    513482

and there are 29314 rows.Now the problem is we cannot copy the datas from the source to destination by copy command.I tried by the following sql

copy from d/ddd@source insert -
dilip (c2) using select a.pr_xml.getStringVal() from pr a;

it is giving error.If the lenght of the column is small then it is not giving error,but as the lenght is 513482 it is giving error.I tried it by import and export also.it is also not supporting xmltype datatype.I tried it by dblink also,even it is not supporting the xmltype datatype.So what is the solution ?

for copying i used this command
SQL> copy from d/ddd@source insert -
> dilip (c2) using select a.pr_xml.getStringVal() from pr a;

Array fetch/bind size is 15. (arraysize is 15)
Will commit when done. (copycommit is 0)
Maximum long size is 80. (long is 80)

SP2-0502: a.pr_xml.getStringVal() from proposal a
SP2-0503: *
SP2-0501: Error in SELECT statement: ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at line 1.
while trying from export utility,it is giving the following error.

About to export specified tables via Conventional Path ...
. . exporting table                       PR
EXP-00003: no storage definition found for segment(8, 461577)
Export terminated successfully with warnings.
 

Tom Kyte
April 20, 2006 - 8:19 am UTC

sqlplus copy would be entirely inappropriate - yes, it does not support these types (only basic types)


If you are getting that export error, there is a problem - please utilize support for that right away (you likely have indexes on this table owned by others - not by the schema doing the export). there are a couple of possible causes so I'll ask you to work with support.

Appended info

Dilip Kuttuva Ganeshan, April 20, 2006 - 5:31 am UTC

For u r knowledge,the host and the target database are 9i.

Thanks and regards,
Dilip Kuttuva Ganeshan

Tom Kyte
April 20, 2006 - 8:20 am UTC

"u r" ??

PL/SQL XPATH Select Question

Steve, September 14, 2006 - 2:50 pm UTC

Tom (or Sean),

I've been reviewing Sean's XML info and am very grateful for the clear and concise direction that he has provided. It has been very helpful and enlightening. However, I've been having problems dealing with retrieving data and appropriate records based upon XPATH searching criteria in my PL/SQL. I'm running 9iR2. Here's the Table creation and sample XML Records:

CREATE TABLE T_XML_BOOKS
(
ID_NBR NUMBER,
DATE_XML NUMBER,
TIME_XML NUMBER,
XML_DATA SYS.XMLTYPE
);
INSERT INTO T_XML_BOOKS ( ID_NBR, DATE_XML, TIME_XML, XML_DATA ) VALUES (
1, 20040713, 103203, XMLTYPE('<bookcatalog>
<book>
<title>History of Interviews</title>
<author>
<firstname>Juan</firstname>
<lastname>Smith</lastname>
</author>
<ISBN>99999-99999</ISBN>
<publisher>Oracle Press</publisher>
<publishyear>2003</publishyear>
<price type="US">10.00</price>
</book>
</bookcatalog>'));
INSERT INTO T_XML_BOOKS ( ID_NBR, DATE_XML, TIME_XML, XML_DATA ) VALUES (
2, 20040713, 103203, XMLTYPE('<bookcatalog>
<book>
<title>Dragonbone Chair</title>
<author>
<firstname>Tad</firstname>
<lastname>Williams</lastname>
</author>
<ISBN>1234-56789</ISBN>
<publisher>DAW</publisher>
<publishyear>1991</publishyear>
<price type="US">6.95</price>
</book>
</bookcatalog>'));
COMMIT;

First Example (Which Works -- demonstrates data exists):
SELECT ID_Nbr, Date_XML, Time_XML, extract(XML_DATA,'/').getStringVal() as XML_Data
FROM T_XML_BOOKS;

Second (Which Works -- demonstrates use of extractValue):
SELECT extractValue(xml_data, '/bookcatalog/book/title') as Title_Val
FROM t_XML_BOOKS;

Third (doesn't return author, firstname or ISBN)?

SELECT extractValue(xml_data, '/bookcatalog/book/title') as Title_Val,
extractValue(xml_data, '/bookcatalog/book/title/author') as auth,
extractValue(xml_data, '/bookcatalog/book/title/firstname') as fname,
extractValue(xml_data, '/bookcatalog/book/title/ISBN') as ISBN_Val
FROM t_XML_BOOKS

Fourth (Returns incorrect value from the existsNode function)?

SELECT extractValue(xml_data, '/bookcatalog/book/title') as Title_Val,
existsNode(xml_data, '/bookcatalog/book/title[QUERY="History of Interviews"]') as Response
FROM t_XML_BOOKS;

I would have expected "Response" to be a "1" on the one record and "0" on the other.

What am I missing?

Thanks

Steve...

Last message posted...

Steve Booth, September 26, 2006 - 4:05 pm UTC

Please ignore, figured out problems.

XML READ AND STORE THE DATA

Mohan, October 24, 2006 - 10:40 pm UTC

A simple question and the following scenario I do have..

Environment: Oracle9i Enterprise Edition Release
9.2.0.4.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data
Mining options
JServer Release 9.2.0.4.0 - Production

Front End: .NET Application

Scenario is: Thru the front end .net application there
would be a webservice call..
Based on that a set of 10 records is formed
in XML document which containing the
following columns and values

ID_EMP ID_DEPT ID_SALARY
1 10 3000
2 10 4000
3 10 5000

Based on XML document, I am supposed to read
it and update the values in Emp Table which
reside in Oracle.

Question is 1. As soon as the Fron end .Net Application
form the XML document where do they
store it.. Is it in any Physical Hard
disk on Server Side

2. How Oracle will read the XML document and
Update the Table.. Does Oracle
expect the document to be physically
presented.

3. what is the criteria is needed for this
operation in terms of any
Supplied Packages etc..

4. Any Code with example would be
appreciated.

Since am new to XML and kind of lost..
If anything am missed, please include that as well.

Regards,
Mohan.


asktom rss down?

A reader, December 28, 2006 - 5:45 pm UTC

hi tom
I had rss link set to http://asktom.oracle.com/pls/ask/ask_tom.newest.rss
but it doesn't work anymore
can you please provide correct link?
thanks

TNS Timeout

John O'Connell, September 12, 2008 - 6:48 am UTC

Hi Tom,

I am getting a TNS Timeout error when trying your code sample. When connecting to another server are there any settings typically needed in the tnsnames file.
11:19:30.487 DBMS-- Error: ORA-29273: HTTP request failed
11:19:30.487 DBMS-- ORA-12535: TNS:operation timed out
Tom Kyte
September 16, 2008 - 1:15 pm UTC

for http - tnsnames.ora doesn't even come into play.

All that means is that machine (the database server) cannot contact the remote web server (think "firewall" probably).

If you log onto the database server itself, can you:


<b>[tkyte@dellpe ~]$ telnet asktom.oracle.com 80</b>
Trying 209.246.0.140...
Connected to asktom.oracle.com.
Escape character is '^]'.<b>
GET / HTTP/1.0

</b>HTTP/1.1 200 OK
Date: Tue, 16 Sep 2008 17:14:07 GMT
Server: Oracle-Application-Server-10g/10.1.2.2.0 Oracle-HTTP-Server
Content-Location: index.html.en
Vary: negotiate,accept-language,*
TCN: choice
Last-Modified: Sat, 13 Oct 2007 00:42:27 GMT
ETag: "aa75d-4bd0-47101473;48092491"
Accept-Ranges: bytes
Content-Length: 19408
Connection: close
Content-Type: text/html
Content-Language: en
Expires: Tue, 16 Sep 2008 17:14:07 GMT

<!-- saved from url=(0022)http://internet.e-mail -->
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">



that is, can you get to the remote host on port 80 without the database being in the equation.

desired output

Anil, August 16, 2010 - 5:33 pm UTC

Tom,
Is there anyway to get the data in the row wise without writing any pl/sql code?

SQL> CREATE TABLE xmltest (
  2    pk number,
  3    xmlstring XMLTYPE);

Table created.

SQL> 
SQL> 
SQL> INSERT INTO xmltest VALUES 
  2     (       1, XMLType(
  3                '<County Area="Watford"> 
  4                 <Building>Oakdene</Building>
  5                 <Building>Chiswell</Building>
  6                 <Building>Leavesden</Building>
  7                 </County>'));

1 row created.

SQL> select extract(xmlSTRING,'/County/Building/text()')  output from XMLTest;

OUTPUT
--------------------------------------------------------------------------------
OakdeneChiswellLeavesden


Instead I want the above data as

OUTPUT
--------------------------------------------------------------------------------
Oakdene
Chiswell
Leavesden

Im using Oracle 10g

Thanks 

Anil

Inserting XML into table

Sanjay, February 18, 2011 - 8:43 am UTC

Dear Tom,

i would get the below in Procedure as parameter.
But i had searched for the method with which i could read this XML values into rows
and after validating some condition then insert into the table

the below is just the example which i need to achieve by putting into the table.

I tried the above method (Loading data from xml file into Oracle10g R2) which gave me the error.
Can you suggest me any method.


<?xml version = '1.0'?>
<ROWSET>
<ROW>
<EMPNO>7369</EMPNO>
<ENAME>SMITH</ENAME>
<JOB>CLERK</JOB>
<MGR>7902</MGR>
<HIREDATE>12/17/1980 0:0:0</HIREDATE>
<SAL>800</SAL>
<DEPTNO>20</DEPTNO>
</ROW>
<ROW>
<EMPNO>7499</EMPNO>
<ENAME>ALLEN</ENAME>
<JOB>SALESMAN</JOB>
<MGR>7698</MGR>
<HIREDATE>2/20/1981 0:0:0</HIREDATE>
<SAL>1600</SAL>
<COMM>300</COMM>
<DEPTNO>30</DEPTNO>
</ROW>
<ROW>
<EMPNO>7521</EMPNO>
<ENAME>WARD</ENAME>
<JOB>SALESMAN</JOB>
<MGR>7698</MGR>
<HIREDATE>2/22/1981 0:0:0</HIREDATE>
<SAL>1250</SAL>
<COMM>500</COMM>
<DEPTNO>30</DEPTNO>
</ROW>
</ROWSET>

thanks in advance.
Tom Kyte
February 18, 2011 - 9:29 am UTC

there are many ways to do this, you'll want to at least skim this document:

http://docs.oracle.com/docs/cd/E11882_01/appdev.112/e16659/toc.htm


... I tried the above method (Loading data from xml file into Oracle10g R2) which
gave me the error. ...

"the error", - I'll tell you what, my car won't start. When you can tell me why that is, I'll diagnose "the error"

get it - "the error" is "very vague" - so vague as to be meaningless.

XML vs Normal Text

Abhisek, March 16, 2011 - 11:30 am UTC

Hi To,

Could you please suggest in which case the processing time is faster: XML or normal Row/Column

I would store a string which contains the elements as all columns in the sample emp table rowwise.

Now, is the processing of data(e.g. selecting the rows) from the table faster, when we have normal rows/columns concept or XML datatype..

In case the normal row/column concept is faster, it would be great if you could explain why do we require XML type, when we can have everything in rows/coumns in simple manner..

P.S. with Normal Row/column I mean:
<u>First_Name   Last_Name</u>
Alex         Benaud
Tom          Kyte

With XML I mean
<u>XMLColumn</u>
<FirstName>Alex</FirstName><FirstName>Benaud</FirstName>
<FirstName>Tom</FirstName><FirstName>Kyte</FirstName>

Tom Kyte
March 16, 2011 - 12:36 pm UTC

Could you please suggest in which case the processing time is faster: XML or normal Row/Column


rows and columns, hands down.


I would store a string which contains the elements as all columns in the sample emp table rowwise.


that would be called "missing the entire point of the RDBMS"


it would be great if you could explain why do we require XML type

Indeed, it would be GREAT if someone would explain it to me first. I've never understand the love affair with XML - never.

As a data exchange medium - it is a bit wasteful (just a 'bit', meaning - a lot), but OK. There were much better standards for data exchange that predate XML by decades - but they weren't cool enough.

As a persistent data storage thing - I'm pretty convinced XML was invented by the disk drive and CPU manufacturers.

Good explanation

Abhisek, March 16, 2011 - 3:55 pm UTC

Hi Tom,

Thanks for your suggestion.

In case, one encounters a system that the file is delivered in a XML format only, what could be the best method to break the file into the rows and columns?

In case you require an XML file, here is a sample..
<!-- Sample_Employee.xml -->
<ROWSET>
  <ROW num="1">
    <EMPNO>7839</EMPNO>
    <ENAME>KING</ENAME>
  </ROW>
  <ROW num="2">
    <EMPNO>7788</EMPNO>
    <ENAME>SCOTT</ENAME>
  </ROW>
</ROWSET>

XML Guide

Abhisek, March 16, 2011 - 3:59 pm UTC

I am also going through the XML Guide:
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14259/toc.htm

But would appreciate if there is a quick pointer.
Tom Kyte
March 16, 2011 - 4:12 pm UTC

you have taken the right approach, I was just going to post a link to that

kumar, May 18, 2011 - 9:11 am UTC

Hi Tom,

My xml file structure is

<employees>

<employee>
<Data>
<createdBy>aaaa</createdBy>
<createdDate>2010-05-12 12:36:54.207
IST</createdDate>
</Data>

<employeeId>4</employeeId>
<isReadOnly>true</isReadOnly>
<isMandatoryFlag>false</isMandatoryFlag>

<details>

<detail>
<Data>
<createdBy>ggggg</createdBy>
<createdDate>2010-05-12 12:06:44.720
IST</createdDate>
</Data>

<empID>8</empID>
<empName>AGE</empName>
<empCode>AC</empCode>
<isMandatory>true</isMandatory>
<isAudited>true</isAudited>
</detail>

<detail>
<Data>
<createdBy>ddddd</createdBy>
<createdDate>2010-05-12 12:06:44.720
IST</createdDate>
</Data>

<empID>8</empID>
<empName>AGE</empName>
<empCode>AC</empCode>
<isMandatory>true</isMandatory>
<isAudited>true</isAudited>

</detail>

</details>

</employee>

</employees>

i want to extract values from xml file using xmltable in a procedure.passing the xml file as input.

Missing something

Rod, May 15, 2012 - 10:10 pm UTC

I have an XML File URL that returns:
<ConverstionRateCollection xmlns=" http://schemas.XYZ.org/2012/01/MYCOMP.Services.GL" xmlns:i=" http://www.w3.org/2001/XMLSchema-instance" >
<ConversionRateItems>
<ConversionRateItem xmlns="">
<FromCurrency>ABC</FromCurrency>
<ToCurrency>XYZ</ToCurrency>
<ConversionDate>2012-02-02T00:00:00</ConversionDate>
<ConversionRate>1.098903327866</ConversionRate>
<ConversionType>Spot</ConversionType>
<Currency> http://revsrvces.global.mycomp.com/GL/Currency/{currencyCode} </Currency>
</ConversionRateItem>
<ConversionRateItem xmlns="">
<FromCurrency>ZXR</FromCurrency>
<ToCurrency>XXP</ToCurrency>
<ConversionDate>2012-02-02T00:00:00</ConversionDate>
<ConversionRate>11.08117324557</ConversionRate>
<ConversionType>Spot</ConversionType>
<Currency> http://revsrvces.global.mycomp.com/GL/Currency/{currencyCode} </Currency>
</ConversionRateItem>
<ConversionRateItem xmlns="">
<FromCurrency>TAR</FromCurrency>
<ToCurrency>USD</ToCurrency>
<ConversionDate>2012-02-02T00:00:00</ConversionDate>
<ConversionRate>44.6150177</ConversionRate>
<ConversionType>Spot</ConversionType>
<Currency> http://revsrvces.global.mycomp.com/GL/Currency/{currencyCode} </Currency>
</ConversionRateItem>
</ConversionRateItems>
</ConverstionRateCollection>

I followed the table creation above and run the following:
DELETE XMLDOCS;
COMMIT;
INSERT INTO XMLDOCS VALUES ( HTTPURITYPE.CREATEURI(' http://revsrvces.global.mycomp.com/Finance/GL/ConversionRate/?conversionDate=2012-01-01' ).GETXML() );
COMMIT;

when i do a select:
SELECT XMLTYPE.EXTRACT(X,'/ConverstionRateCollection/ConversionRateItems/ConversionRateItem/FromCurrency/text()').GETSTRINGVAL() CURRENCY_FRM,
XMLTYPE.EXTRACT(X,'/ConverstionRateCollection/ConversionRateItems/ConversionRateItem/ToCurrency/text()').GETSTRINGVAL() CURRENCY_TO,
XMLTYPE.EXTRACT(X,'/ConverstionRateCollection/ConversionRateItems/ConversionRateItem/ConversionDate/text()').GETSTRINGVAL() CONVERSION_DT,
XMLTYPE.EXTRACT(X,'/ConverstionRateCollection/ConversionRateItems/ConversionRateItem/ConversionRate/text()').GETSTRINGVAL() CONVERSION_RATE,
XMLTYPE.EXTRACT(X,'/ConverstionRateCollection/ConversionRateItems/ConversionRateItem/ConversionType/text()').GETSTRINGVAL() CONVERSION_TYPE
FROM XMLDOCS

I get ONE Record with all NULL values.

The one record in XMLDOCS looks exactly like the above XML.

Why am I not seeing values and why am I not seeing 3 records?

Found a solution

Rod, May 31, 2012 - 11:05 am UTC

Thank you for the opportunity but I have resolved my problem. We went an entirely different direction.

A reader, March 12, 2013 - 11:30 pm UTC


Can you tell me this code in binary?

A reader, January 11, 2024 - 4:03 pm UTC

<bpd:AICAuctionData xmlns:bpd=" http://www.publicdebt.treas.gov/" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.publicdebt.treas.gov/ http://www.publicdebt.treas.gov/xsd/AICAuction.xsd" >
<AuctionAnnouncement>
<SecurityTermWeekYear>26-WEEK</SecurityTermWeekYear>
<SecurityTermDayMonth>182-DAY</SecurityTermDayMonth>
<SecurityType>BILL</SecurityType>
<CUSIP>912795WS6</CUSIP>
<AnnouncementDate>2005-09-01</AnnouncementDate>
<AuctionDate>2005-09-06</AuctionDate>
<IssueDate>2005-09-08</IssueDate>
<MaturityDate>2006-03-09</MaturityDate>
<OfferingAmount>15.0</OfferingAmount>
<CompetitiveTenderAccepted>N</CompetitiveTenderAccepted>
<NonCompetitiveTenderAccepted>N</NonCompetitiveTenderAccepted>
<TreasuryDirectTenderAccepted>N</TreasuryDirectTenderAccepted>
<AllTenderAccepted>Y</AllTenderAccepted>
<TypeOfAuction>SINGLE PRICE</TypeOfAuction>
<CompetitiveClosingTime>13:00</CompetitiveClosingTime>
<NonCompetitiveClosingTime>12:00</NonCompetitiveClosingTime>
<NetLongPositionReport>5250000000</NetLongPositionReport>
<MaxCompetitiveBid>35</MaxCompetitiveBid>
<MaxSingleBid>35</MaxSingleBid>
<CompetitiveBidDecimals>3</CompetitiveBidDecimals>
<AllocationPercentageDecimals>2</AllocationPercentageDecimals>
<MinCompetitiveAmount>1000</MinCompetitiveAmount>
<MinNonCompetitiveAmount>1000</MinNonCompetitiveAmount>
<MultiplesToBid>1000</MultiplesToBid>
<MinToIssue>1000</MinToIssue>
<MultiplesToIssue>1000</MultiplesToIssue>
<MatureSecurityAmount>35011.0</MatureSecurityAmount>
<OutstandingAmount/>
<SOMAIncluded>N</SOMAIncluded>
<FederalReserveHoldings>17469.0</FederalReserveHoldings>
<FIMAIncluded>Y</FIMAIncluded>
<ForeignInstitutionalHoldings/>
<PayDownNewCashIndicator>PD</PayDownNewCashIndicator>
<PayDownNewCashAmount>3011.0</PayDownNewCashAmount>
<Series/>
<InterestRate/>
<FirstInterestPaymentDate/>
<StandardInterestPayment/>
<FrequencyInterestPayment/>
<StrippableIndicator/>
<MinStripAmount/>
<CorpusCUSIP/>
<TINTCUSIP1/>
<TINTCUSIP2/>
<ReOpeningIndicator/>
<OriginalIssueDate/>
<BackDated/>
<BackDatedDate/>
<LongShortNormalCoupon/>
<LongShortCouponFirstIntPmt/>
<Callable/>
<CallDate/>
<InflationIndexSecurity/>
<ReferenceCPIDated/>
<IndexRatioOnIssueDate/>
<CPIBasePeriod/>
<TIINConversionFactor/>
<AccruedInterest/>
<DatedDate>2005-09-08</DatedDate>
</AuctionAnnouncement>
<AuctionResults>
<LongShortCouponFirstIntPmt/>
<PrimaryDealerTendered>21470000</PrimaryDealerTendered>
<PrimaryDealerAccepted>9283170</PrimaryDealerAccepted>
<DirectBidderTendered>1850000</DirectBidderTendered>
<DirectBidderAccepted>730110</DirectBidderAccepted>
<IndirectBidderTendered>4299010</IndirectBidderTendered>
<IndirectBidderAccepted>3366740</IndirectBidderAccepted>
<CompetitiveTendered>27619010</CompetitiveTendered>
<CompetitiveAccepted>13380020</CompetitiveAccepted>
<NonCompetitiveAccepted>1460046</NonCompetitiveAccepted>
<SOMATendered>6320358</SOMATendered>
<SOMAAccepted>6320358</SOMAAccepted>
<FIMATendered>160000</FIMATendered>
<FIMAAccepted>160000</FIMAAccepted>
<FIMAAddlAccepted/>
<TotalTendered>35559414</TotalTendered>
<TotalAccepted>21320424</TotalAccepted>
<BidToCoverRatio>1.95</BidToCoverRatio>
<ReleaseTime>13:01</ReleaseTime>
<AmountAcceptedBelowLowRate/>
<HighAllocationPercentage>66.74</HighAllocationPercentage>
<LowDiscountRate>3.545</LowDiscountRate>
<HighDiscountRate>3.57</HighDiscountRate>
<MedianDiscountRate>3.56</MedianDiscountRate>
<LowYield/>
<HighYield>3.686</HighYield>
<MedianYield/>
<LowPrice/>
<HighPrice>98.195167</HighPrice>
<MedianPrice/>
<TIINConversionFactor/>
<AccruedInterest/>
<StandardInterestPayment/>
<InterestRate/>
</AuctionResults>
</bpd:AICAuctionData>
Connor McDonald
January 15, 2024 - 5:03 am UTC

In binary?

More to Explore

CLOB/BLOB/etc

Complete documentation on Securefiles and Large Objects here