<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>
<channel>
	<title>kwatog &#38; co.&#187; Oracle</title>
	<atom:link href="http://kwatog.com/category/blog/oracle/feed/" rel="self" type="application/rss+xml" />
	<link>http://kwatog.com</link>
	<description>tech notes and general nonsense</description>
	<lastBuildDate>Tue, 31 Jan 2012 06:27:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>UTF_FILE and Directories</title>
		<link>http://kwatog.com/blog/oracle/utf_file-and-directories/</link>
		<comments>http://kwatog.com/blog/oracle/utf_file-and-directories/#comments</comments>
		<pubDate>Thu, 10 Nov 2011 00:38:33 +0000</pubDate>
		<dc:creator>kwatog</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[PL/SQL]]></category>
		<category><![CDATA[all_directories]]></category>
		<category><![CDATA[directories]]></category>
		<category><![CDATA[folders]]></category>
		<category><![CDATA[utf_file]]></category>
		<guid isPermaLink="false">http://kwatog.com/?p=43</guid>
		<description><![CDATA[In case you are maintaining a pl/sql program developed by someone else and that program writes into a file, then basically that file is written to a folder/directory. And since the directories are saved in codes, you have to find the meaning (or location) of those codes. The code below will help you display the [...]]]></description>
			<content:encoded><![CDATA[<p>In case you are maintaining a pl/sql program developed by someone else and that program writes into a file, then basically that file is written to a folder/directory. And since the directories are saved in codes, you have to find the meaning (or location) of those codes. The code below will help you display the information required.</p>
<p><code>SELECT * FROM ALL_DIRECTORIES;</code></p>
<p>The query above will display all the directories accessible to the current user. They are folders in the server where you can write your output files. For some reason, I forgot about this twice already and had to scour the web to find it. The problem is, I also forgot the keywords. So, I&#8217;m writing it now.</p>
<p>To register new directories, you can follow the example below.</p>
<p>Example<br />
<code>create or replace directory mydir as 'c:\mydirectory';</code></p>
<p>To use, run the code below.</p>
<p><code>declare<br />
f utl_file.file_type;<br />
begin<br />
f := utl_file.fopen('MYDIR', 'myfilename.txt', 'w');<br />
utl_file.put_line(f, 'just another line text 1');<br />
utl_file.put_line(f, 'just another line text 2');<br />
utl_file.fclose(f);<br />
end;</code></p>
<h4>Incoming search terms:</h4><ul><li>utf_file</li><li>utl_file all_directories</li></ul>]]></content:encoded>
			<wfw:commentRss>http://kwatog.com/blog/oracle/utf_file-and-directories/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle Power Function</title>
		<link>http://kwatog.com/blog/oracle/oracle-power-function/</link>
		<comments>http://kwatog.com/blog/oracle/oracle-power-function/#comments</comments>
		<pubDate>Tue, 08 Nov 2011 03:30:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[PL/SQL]]></category>
		<category><![CDATA[Oracle SQL]]></category>
		<category><![CDATA[power function]]></category>
		<guid isPermaLink="false">http://kwatog.com/?p=681</guid>
		<description><![CDATA[There are some pl/sql functions that you rarely use and we always forget the syntax.And here&#8217;s another example &#8212; the power function. You know, that&#8217;s the n to the power of x (n^x). Again, I feel a bit ashamed for forgetting this one. Here&#8217;s the syntax. power(m,n); whereby m is the base. n is the [...]]]></description>
			<content:encoded><![CDATA[<p>There are some pl/sql functions that you rarely use and we always forget the syntax.And here&#8217;s another example &#8212; the power function.  You know, that&#8217;s the n to the power of x (n^x). Again, I feel a bit ashamed for forgetting this one. Here&#8217;s the syntax.<br />
<span id="more-681"></span><br />
<code><br />
power(m,n);<br />
</code></p>
<p>whereby<br />
m is the base.<br />
n is the exponent.</p>
<p>Example<br />
<code><br />
power(36,5);<br />
</code><br />
will return 1679616</p>
<p>Take note that this function returns NUMBER as the data type. That means the maximum value can only be 1.0 x 10^126. Later versions (10g onwards) can use binary_double as the base which makes the function output binary_double. I don&#8217;t know where you would need that large number, though. Also, if m is negative, then n must be an integer.</p>
<p>In case you are asking where I need it, there&#8217;s this code conversion whereby I needed to use the power function to get the value of a particular character. The exponent(n) is not fixed so I needed this function. To be specific, the function involves the pl/sql version of RowIdToRowIdNum of Siebel. I&#8217;ll post the code later.</p>
<p>References:</p>
<p>http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1594387900346571874</p>
<h4>Incoming search terms:</h4><ul><li>oracle power</li><li>oracle power function</li><li>oracle power function negative</li><li>oracle power functions</li><li>oracle sql display power</li><li>power function in sql oracle</li><li>power function pl/sql integers</li><li>power oracle binary_double ask tom</li><li>powerc oracle</li></ul>]]></content:encoded>
			<wfw:commentRss>http://kwatog.com/blog/oracle/oracle-power-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rowcount on Oracle Dynamic SQLs</title>
		<link>http://kwatog.com/blog/oracle/rowcount-on-oracle-dynamic-sqls/</link>
		<comments>http://kwatog.com/blog/oracle/rowcount-on-oracle-dynamic-sqls/#comments</comments>
		<pubDate>Thu, 25 Aug 2011 10:44:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[PL/SQL]]></category>
		<guid isPermaLink="false">http://kwatog.com/?p=668</guid>
		<description><![CDATA[A good friend asked me on how to capture the number of affected records on his delete statement. The answer would be as simple as below: DELETE FROM my_table WHERE mycolumn = 'mysearch'; v_rec_count := SQL%ROWCOUNT; On this case, SQL%ROWCOUNT will return the number of affected records in the immediate preceding statement. It is the [...]]]></description>
			<content:encoded><![CDATA[<p>A good friend asked me on how to capture the number of affected records on his delete statement. The answer would be as </p>
<p>simple as below:<br />
<code><br />
   DELETE FROM my_table<br />
   WHERE mycolumn = 'mysearch';</p>
<p>   v_rec_count := SQL%ROWCOUNT;<br />
</code></p>
<p>On this case, SQL%ROWCOUNT will return the number of affected records in the immediate preceding statement. It is the </p>
<p>equivalent command for @@rowcount in Sybase/SQL Server. </p>
<p>However in my friend&#8217;s case, the DELETE statement is part of the dynamic SQL. Obviously, we cannot use the approach </p>
<p>above as it is. Here&#8217;s how to capture the affected records in dynamic SQLs.</p>
<p><code><br />
vSQL := 'DELETE FROM ' ||  v_SchemaName || '.' ||  v_TableName || ' WHERE ' ||  v_Conditions || ‘;’;<br />
EXECUTE IMMEDIATE ‘BEGIN ’ ||  vSQL || ‘ :z := sql%rowcount; END; ’ USING OUT nRecCount  ;<br />
</code></p>
<p>Basically, we have to capture the rowcount from within the dynamic sql. That means you have to pass the variable via &#8220;OUT&#8221; parameter to flow the value out of the execute immediate. You can&#8217;t just fire nRecCount := sql%rowcount after the execute immediate because with that, the last command that ran is the execute immediate. It will return 1 instead of the actual value from the dynamic sql.</p>
<p>Source :</p>
<p>https://asktom.oracle.com/pls/asktom/f?p=100:11:0::NO::P11_QUESTION_ID:497908700346519628</p>
<h4>Incoming search terms:</h4><ul><li>oracle rowcount</li><li>oracle sql rowcount execute immediate</li><li>%rowcount</li><li>rowcount in oracle</li><li>rowcount oracle</li><li>oracle execute immediate rowcount</li><li>return rowcount sybase sql</li><li>return type of rowcount in oracle</li><li>rowcount in oracle pl sql</li><li>rowcount oracle sql</li></ul>]]></content:encoded>
			<wfw:commentRss>http://kwatog.com/blog/oracle/rowcount-on-oracle-dynamic-sqls/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Update Oracle Sequence Last Number</title>
		<link>http://kwatog.com/blog/oracle/update-oracle-sequence-last-number/</link>
		<comments>http://kwatog.com/blog/oracle/update-oracle-sequence-last-number/#comments</comments>
		<pubDate>Wed, 01 Jun 2011 07:47:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[PL/SQL]]></category>
		<guid isPermaLink="false">http://kwatog.com/?p=552</guid>
		<description><![CDATA[I only realized this last week that direct update of the last number of the sequence. Or maybe I just don&#8217;t know so what I did was to create a workaround. ALTER SEQUENCE MY_SEQUENCE_NAME_SQ INCREMENT BY 300; SELECT MY_SEQUENCE_NAME_SQ.NEXTVAL FROM DUAL; ALTER SEQUENCE MY_SEQUENCE_NAME INCREMENT BY 1; Explanation The first SQL modifies increment number to [...]]]></description>
			<content:encoded><![CDATA[<p>I only realized this last week that direct update of the last number of the sequence. Or maybe I just don&#8217;t know so what I did was to create a workaround.<br />
<span id="more-552"></span><br />
<code><br />
ALTER SEQUENCE MY_SEQUENCE_NAME_SQ<br />
INCREMENT BY 300;</p>
<p>SELECT MY_SEQUENCE_NAME_SQ.NEXTVAL FROM DUAL;</p>
<p>ALTER SEQUENCE MY_SEQUENCE_NAME<br />
INCREMENT BY 1;<br />
</code></p>
<h3>Explanation</h3>
<p>The first SQL modifies increment number to 300. That means the next time I call the NEXTVAL, I&#8217;ll get the current number + 300. In that way, I can skip some numbers. And after achieving the purpose, I set back the increment to just 1.</p>
<p>This is a crudge workaround, actually. I needed to come up with a solution to a problem in production wherein the sequence number is no longer in-synch with the actual current max number in the table (due to manual insert/update). </p>
<h4>Incoming search terms:</h4><ul><li>alter sequence last number</li><li>oracle update sequence last_number</li><li>update sequence oracle</li><li>oracle update sequence</li><li>alter sequence LAST_NUMBER</li><li>oracle alter sequence last_number</li><li>oracle update sequence last number</li><li>update oracle sequence</li><li>update sequence in oracle</li><li>update oracle sequence last_number</li></ul>]]></content:encoded>
			<wfw:commentRss>http://kwatog.com/blog/oracle/update-oracle-sequence-last-number/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Input truncated to 1 characters</title>
		<link>http://kwatog.com/blog/oracle/input-truncated-to-1-characters/</link>
		<comments>http://kwatog.com/blog/oracle/input-truncated-to-1-characters/#comments</comments>
		<pubDate>Tue, 12 Apr 2011 09:01:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[PL/SQL]]></category>
		<guid isPermaLink="false">http://kwatog.com/?p=526</guid>
		<description><![CDATA[That pesky though harmless message &#8220;Input truncated to 1 characters&#8221; keep on appearing on one of my scripts and I can&#8217;t figure out what&#8217;s the problem. It turned out that the last line of my script is the slash (/). An extra new line is needed after the slash so that this message is suppressed. [...]]]></description>
			<content:encoded><![CDATA[<p>That pesky though harmless message &#8220;Input truncated to 1 characters&#8221; keep on appearing on one of my scripts and I can&#8217;t figure out what&#8217;s the problem. It turned out that the last line of my script is the slash (/). <strong>An extra new line is needed after the slash so that this message is suppressed.</strong></p>
<p>To be clear, here&#8217;s the screenshot.<br />
<a href="http://kwatog.com/wp-content/uploads/2011/04/extra_line_input_truncated.jpg"><img src="http://kwatog.com/wp-content/uploads/2011/04/extra_line_input_truncated.jpg" alt="" title="extra_line_input_truncated" width="352" height="107" class="alignnone size-full wp-image-528" /></a><br />
<span id="more-526"></span><br />
Source : http://forums.oracle.com/forums/thread.jspa?messageID=3594805</p>
<h4>Incoming search terms:</h4><ul><li>Input truncated to 1 characters</li><li>input truncated to 1 characters error</li><li>sql input truncated to characters</li><li>input truncated to 1 characters oracle</li><li>input truncated to 1</li><li>input truncated to one character</li><li>input truncated to 4 characters</li><li>input truncated to 10 characters in oracle</li><li>input truncated to 1 characters sql</li><li>Input truncated to 1 characters pl/sql means</li></ul>]]></content:encoded>
			<wfw:commentRss>http://kwatog.com/blog/oracle/input-truncated-to-1-characters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle MERGE command</title>
		<link>http://kwatog.com/blog/oracle/oracle-merge-command/</link>
		<comments>http://kwatog.com/blog/oracle/oracle-merge-command/#comments</comments>
		<pubDate>Thu, 03 Mar 2011 02:57:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[PL/SQL]]></category>
		<category><![CDATA[DML]]></category>
		<category><![CDATA[insert]]></category>
		<category><![CDATA[merge]]></category>
		<category><![CDATA[statement]]></category>
		<category><![CDATA[update]]></category>
		<category><![CDATA[upsert]]></category>
		<guid isPermaLink="false">http://kwatog.com/?p=468</guid>
		<description><![CDATA[Oracle MERGE command was added in 9i but I only learned about it lately. This command is sometimes referred to as UPSERT because in one statement, you can both update and insert records into a target. Based on the matching condition, MERGE can update existing records if a match is found or insert new record [...]]]></description>
			<content:encoded><![CDATA[<p>Oracle MERGE command was added in 9i but I only learned about it lately. This command is sometimes referred to as UPSERT because in one statement, you can both update and insert records into a target. Based on the matching condition, MERGE can update existing records if a match is found or insert new record if not. Prior to 9i, we need separate sql statements or a PL/SQL program to do this.</p>
<p><span id="more-468"></span><br />
<code><br />
MERGE INTO tstg_idl_approach a<br />
USING tmdb_idl_approach b<br />
ON (a.approach_id = b.approach_id)<br />
WHEN MATCHED THEN<br />
   UPDATE SET   a.approach_code = b.approach_code ,<br />
                a.current_ind   = b.current_ind<br />
WHEN NOT MATCHED THEN<br />
	INSERT (approach_id  ,<br />
		    approach_code,<br />
            current_ind  )<br />
	VALUES (b.approach_id  ,<br />
            b.approach_code,<br />
            b.current_ind   );<br />
</code><br />
For further reading, I recommend visiting <a href="http://www.oracle-developer.net/display.php?id=203">http://www.oracle-developer.net/display.php?id=203</a>.</p>
<h4>Incoming search terms:</h4><ul><li>oracle merge statement</li><li>merge oracle</li><li>oracle merge</li><li>oracle merge statement in loop</li><li>oracle merge statement tech on the web</li><li>oracle merge statement when not matched then print message</li><li>oracle merge tech on the net</li><li>oracle merge when matched then insert</li><li>oracle user if in merge statement</li><li>pl/sql merge log</li></ul>]]></content:encoded>
			<wfw:commentRss>http://kwatog.com/blog/oracle/oracle-merge-command/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle PL/SQL Continue Statement in Loops</title>
		<link>http://kwatog.com/blog/oracle/oracle-plsql-continue-statement-in-loops/</link>
		<comments>http://kwatog.com/blog/oracle/oracle-plsql-continue-statement-in-loops/#comments</comments>
		<pubDate>Fri, 11 Feb 2011 02:14:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[PL/SQL]]></category>
		<guid isPermaLink="false">http://kwatog.com/?p=498</guid>
		<description><![CDATA[The CONTINUE statement is very handy feature when programming with loops in Oracle PL/SQL. Basically, it lets you skip to the next iteration of your loop (i.e., next record in the cursor loop). Unfortunately, it was only added in 11g Release 1 (11.1). This is stated in the Language Reference of that version. Below is [...]]]></description>
			<content:encoded><![CDATA[<p>The CONTINUE statement is very handy feature when programming with loops in Oracle PL/SQL. Basically, it lets you skip to the next iteration of your loop (i.e., next record in the cursor loop). Unfortunately, it was only added in 11g Release 1 (11.1). This is stated in the <a href="http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28370/whatsnew.htm#CHDDIIJA">Language Reference</a> of that version.</p>
<p>Below is the example.</p>
<blockquote><p>
SQL> DECLARE<br />
  2    x NUMBER := 0;<br />
  3  BEGIN<br />
  4    LOOP &#8212; After CONTINUE statement, control resumes here<br />
  5      DBMS_OUTPUT.PUT_LINE (&#8216;Inside loop:  x = &#8216; || TO_CHAR(x));<br />
  6      x := x + 1;<br />
  7<br />
  8      IF x < 3 THEN<br />
  9        CONTINUE;<br />
 10      END IF;<br />
 11<br />
 12      DBMS_OUTPUT.PUT_LINE<br />
 13        ('Inside loop, after CONTINUE:  x = ' || TO_CHAR(x));<br />
 14<br />
 15      EXIT WHEN x = 5;<br />
 16    END LOOP;<br />
 17<br />
 18    DBMS_OUTPUT.PUT_LINE (' After loop:  x = ' || TO_CHAR(x));<br />
 19  END;<br />
 20  /
</p></blockquote>
<p><span id="more-498"></span><br />
As our Siebel CRM here in the office still uses 10g, I have no choice but to use some other ways(i.e., logic change, big if-endif, etc.) There&#8217;s a lot of critics of this function with some saying it&#8217;s like using GOTO statement in BASIC. I find it handy, though. And I don&#8217;t think those critics ever encountered such kind of situations or have programmed a large pl/sql program in the real world. </p>
<p>The statement allows me to make my codes more readable and easily understandable. On top of that, it allows shorter program and easily traceable code. And so I&#8217;m happy that Oracle has added it their RDBMS starting from 11g.</p>
<h4>Incoming search terms:</h4><ul><li>pl/sql continue</li><li>continue oracle</li><li>pl/sql loop continue</li><li>continue in oracle</li><li>continue in oracle pl sql</li><li>plsql for loop continue</li><li>pl sql for continue</li><li>pl sql continue</li><li>oracle sql loop dbms_output put_line</li><li>oracle pl/sql continue</li></ul>]]></content:encoded>
			<wfw:commentRss>http://kwatog.com/blog/oracle/oracle-plsql-continue-statement-in-loops/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Run SQL Script via SQL*Plus via Prompt</title>
		<link>http://kwatog.com/blog/oracle/run-sql-script-via-sqlplus-via-prompt/</link>
		<comments>http://kwatog.com/blog/oracle/run-sql-script-via-sqlplus-via-prompt/#comments</comments>
		<pubDate>Thu, 10 Feb 2011 03:31:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Oracle]]></category>
		<guid isPermaLink="false">http://kwatog.com/?p=495</guid>
		<description><![CDATA[If you want to run an SQL script via sqlplus in the shell prompt, the command is as below. sqlplus user/pass@connect @scriptname Don&#8217;t forget that there should be an exit command at the end of the sql. Otherwise, the sqlplus will not exit and just stop running until you manually call exit. Now, if the [...]]]></description>
			<content:encoded><![CDATA[<p>If you want to run an SQL script via sqlplus in the shell prompt, the command is as below.<br />
<code><br />
sqlplus user/pass@connect @scriptname<br />
</code><br />
Don&#8217;t forget that there should be an exit command at the end of the sql. Otherwise, the sqlplus will not exit and just stop running until you manually call exit.</p>
<p>Now, if the SQL script does not have exit at the end, you&#8217;ll have to do the following.<br />
<code><br />
echo exit | sqlplus user/pass@connect @scriptname<br />
</code></p>
<p>This is another trivial thing that can be easily forgotten. </p>
<h4>Incoming search terms:</h4><ul><li>sqlplus does not return</li><li>sql script name in shell script exit from sql prompt</li><li>sqlplus -s &lt;&lt; end in shell script</li><li>sqlplus does not call script</li><li>execute sql script in shell</li><li>sqlplus invoke shell script</li><li>sqlplus no exit on end of script</li><li>sqlplus prompt exit</li><li>sqlplus run sql script</li><li>script sql *plus</li></ul>]]></content:encoded>
			<wfw:commentRss>http://kwatog.com/blog/oracle/run-sql-script-via-sqlplus-via-prompt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drop/Remove Column in Oracle Table</title>
		<link>http://kwatog.com/blog/oracle/dropremove-column-in-oracle-table/</link>
		<comments>http://kwatog.com/blog/oracle/dropremove-column-in-oracle-table/#comments</comments>
		<pubDate>Thu, 12 Aug 2010 03:36:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Oracle]]></category>
		<guid isPermaLink="false">http://kwatog.com/?p=395</guid>
		<description><![CDATA[Here&#8217;s a quick post on how to drop a column/field in a table. Dropping One Column alter table table_name drop column col_name1; Dropping Multiple Columns alter table table_name drop (col_name1, col_name2); Simple, eh?]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a quick post on how to drop a column/field in a table. </p>
<p><strong>Dropping One Column</strong><br />
<code>alter table<br />
   table_name<br />
drop column col_name1;</code></p>
<p><strong>Dropping Multiple Columns</strong><br />
<code><br />
alter table<br />
   table_name<br />
drop    (col_name1, col_name2); </code></p>
<p>Simple, eh?</p>
]]></content:encoded>
			<wfw:commentRss>http://kwatog.com/blog/oracle/dropremove-column-in-oracle-table/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Convert Rows to One Column</title>
		<link>http://kwatog.com/blog/oracle/convert-rows-to-one-column/</link>
		<comments>http://kwatog.com/blog/oracle/convert-rows-to-one-column/#comments</comments>
		<pubDate>Sat, 07 Aug 2010 10:23:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[PL/SQL]]></category>
		<category><![CDATA[convert row to col]]></category>
		<guid isPermaLink="false">http://kwatog.com/?p=262</guid>
		<description><![CDATA[Converting rows to column is a breeze if you are using Microsoft Access or reporting tools like Oracle Reports Builder. However, there are times that you&#8217;ll also need it for something else. I mean like displaying rows to one column in a SQL*Plus report. So how leh? (imagine that saying with a Singaporean accent) Here&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>Converting rows to column is a breeze if you are using <strong>Microsoft Access </strong>or reporting tools like <strong>Oracle Reports Builder</strong>. However, there are times that you&#8217;ll also need it for something else. I mean like displaying rows to one column in a <strong>SQL*Plus</strong> report. So how leh? (<em>imagine that saying with a Singaporean accent</em>)<br />
<span id="more-262"></span><br />
Here&#8217;s one.</p>
<h5>XMLAGG (Available since Oracle 9i)</h5>
<p><code><br />
select rtrim (xmlagg (xmlelement (e, email_add || ',')).extract ('//text()'), ',') email_add<br />
from email_groups<br />
where email_group = '1-A945-9';<br />
</code><br />
In that example, I needed to display all the email addresses in an email group. The output should be separated by comma so that I can pass it onto the email client without any problem nor any additional codes.</p>
<p>There&#8217;s more at <a href="http://www.dba-oracle.com/t_converting_rows_columns.htm">Burleson Consulting</a> in case you want other techniques. </p>
<h4>Incoming search terms:</h4><ul><li>convert rows to columns in oracle</li><li>convert row to column in oracle</li><li>oracle rows to columns</li><li>oracle rows to one column</li><li>oracle select rows to column</li><li>oracle xmlagg</li><li>oracle xmlagg row to col</li><li>report builder convert rows to columns</li><li>row to col oracle</li><li>row to column in oracle</li></ul>]]></content:encoded>
			<wfw:commentRss>http://kwatog.com/blog/oracle/convert-rows-to-one-column/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!--
Hyper cache file: 7b4f5d84b31aba388b39ee0c6ec55a33
Cache created: 04-02-2012 09:19:08
HCE Version: 0.9.8
Load AVG: 0.06(5)
-->
