<?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; PL/SQL</title>
	<atom:link href="http://kwatog.com/category/blog/plsql/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>Enable/Show DBMS_OUTPUT in PL/SQL</title>
		<link>http://kwatog.com/blog/plsql/enableshow-dbms_output-in-plsql/</link>
		<comments>http://kwatog.com/blog/plsql/enableshow-dbms_output-in-plsql/#comments</comments>
		<pubDate>Fri, 15 Oct 2010 10:04:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PL/SQL]]></category>
		<guid isPermaLink="false">http://kwatog.com/?p=421</guid>
		<description><![CDATA[The long and short of it is that the command is as below. SET SERVEROUTPUT ON There&#8217;s quite a misconception between DBMS_OUTPUT.ENABLE and SERVEROUTPUT directives. The SERVEROUTPUT tells Oracle to dump the buffer(i.e, sent via DBMS_OUTPUT.PUT_LINE) while the DBMS_OUTPUT.ENABLE starts the buffer messages which you may access by GET_LINE/GET_LINES. SERVEROUTPUT directive does two things: Issue [...]]]></description>
			<content:encoded><![CDATA[<p>The long and short of it is that the command is as below.</p>
<p><code><br />
SET SERVEROUTPUT ON<br />
</code></p>
<p>There&#8217;s quite a misconception between DBMS_OUTPUT.ENABLE and SERVEROUTPUT directives. The SERVEROUTPUT tells Oracle to dump the buffer(i.e, sent via DBMS_OUTPUT.PUT_LINE) while the DBMS_OUTPUT.ENABLE starts the buffer messages which you may access by GET_LINE/GET_LINES. </p>
<p>SERVEROUTPUT directive does two things:</p>
<ol>
<li>Issue DBMS_OUTPUT.ENABLE command</li>
<li>Tells SQLPLUS to dump the output after each statement</li>
</ol>
<p>Relevant discussion is at AskTom&#8217;s question and answer page<br />
<a href="http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1968769482859" rel=nofollow>here</a>.</p>
<h4>Incoming search terms:</h4><ul><li>show dbms_output</li><li>DBMS_OUTPUT ENABLE</li><li>dbms_output show</li><li>dbms_output</li><li>plsql show dbms_output</li><li>how to enable the dbms output in sqlplus</li><li>how to enable dbms_output</li><li>enable dbms_output plsql client</li><li>enable dbms_output</li><li>dbms_output pl sql</li></ul>]]></content:encoded>
			<wfw:commentRss>http://kwatog.com/blog/plsql/enableshow-dbms_output-in-plsql/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>
		<item>
		<title>Enable/Disable Bind Variable in SQL*Plus</title>
		<link>http://kwatog.com/blog/oracle/enable-disable-bind-variable-in-sqlplus/</link>
		<comments>http://kwatog.com/blog/oracle/enable-disable-bind-variable-in-sqlplus/#comments</comments>
		<pubDate>Mon, 18 Jan 2010 14:44:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[PL/SQL]]></category>
		<guid isPermaLink="false">http://kwatog.com/?p=215</guid>
		<description><![CDATA[As state in the title, this post is about turning off the bind variable in SQL*Plus. Actually, this is also applicable in PL/SQL Developer and Toad but I&#8217;ll be discussing more on SQL*Plus. You see, I have a problem wherein whenever I load my backup data (saved as insert statements) and there are ampersand (&#038;) [...]]]></description>
			<content:encoded><![CDATA[<p>As state in the title, this post is about turning off the bind variable in SQL*Plus. Actually, this is also applicable in PL/SQL Developer and Toad but I&#8217;ll be discussing more on SQL*Plus. You see, I have a problem wherein whenever I load my backup data (saved as insert statements) and there are ampersand (&#038;) or colon(:) somewhere in the script, SQL*Plus will ask me for an input. Of course, I don&#8217;t need that because as a backup, I want to load the data as it is. And when migrating 60MB or more, then it isn&#8217;t funny to update the query one by one. The good thing is, I don&#8217;t actually need to update the query because there&#8217;s an answer to my problem. And it&#8217;s pretty damn simple.</p>
<h3>Syntax</h3>
<p><code><br />
set define off<br />
</code></p>
<p>Oh yes, that&#8217;s just one line that will solve my misery. Well, it&#8217;s all about my ignorance. To turn back on, then do the opposite as below.</p>
<h3>Syntax</h3>
<p><code><br />
set define on<br />
</code></p>
<h4>Incoming search terms:</h4><ul><li>oracle disable bind variables</li><li>turn off bind variables sqldeveloper &amp;</li><li>sqlplus disable bind variables</li><li>sqlplus bind variable assignment</li><li>sqlplus bind off</li><li>sql variable disable</li><li>sql plus set bind variable</li><li>sql disable variable</li><li>sql developer colon bind</li><li>sql * plus ask for input</li></ul>]]></content:encoded>
			<wfw:commentRss>http://kwatog.com/blog/oracle/enable-disable-bind-variable-in-sqlplus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!--
Hyper cache file: aa701b089917a5a8ad425a603d8c17c9
Cache created: 04-02-2012 09:19:22
HCE Version: 0.9.8
Load AVG: 0.36(5)
-->
