Wednesday, June 23, 2010

Oracle Tip: Close your Ref Cursor in PL/SQL

Hello Everyone,

There is a way in Oracle that you can close your Ref Cursor in PL/SQL store procedure and still able to retain the value into .NET application. This way you don’t leave unclosed cursor on server side.
------------------------------
Sample Code -- Start
------------------------------

PROCEDURE test(crs_out_cursor out sys_refcursor) AS
crs_error_local sys_refcursor;
mydata sys_refcursor;
rr emp%rowtype;
BEGIN
open crs_error_local for
select * from emp_table;
crs_out_cursor := crs_error_local;

loop
fetch mydata into rr;
exit when mydata%notfound;
end loop;

close crs_error_local;
crs_out_cursor := mydata;
----------------------------------------------------------------------------
--EXCEPITION HANDLER
----------------------------------------------------------------------------
EXCEPTION
when others
then
END test;
-----------------------------
Sample Code -- End
-----------------------------

Enjoy the tip!


Monday, June 21, 2010

Creating XMLHTTPRequestObject - For all Browsers





funciton getXMLHTTPRequest(){
var request = false;

if (window.XMLHTTPRequest){
request = new XMLHTTPRequest();
}else {
if(window.ActiveXObject){
try{
request = new ActiveXObject("Msml2.XMLHTTP");
} catch(err1){
try{
request = [ic:ccc]new ActiveXObject("Microsoft.XMLHTTP");
}catch(err2){
request = false;
}
}
}
}
return request;


Thursday, June 10, 2010

Just link my blog with Amazon :)




Hello Everyone...

Please don't forget to visit Amazon links on my blog. Thank You for visiting my blog. I will be posting more useful information.

Bye!

Wednesday, June 2, 2010

How to write oracle update query without using sub queries

update table3 t3
set (setvaluefield1,setvaluefield2,setvaluefield3) =
(select some_otherfield_from_t2, some2_otherfield_from_t2, '201004' from table2
where exists (select t2.pk_field1,t2.field2,t2.field3
from table1 t1,
table2 t2,
table3 t3
where t3.pk_field1 = t1.pk_field1
and t1.pk_field1 = t2.pk_field1
and t3.field2 = t1.field2
and t1.field2 = t2.field2
and (t3.start_date <= '200808' or t3.t1_init_date = '200808') and (t3.end_pricing_date > '200808'
and t3.t1_end_date >= '200808')
and t1.field3 = t2.field3
and t1.field3 not in ('00',' ')
and t1.field4 = '200808'
and t2.field4 = '200808'
and t2.field5 = 'Y'));