<?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>satishgaudo.com &#187; Oracle</title>
	<atom:link href="http://satishgaudo.com/satblog/category/oracle/feed/" rel="self" type="application/rss+xml" />
	<link>http://satishgaudo.com/satblog</link>
	<description>Understanding technology</description>
	<lastBuildDate>Thu, 26 Aug 2010 06:27:18 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>TWO DIMensional array implementation in ORACLE PLSQL</title>
		<link>http://satishgaudo.com/satblog/2009/06/21/two-dimensional-array-implementation-in-oracle-plsql/</link>
		<comments>http://satishgaudo.com/satblog/2009/06/21/two-dimensional-array-implementation-in-oracle-plsql/#comments</comments>
		<pubDate>Sun, 21 Jun 2009 08:04:23 +0000</pubDate>
		<dc:creator>satishgaudo</dc:creator>
				<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://satishgaudo.com/satblog/2009/06/21/two-dimensional-array-implementation-in-oracle-plsql/</guid>
		<description><![CDATA[
			
				
			
		

&#160;
CREATE OR REPLACE PROCEDURE “INSTUPDT_EXTENDEDLICENCE” &#40;
&#160;
tmp_int_subidFrom IN NUMBER,
tmp_subKindid IN NUMBER,
frm_str_subSelected IN VARCHAR2,
frm_str_optionSelected IN VARCHAR2,
tmp_added_by IN CHAR,
tmp_addedby_id IN NUMBER
&#160;
&#41; IS
&#160;
– define two dim array TYPE data_t IS TABLE OF NUMBER INDEX BY binary_integer; TYPE array_t IS TABLE OF data_t INDEX BY binary_integer; arrPriv array_t;
&#160;
kindid VARCHAR2&#40;50&#41;; extlicenceid NUMBER&#40;11&#41;; tmp_str_subSelected VARCHAR2&#40;5000&#41;; tmp_str_optionSelected VARCHAR2&#40;5000&#41;;
&#160;
tmpExtLicId NUMBER; tmpDefaultValue VARCHAR2&#40;10&#41;;
&#160;
iPrivId NUMBER&#40;11&#41;; iPrivValue [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fsatishgaudo.com%2Fsatblog%2F2009%2F06%2F21%2Ftwo-dimensional-array-implementation-in-oracle-plsql%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fsatishgaudo.com%2Fsatblog%2F2009%2F06%2F21%2Ftwo-dimensional-array-implementation-in-oracle-plsql%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>

<div class="wp_syntax"><div class="code"><pre class="" style="font-family:monospace;">&nbsp;
CREATE OR REPLACE PROCEDURE “INSTUPDT_EXTENDEDLICENCE” <span class="br0">&#40;</span>
&nbsp;
tmp_int_subidFrom IN NUMBER,
tmp_subKindid IN NUMBER,
frm_str_subSelected IN VARCHAR2,
frm_str_optionSelected IN VARCHAR2,
tmp_added_by IN CHAR,
tmp_addedby_id IN NUMBER
&nbsp;
<span class="br0">&#41;</span> IS
&nbsp;
– define two dim array TYPE data_t IS TABLE OF NUMBER INDEX BY binary_integer; TYPE array_t IS TABLE OF data_t INDEX BY binary_integer; arrPriv array_t;
&nbsp;
kindid VARCHAR2<span class="br0">&#40;</span><span style="">50</span><span class="br0">&#41;</span>; extlicenceid NUMBER<span class="br0">&#40;</span><span style="">11</span><span class="br0">&#41;</span>; tmp_str_subSelected VARCHAR2<span class="br0">&#40;</span><span style="">5000</span><span class="br0">&#41;</span>; tmp_str_optionSelected VARCHAR2<span class="br0">&#40;</span><span style="">5000</span><span class="br0">&#41;</span>;
&nbsp;
tmpExtLicId NUMBER; tmpDefaultValue VARCHAR2<span class="br0">&#40;</span><span style="">10</span><span class="br0">&#41;</span>;
&nbsp;
iPrivId NUMBER<span class="br0">&#40;</span><span style="">11</span><span class="br0">&#41;</span>; iPrivValue NUMBER<span class="br0">&#40;</span><span style="">11</span><span class="br0">&#41;</span>; sData VARCHAR2<span class="br0">&#40;</span><span style="">5000</span><span class="br0">&#41;</span>; iPos NUMBER<span class="br0">&#40;</span><span style="">11</span><span class="br0">&#41;</span>; iPos1 NUMBER<span class="br0">&#40;</span><span style="">11</span><span class="br0">&#41;</span>; iCnt NUMBER<span class="br0">&#40;</span><span style="">3</span><span class="br0">&#41;</span>; sData1 VARCHAR2<span class="br0">&#40;</span><span style="">5000</span><span class="br0">&#41;</span>; iPos2 NUMBER<span class="br0">&#40;</span><span style="">11</span><span class="br0">&#41;</span>; iPos3 NUMBER<span class="br0">&#40;</span><span style="">11</span><span class="br0">&#41;</span>;
&nbsp;
BEGIN
&nbsp;
-- create a two dim array of selected subscribers
tmp_str_subSelected := frm_str_subSelected;
LOOP
-- split the string of selected subscribers - frm_str_subSelected
iPos := INSTR<span class="br0">&#40;</span>tmp_str_subSelected, ','<span class="br0">&#41;</span>;
&nbsp;
IF <span class="br0">&#40;</span>NVL<span class="br0">&#40;</span>iPos,<span style="">0</span><span class="br0">&#41;</span> = <span style="">0</span><span class="br0">&#41;</span> THEN
sData:= LTRIM<span class="br0">&#40;</span>RTRIM<span class="br0">&#40;</span>tmp_str_subSelected<span class="br0">&#41;</span><span class="br0">&#41;</span>;
ELSE
sData:= LTRIM<span class="br0">&#40;</span>RTRIM<span class="br0">&#40;</span>SUBSTR<span class="br0">&#40;</span>tmp_str_subSelected,<span style="">1</span>,iPos-<span style="">1</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;
END IF;
&nbsp;
iPos1 := INSTR<span class="br0">&#40;</span>sData, '#'<span class="br0">&#41;</span>;
&nbsp;
iPrivId := LTRIM<span class="br0">&#40;</span>RTRIM<span class="br0">&#40;</span>SUBSTR<span class="br0">&#40;</span>sData,<span style="">1</span>,iPos1-<span style="">1</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;
iPrivValue := LTRIM<span class="br0">&#40;</span>RTRIM<span class="br0">&#40;</span>SUBSTR<span class="br0">&#40;</span>sData,iPos1+<span style="">1</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;
&nbsp;
-- split
iCnt :=<span style="">0</span>;
LOOP
iCnt:= iCnt +<span style="">1</span>;
&nbsp;
iPos2 := INSTR<span class="br0">&#40;</span>iPrivValue, '|'<span class="br0">&#41;</span>;
&nbsp;
IF <span class="br0">&#40;</span>NVL<span class="br0">&#40;</span>iPos2,<span style="">0</span><span class="br0">&#41;</span> = <span style="">0</span><span class="br0">&#41;</span> THEN
sData1:= LTRIM<span class="br0">&#40;</span>RTRIM<span class="br0">&#40;</span>iPrivValue<span class="br0">&#41;</span><span class="br0">&#41;</span>;
ELSE
sData1:= LTRIM<span class="br0">&#40;</span>RTRIM<span class="br0">&#40;</span>SUBSTR<span class="br0">&#40;</span>iPrivValue,<span style="">1</span>,iPos2-<span style="">1</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;
END IF;
arrPriv<span class="br0">&#40;</span>iPrivId<span class="br0">&#41;</span><span class="br0">&#40;</span>iCnt<span class="br0">&#41;</span>:= sData1;
&nbsp;
EXIT WHEN <span class="br0">&#40;</span>iPos2 = <span style="">0</span><span class="br0">&#41;</span>;
iPrivValue := SUBSTR<span class="br0">&#40;</span>iPrivValue, iPos2+<span style="">1</span><span class="br0">&#41;</span>;
END LOOP;
&nbsp;
EXIT WHEN <span class="br0">&#40;</span>iPos = <span style="">0</span><span class="br0">&#41;</span>;
tmp_str_optionSelected := SUBSTR<span class="br0">&#40;</span>tmp_str_subSelected, iPos+<span style="">1</span><span class="br0">&#41;</span>;
END LOOP;
-- end of array creation
iPrivId:=<span style="">0</span>;
iPos:=<span style="">0</span>;
sData:=;
&nbsp;
-- get the all the priv and the corr option selected
tmp_str_optionSelected := frm_str_optionSelected;
&nbsp;
LOOP
iPos := INSTR<span class="br0">&#40;</span>tmp_str_optionSelected, ','<span class="br0">&#41;</span>;
&nbsp;
IF <span class="br0">&#40;</span>NVL<span class="br0">&#40;</span>iPos,<span style="">0</span><span class="br0">&#41;</span> = <span style="">0</span><span class="br0">&#41;</span> THEN
sData:= LTRIM<span class="br0">&#40;</span>RTRIM<span class="br0">&#40;</span>tmp_str_optionSelected<span class="br0">&#41;</span><span class="br0">&#41;</span>;
ELSE
sData:= LTRIM<span class="br0">&#40;</span>RTRIM<span class="br0">&#40;</span>SUBSTR<span class="br0">&#40;</span>tmp_str_optionSelected,<span style="">1</span>,iPos-<span style="">1</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;
END IF;
&nbsp;
iPos1 := INSTR<span class="br0">&#40;</span>sData, '#'<span class="br0">&#41;</span>;
&nbsp;
iPrivId := LTRIM<span class="br0">&#40;</span>RTRIM<span class="br0">&#40;</span>SUBSTR<span class="br0">&#40;</span>sData,<span style="">1</span>,iPos1-<span style="">1</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;
iPrivValue := LTRIM<span class="br0">&#40;</span>RTRIM<span class="br0">&#40;</span>SUBSTR<span class="br0">&#40;</span>sData,iPos1+<span style="">1</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;
&nbsp;
-- check whether there exists a rule or main record in the extended_licence table for the
tmp_int_subidFrom and the tmp_subKindid
&nbsp;
SELECT extended_licence_id, default_value INTO tmpExtLicId, tmpDefaultValue
FROM EXTENDED_LICENCE
WHERE sub_id_from=tmp_int_subidFrom AND
ext_lic_sub_kind=tmp_subKindid AND
is_active='y' AND
privileges_id=iPrivId AND
is_delete='n';
&nbsp;
IF <span class="br0">&#40;</span>tmpExtLicId &gt;<span style="">0</span><span class="br0">&#41;</span> THEN
&nbsp;
IF <span class="br0">&#40;</span>tmpDefaultValue != iPrivValue<span class="br0">&#41;</span> THEN
-- update the default value
UPDATE EXTENDED_LICENCE
SET default_value=iPrivValue
WHERE extended_licence_id=tmpExtLicId;
END IF;
&nbsp;
-- delete all the previous records from dependency table extended_licence_sub for this extended
 licence reocrd
DELETE
FROM extended_licence_sub
WHERE extended_licence_id=tmpExtLicId;
--
ELSE
-- insert a default record
INSERT INTO EXTENDED_LICENCE
<span class="br0">&#40;</span>
EXTENDED_LICENCE_ID,
SUB_ID_FROM,
EXT_LIC_SUB_KIND,
PRIVILEGES_ID,
DEFAULT_VALUE,
IS_ACTIVE,
IS_DELETE,
ADDDT,
ADDED_BY,
ADDED_BY_ID
<span class="br0">&#41;</span>
VALUES
<span class="br0">&#40;</span>
extended_licence_seq.NEXTVAL ,
tmp_int_subidFrom,
tmp_subKindid,
iPrivId,
iPrivValue,
'y',
'n',
SYSDATE,
tmp_added_by,
tmp_addedby_id
<span class="br0">&#41;</span>;
&nbsp;
SELECT extended_licence_seq.CURRVAL INTO tmpExtLicId FROM dual;
END IF;
&nbsp;
-- insert the dependency records into the extended_licence_sub table
&nbsp;
FOR i IN arrPriv<span class="br0">&#40;</span>iPrivId<span class="br0">&#41;</span>.FIRST..arrPriv<span class="br0">&#40;</span>iPrivId<span class="br0">&#41;</span>.LAST
LOOP
-- insert into extended_licence_sub
INSERT INTO EXTENDED_LICENCE_SUB
<span class="br0">&#40;</span>
EXTENDED_LICENCE_ID,
SUB_ID_TO ,
PRIVILEGES_VALUE
<span class="br0">&#41;</span>
VALUES
<span class="br0">&#40;</span>
tmpExtLicId,
arrPriv<span class="br0">&#40;</span>iPrivId<span class="br0">&#41;</span><span class="br0">&#40;</span>i<span class="br0">&#41;</span>,
iPrivValue
<span class="br0">&#41;</span>;
END LOOP;
EXIT WHEN <span class="br0">&#40;</span>iPos = <span style="">0</span><span class="br0">&#41;</span>;
tmp_str_optionSelected := SUBSTR<span class="br0">&#40;</span>tmp_str_optionSelected, iPos+<span style="">1</span><span class="br0">&#41;</span>;
&nbsp;
END LOOP;
&nbsp;
END;</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://satishgaudo.com/satblog/2009/06/21/two-dimensional-array-implementation-in-oracle-plsql/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>implementation of limit in queries</title>
		<link>http://satishgaudo.com/satblog/2009/06/21/implementation-of-limit-in-queries/</link>
		<comments>http://satishgaudo.com/satblog/2009/06/21/implementation-of-limit-in-queries/#comments</comments>
		<pubDate>Sun, 21 Jun 2009 07:59:52 +0000</pubDate>
		<dc:creator>satishgaudo</dc:creator>
				<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://satishgaudo.com/satblog/2009/06/21/implementation-of-limit-in-queries/</guid>
		<description><![CDATA[
			
				
			
		
Example for implementation of limit in queries:SELECT temp.*,rownum FROM (

SELECT sp.company_name,
sp.contact_phone,
sp.office_fax,
sp.sub_id,
sb.branch_id,
sb.branch_url,
sp.Office_Address.Address1 &#124;&#124; ', ' &#124;&#124; sp.Office_Address.Address2 &#124;&#124; ', ' &#124;&#124; sp.Office_Address.Address3 &#124;&#124; ', ' 
&#124;&#124; sp.Office_Address.City &#124;&#124; ', ' &#124;&#124; sp.Office_Address.County as address
FROM subscriber_primary sp,
subscriber_branch sb,
subscriber_info si
WHERE si.sub_id=sp.sub_id AND
sb.sub_id=sp.sub_id AND
si.sub_kind_id=4 AND
sp.primacy_no=1 AND
sb.branch_level = '0'
&#41; temp
GROUP BY
temp.contact_phone,
temp.office_fax,
temp.sub_id,
temp.branch_id,
temp.branch_url,
temp.address,
rownum having rownum&#62;=2 AND rownum&#60;4

]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fsatishgaudo.com%2Fsatblog%2F2009%2F06%2F21%2Fimplementation-of-limit-in-queries%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fsatishgaudo.com%2Fsatblog%2F2009%2F06%2F21%2Fimplementation-of-limit-in-queries%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Example for implementation of limit in queries:SELECT temp.*,rownum FROM (</p>

<div class="wp_syntax"><div class="code"><pre class="" style="font-family:monospace;">SELECT sp.company_name,
sp.contact_phone,
sp.office_fax,
sp.sub_id,
sb.branch_id,
sb.branch_url,
sp.Office_Address.Address1 || ', ' || sp.Office_Address.Address2 || ', ' || sp.Office_Address.Address3 || ', ' 
|| sp.Office_Address.City || ', ' || sp.Office_Address.County as address
FROM subscriber_primary sp,
subscriber_branch sb,
subscriber_info si
WHERE si.sub_id=sp.sub_id AND
sb.sub_id=sp.sub_id AND
si.sub_kind_id=<span style="">4</span> AND
sp.primacy_no=<span style="">1</span> AND
sb.branch_level = '<span style="">0</span>'
<span class="br0">&#41;</span> temp
GROUP BY
temp.contact_phone,
temp.office_fax,
temp.sub_id,
temp.branch_id,
temp.branch_url,
temp.address,
rownum having rownum&gt;=<span style="">2</span> AND rownum&lt;<span style="">4</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://satishgaudo.com/satblog/2009/06/21/implementation-of-limit-in-queries/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create table using the existing tables</title>
		<link>http://satishgaudo.com/satblog/2009/06/21/create-table-using-the-existing-tables/</link>
		<comments>http://satishgaudo.com/satblog/2009/06/21/create-table-using-the-existing-tables/#comments</comments>
		<pubDate>Sun, 21 Jun 2009 07:58:22 +0000</pubDate>
		<dc:creator>satishgaudo</dc:creator>
				<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://satishgaudo.com/satblog/2009/06/21/create-table-using-the-existing-tables/</guid>
		<description><![CDATA[
			
				
			
		
Example code for dynamically creating table using the tables existing:

CREATE TABLE HIP_TASK_INFO_satish as SELECT HIP_TASK_ID ,
HIP_TASK_ID as HIP_TASK_BUDGET_ID,
HIP_TASK_ID as HIP_DUTY_DETAIL_ID,
IS_ACTIVE,
IS_DELETE,
ADDDT
FROM HIP_TASK_INFO

]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fsatishgaudo.com%2Fsatblog%2F2009%2F06%2F21%2Fcreate-table-using-the-existing-tables%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fsatishgaudo.com%2Fsatblog%2F2009%2F06%2F21%2Fcreate-table-using-the-existing-tables%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Example code for dynamically creating table using the tables existing:</p>

<div class="wp_syntax"><div class="code"><pre class="" style="font-family:monospace;">CREATE TABLE HIP_TASK_INFO_satish as SELECT HIP_TASK_ID ,
HIP_TASK_ID as HIP_TASK_BUDGET_ID,
HIP_TASK_ID as HIP_DUTY_DETAIL_ID,
IS_ACTIVE,
IS_DELETE,
ADDDT
FROM HIP_TASK_INFO</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://satishgaudo.com/satblog/2009/06/21/create-table-using-the-existing-tables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>oracle stored procedure</title>
		<link>http://satishgaudo.com/satblog/2009/06/21/16/</link>
		<comments>http://satishgaudo.com/satblog/2009/06/21/16/#comments</comments>
		<pubDate>Sun, 21 Jun 2009 07:50:24 +0000</pubDate>
		<dc:creator>satishgaudo</dc:creator>
				<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://satishgaudo.com/satblog/2009/06/21/16/</guid>
		<description><![CDATA[
			
				
			
		
This is an example of writing an stored procedure in oracle:

CREATE OR REPLACE PROCEDURE “INST_SUB_PRIMARY_DET_SAT” &#40;tmp_int in number&#41; IS
&#160;
BEGIN
&#160;
-- cursor
DECLARE CURSOR PRIMARY_DET
IS
SELECT
t.PRIMARY_ID p,
t.SUB_ID s,
t.OFFICE_ADDRESS.OFFICE_NO o1,
t.OFFICE_ADDRESS.OFFICE_NAME o2,
t.OFFICE_ADDRESS.ADDRESS1 o3,
t.OFFICE_ADDRESS.ADDRESS2 o4,
t.OFFICE_ADDRESS.ADDRESS3 o5,
t.OFFICE_ADDRESS.CITY o6,
t.OFFICE_ADDRESS.COUNTY o7,
t.OFFICE_ADDRESS.POST_CODE o8,
t.PRIMACY_NO pri,
t.COMPANY_NAME com,
t.CONTACT_NAME cont,
t.CONTACT_MOBILE mob,
t.CONTACT_PHONE phone,
t.CONTACT_EMAIL email,
t.OFFICE_PHONE opho,
t.OFFICE_FAX ofax,
t.OFFICE_EMAIL oemail,
t.IS_ACTIVE act,
t.IS_DELETE del,
t.ADDDT adt,
t.ADDED_BY aby,
t.ADDED_BY_ID aid,
t.EDITDT edt,
t.UPDATE_BY uby,
t.UPDATE_BY_ID ubi
&#160;
FROM SUBSCRIBER_PRIMARY t;
&#160;
--cres PRIMARY_DET%ROWTYPE;
&#160;
BEGIN
FOR cres IN PRIMARY_DET
LOOP
INSERT [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fsatishgaudo.com%2Fsatblog%2F2009%2F06%2F21%2F16%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fsatishgaudo.com%2Fsatblog%2F2009%2F06%2F21%2F16%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>This is an example of writing an stored procedure in oracle:</p>

<div class="wp_syntax"><div class="code"><pre class="" style="font-family:monospace;">CREATE OR REPLACE PROCEDURE “INST_SUB_PRIMARY_DET_SAT” <span class="br0">&#40;</span>tmp_int in number<span class="br0">&#41;</span> IS
&nbsp;
BEGIN
&nbsp;
-- cursor
DECLARE CURSOR PRIMARY_DET
IS
SELECT
t.PRIMARY_ID p,
t.SUB_ID s,
t.OFFICE_ADDRESS.OFFICE_NO o1,
t.OFFICE_ADDRESS.OFFICE_NAME o2,
t.OFFICE_ADDRESS.ADDRESS1 o3,
t.OFFICE_ADDRESS.ADDRESS2 o4,
t.OFFICE_ADDRESS.ADDRESS3 o5,
t.OFFICE_ADDRESS.CITY o6,
t.OFFICE_ADDRESS.COUNTY o7,
t.OFFICE_ADDRESS.POST_CODE o8,
t.PRIMACY_NO pri,
t.COMPANY_NAME com,
t.CONTACT_NAME cont,
t.CONTACT_MOBILE mob,
t.CONTACT_PHONE phone,
t.CONTACT_EMAIL email,
t.OFFICE_PHONE opho,
t.OFFICE_FAX ofax,
t.OFFICE_EMAIL oemail,
t.IS_ACTIVE act,
t.IS_DELETE del,
t.ADDDT adt,
t.ADDED_BY aby,
t.ADDED_BY_ID aid,
t.EDITDT edt,
t.UPDATE_BY uby,
t.UPDATE_BY_ID ubi
&nbsp;
FROM SUBSCRIBER_PRIMARY t;
&nbsp;
--cres PRIMARY_DET%ROWTYPE;
&nbsp;
BEGIN
FOR cres IN PRIMARY_DET
LOOP
INSERT INTO SUBSCRIBER_PRIMARY_test2
VALUES<span class="br0">&#40;</span>
cres.p,
cres.s,
cres.pri,
cres.com,
cres.cont,
cres.mob,
cres.phone,
cres.email,
office_address_type2<span class="br0">&#40;</span>cres.o1, cres.o2, cres.o3, cres.o4, cres.o5, cres.o6, cres.o7, cres.o8, null<span class="br0">&#41;</span>,
cres.opho,
cres.ofax,
cres.oemail,
cres.act,
cres.del,
cres.adt,
cres.aby,
cres.aid,
cres.edt,
cres.uby,
cres.ubi
<span class="br0">&#41;</span>;
END LOOP;
END;
&nbsp;
END;</pre></div></div>

<p>Now execute the procedure:<br />
execute begin INST_SUB_PRIMARY_DET_SAT(&#8217;1&#8242;);end;</p>
]]></content:encoded>
			<wfw:commentRss>http://satishgaudo.com/satblog/2009/06/21/16/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Send mail :Through sql / pl in oracle</title>
		<link>http://satishgaudo.com/satblog/2009/06/14/send-mail-through-sql-pl-in-oracle/</link>
		<comments>http://satishgaudo.com/satblog/2009/06/14/send-mail-through-sql-pl-in-oracle/#comments</comments>
		<pubDate>Sat, 13 Jun 2009 19:12:56 +0000</pubDate>
		<dc:creator>satishgaudo</dc:creator>
				<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://satishgaudo.com/satblog/?p=6</guid>
		<description><![CDATA[
			
				
			
		

create or replace PROCEDURE send_mail &#40;p_sender       IN VARCHAR2,
p_recipient IN VARCHAR2,
p_message   IN VARCHAR2&#41;
as
l_mailhost VARCHAR2&#40;255&#41; := '192.168.1.21';
l_mail_conn utl_smtp.connection;
BEGIN
l_mail_conn := utl_smtp.open_connection&#40;l_mailhost, 25&#41;;
utl_smtp.helo&#40;l_mail_conn, l_mailhost&#41;;
utl_smtp.mail&#40;l_mail_conn, p_sender&#41;;
utl_smtp.rcpt&#40;l_mail_conn, p_recipient&#41;;
utl_smtp.open_data&#40;l_mail_conn &#41;;
utl_smtp.write_data&#40;l_mail_conn, p_message&#41;;
utl_smtp.close_data&#40;l_mail_conn &#41;;
utl_smtp.quit&#40;l_mail_conn&#41;;
end;
/

Now execute the procedure above:

begin send_mail&#40; 'satishg@imageonline.co.in',
'rolvy@imageonline.co.in',
'Hello Tom' &#41;;
 end; /

]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fsatishgaudo.com%2Fsatblog%2F2009%2F06%2F14%2Fsend-mail-through-sql-pl-in-oracle%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fsatishgaudo.com%2Fsatblog%2F2009%2F06%2F14%2Fsend-mail-through-sql-pl-in-oracle%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>

<div class="wp_syntax"><div class="code"><pre class="" style="font-family:monospace;">create or replace PROCEDURE send_mail <span class="br0">&#40;</span>p_sender       IN VARCHAR2,
p_recipient IN VARCHAR2,
p_message   IN VARCHAR2<span class="br0">&#41;</span>
as
l_mailhost VARCHAR2<span class="br0">&#40;</span><span style="">255</span><span class="br0">&#41;</span> := '192.168.1.21';
l_mail_conn utl_smtp.connection;
BEGIN
l_mail_conn := utl_smtp.open_connection<span class="br0">&#40;</span>l_mailhost, <span style="">25</span><span class="br0">&#41;</span>;
utl_smtp.helo<span class="br0">&#40;</span>l_mail_conn, l_mailhost<span class="br0">&#41;</span>;
utl_smtp.mail<span class="br0">&#40;</span>l_mail_conn, p_sender<span class="br0">&#41;</span>;
utl_smtp.rcpt<span class="br0">&#40;</span>l_mail_conn, p_recipient<span class="br0">&#41;</span>;
utl_smtp.open_data<span class="br0">&#40;</span>l_mail_conn <span class="br0">&#41;</span>;
utl_smtp.write_data<span class="br0">&#40;</span>l_mail_conn, p_message<span class="br0">&#41;</span>;
utl_smtp.close_data<span class="br0">&#40;</span>l_mail_conn <span class="br0">&#41;</span>;
utl_smtp.quit<span class="br0">&#40;</span>l_mail_conn<span class="br0">&#41;</span>;
end;
/</pre></div></div>

<p>Now execute the procedure above:</p>

<div class="wp_syntax"><div class="code"><pre class="" style="font-family:monospace;">begin send_mail<span class="br0">&#40;</span> 'satishg@imageonline.co.in',
'rolvy@imageonline.co.in',
'Hello Tom' <span class="br0">&#41;</span>;
 end; /</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://satishgaudo.com/satblog/2009/06/14/send-mail-through-sql-pl-in-oracle/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Bit of oracle</title>
		<link>http://satishgaudo.com/satblog/2009/06/14/bit-of-oracle/</link>
		<comments>http://satishgaudo.com/satblog/2009/06/14/bit-of-oracle/#comments</comments>
		<pubDate>Sat, 13 Jun 2009 19:10:45 +0000</pubDate>
		<dc:creator>satishgaudo</dc:creator>
				<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://satishgaudo.com/satblog/?p=5</guid>
		<description><![CDATA[
			
				
			
		

All the system tables that stores the user defined tables/sequences/object typesÂ :
&#160;
user_types
&#160;
USER_TYPE_ATTRS
&#160;
user_sequences
&#160;
user_tables
&#160;
USER_TAB_COLUMNS
&#160;
Code for creating a table for already existing table:
&#160;
CREATE TABLE HIP_TASK_INFO_satish as SELECT HIP_TASK_ID ,
&#160;
HIP_TASK_ID as HIP_TASK_BUDGET_ID,
HIP_TASK_ID as HIP_DUTY_DETAIL_ID,
IS_ACTIVE,
IS_DELETE,
ADDDT
FROM HIP_TASK_INFO
&#160;
Command to rename table :
&#160;
RENAME HIP_TASK_INFO_satish TO HIP_TASK_INFOÂ ;
&#160;
Code example for limits implementaion:
&#160;
SELECT temp.*,rownum FROM &#40;
&#160;
SELECT sp.company_name, sp.contact_phone, sp.office_fax, sp.sub_id, sb.branch_id, sb.branch_url, sp.Office_Address.Address1 &#124;&#124; ‘, [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fsatishgaudo.com%2Fsatblog%2F2009%2F06%2F14%2Fbit-of-oracle%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fsatishgaudo.com%2Fsatblog%2F2009%2F06%2F14%2Fbit-of-oracle%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>

<div class="wp_syntax"><div class="code"><pre class="" style="font-family:monospace;">All the system tables that stores the user defined tables/sequences/object typesÂ :
&nbsp;
user_types
&nbsp;
USER_TYPE_ATTRS
&nbsp;
user_sequences
&nbsp;
user_tables
&nbsp;
USER_TAB_COLUMNS
&nbsp;
Code for creating a table for already existing table:
&nbsp;
CREATE TABLE HIP_TASK_INFO_satish as SELECT HIP_TASK_ID ,
&nbsp;
HIP_TASK_ID as HIP_TASK_BUDGET_ID,
HIP_TASK_ID as HIP_DUTY_DETAIL_ID,
IS_ACTIVE,
IS_DELETE,
ADDDT
FROM HIP_TASK_INFO
&nbsp;
Command to rename table :
&nbsp;
RENAME HIP_TASK_INFO_satish TO HIP_TASK_INFOÂ ;
&nbsp;
Code example for limits implementaion:
&nbsp;
SELECT temp.*,rownum FROM <span class="br0">&#40;</span>
&nbsp;
SELECT sp.company_name, sp.contact_phone, sp.office_fax, sp.sub_id, sb.branch_id, sb.branch_url, sp.Office_Address.Address1 || ‘, ‘ || sp.Office_Address.Address2 || ‘, ‘ || sp.Office_Address.Address3 || ‘, ‘ || sp.Office_Address.City || ‘, ‘ || sp.Office_Address.County as address FROM subscriber_primary sp, subscriber_branch sb, subscriber_info si WHERE si.sub_id=sp.sub_id AND sb.sub_id=sp.sub_id AND si.sub_kind_id=<span style="">4</span> AND sp.primacy_no=<span style="">1</span> AND sb.branch_level = ‘<span style="">0</span>? <span class="br0">&#41;</span> tempGROUP BY
&nbsp;
temp.contact_phone, temp.office_fax, temp.sub_id, temp.branch_id, temp.branch_url, temp.address, rownum having rownum&gt;=<span style="">2</span> AND rownum&lt;<span style="">4</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://satishgaudo.com/satblog/2009/06/14/bit-of-oracle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
