Oracle Dynamic SQL: generic search – crazy case
LPX-00209: PI names starting with XML are reserved
Find your way with HttpUriType and Google Maps
And that reminded me that long time ago I reminded myself that I should blog about how we use HttpUriType to query driving distance and time from Google Maps. (I have even tried to submit abstract to KScope and UKOUG on getting data with HttpUriType, UTL_HTTP or UTL_FTP, but no go so far...)
Let's imagine Larry needs directions to (more...)
SQL Solution for the Third International NoCOUG SQL & NoSQL Challenge
SQL vs NoSQL: Third International NoCOUG SQL & NoSQL Challenge sponsored by Pythian
As published in the 102nd issue of the NoCOUG Journal
THE WICKED WITCH OF THE WEST NEEDS HELP
BE IT KNOWN BY THESE PRESENTS that the Wicked Witch of the West needs your help to create
a (more...)
INSERT ALL master/detail data from XML
The idea is you may have some master/detail data (in this case orders and orderlines) for which you get XML with such data that needs to be inserted into two relational tables. Many might be tempted to parse the XML client side or in PL/SQL, loop through the data, and then insert the orders and lines row by row (or perhaps bulk insert from arrays.)
But it can be done in a single (more...)
How to simulate DML Operations on XML data using XU (XQuery Update)
The following SQL pattern can be used to simulate DML operations on XML data by utilizing XU (XQuery Update) functionalities.
This query will do the following XML data transformation by using XU insert/delete/rename/replace statements.
1) Convert all the XML Attributes to Elements. ( XU Delete & Insert) 2) Change the (more...)
How to validate XML data using XSD in Oracle XML DB
The following XML Schema can be used to validate the XML input data in the XML DB.
It enforces the following validation rules:
1) Parent_Tab/Parent_Row/dep_id is the (primary) key within Parent_Tab.
2) Parent_Tab/Parent_Row/dep_name should be one of the xs:enumeration list in DeptnameType and it is also unique within Parent_Tab.
3) (more...)
MS Exchange API for PL/SQL
Features
Using this pure PL/SQL package, you will be able not just to search for and retrieve emails and download attachments, but you will also be able to create emails and upload attachments to existing emails. You can move emails between folders, and delete emails. You can read and create calendar items. You can get the email addresses of the people in a distribution (mailing) list, and more.
Prerequisites
How to do XML based data manipulation in SQL and XSLT
The following SQL pattern can be used to do XML based data manipulation and transformation by utilizing XSLT functionality.
This query will do the following data manipulation and transformation:
1) Rename the xml tag <FirstName> to <FN> when the position of the element node is
either the last one or (more...)
How to do table column based data manipulation in SQL and XQuery
The following SQL pattern can be used to stragg all the table column data together
The STRAGG(column data) is grouped together based on the table column names.
This SQL also manipulates comma-delimited strings using XQuery functionalities.
CREATE TABLE PERSON (ID NUMBER, FIRSTNAME VARCHAR2(20 BYTE), MIDDLENAME VARCHAR2(20 BYTE), LASTNAME VARCHAR2(20 BYTE), (more...)
How to do character based data manipulation in SQL and XQuery
The following SQL pattern can be used to do character based data manipulation
by utilizing the XQuery functionalities.
COLUMN old_str FORMAT A28 COLUMN ordered_no_dup_chars FORMAT A23 COLUMN Reversed_chars FORMAT A23 --------------------SQL Query------------------- WITH data AS (SELECT '3332221118888' AS old_str FROM dual UNION ALL SELECT 'CCCBBBAAA' FROM dual UNION ALL SELECT (more...)
How to convert an Internet HTML Table to CSV format in SQL
The following SQL pattern can be used to transform an HTML Table on the web to CSV format.
set long 10000;
variable url_input varchar2(500)
exec :url_input:='http://oraqa.com/2012/02/27/how-to-transform-a-csv-file-into-html-table-in-sql/'
-------------------------------------------------------------------SQL QUERY---------------------------------------------------------------------
WITH HTML_TAB AS
(SELECT CAST(REGEXP_REPLACE(SUBSTR(STR, 0, REGEXP_INSTR(str,'</table>', 1,1,1, 'i') ), '( ){2,}', ' ')
AS VARCHAR2(4000)) AS html_str
FROM
(SELECT SUBSTR(str, (more...)
How to transform a RefCursor query resultset into HTML table in SQL
The following SQL pattern can be used to tranform a RefCursor query resultset into data in HTML table format by utilizing the XSLT functionality. The query can handle NULL in the data columns. The SQL input string should be based on the following format:
SELECT Col AS name_x, Function() AS (more...)
How to convert a RefCursor query resultset to CSV format in SQL
The following SQL pattern can be used to convert a RefCursor query result set into a CSV format. This query can handle NULL in the data columns. The SQL input string should be based on the following format:
SELECT Col AS name_x, Function() AS name_y, Analytical_function( ) AS name_z FROM (more...)
How to transform a CSV file into HTML table in SQL
The following SQL pattern can be used to tranform the CSV file into a HTML table by utilizing the XQUERY functionality.
create or replace directory tmp as '/tmp';
create a word.csv file.
C:\tmp>more word.csv
ID,FIRSTNAME,MIDDLENAME,LASTNAME
1,Frank,,Zhou
2,Peter,B,Lee
3,John,C,Adam
4,Dave,,Washington
CREATE TABLE CSV_FILE (csv_str VARCHAR2(3000))
ORGANIZATION EXTERNAL
(
TYPE (more...)
JAX-RS: Jersey and JSON single element arrays
SQL Access to the alert-log in 11g and an oddity
Quite a while ago I wrote about how to seup the alert log as an external table. Since then 11g has been introduced and is now widely used. It of couse changes the location and makes the alert log an xml file.
While it is possible to select from it using xml functions like Laurent Schneider does here, it is still a bit cumbersome.
Tanel Poder (@TanelPoder) found a nicer way by using X$DBGALERTEXT which does a really nice job of parsing the xml-file into a lot of different columns. A friend at work, Daniel Ekberg, let me (more...)
JDeveloper Overview and (book) Review
This is a summary only. Please, visit the blog for full content and (more...)

RSS