Home » SQL & PL/SQL » SQL & PL/SQL » Replace No Rows Returned with Zeros
Replace No Rows Returned with Zeros [message #246114] Wed, 20 June 2007 00:41 Go to next message
durai
Messages: 38
Registered: December 2006
Member
(vanakkam/hi) to all

is it possible to Replace No Rows Returned with Zeros,

Also one doubt in cursor
i am using more than 10 select statements, so i tried cursor with union, the problem is if the 2nd select doesn't return any value means it should be replaced by 0's

to make this i used 10 procedures and 10 cursors but it's looks too lengthy


is there any solution
i am waiting for the reply
advance thanx to all
Re: Replace No Rows Returned with Zeros [message #246118 is a reply to message #246114] Wed, 20 June 2007 00:57 Go to previous messageGo to next message
Michel Cadot
Messages: 64145
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
1/ No. It a hard-coded SQL*PLus message
2/ Why do you want to "union" 10 queries? Is there any relation between them? Do you really need this? Do you want to exclude duplicates?
3/ Do you need PL/SQL and cursor to execute your queries? Can't you do it only with SQL?

Regards
Michel
Re: Replace No Rows Returned with Zeros [message #246202 is a reply to message #246118] Wed, 20 June 2007 05:00 Go to previous messageGo to next message
durai
Messages: 38
Registered: December 2006
Member
1/ No. It a hard-coded SQL*PLus message
2/ Why do you want to "union" 10 queries? Is there any relation between them? Do you really need this? Do you want to exclude duplicates?
3/ Do you need PL/SQL and cursor to execute your queries? Can't you do it only with SQL?



i have written 10 select(with 9 AND conditions) queries for getting a/c no, balance
but in each query some condition will vary
1st 5 select statement vary by one AND condition
others are by 2 AND condition

also i need the output as
0120070001|A|A1|2000
0120070005|A|A1|2000
0|A|A2|3000
0|B|B1|6000
0120070100|B|B2|9500
.
.
.
.
.
.
.

likewise i needed the output,
even if does not have any value a null or zero should be replaced

is it good to use 10 cursors, since now itself the system taking 1.5 minutes to run the program

why i going for cursor means to replace the row by zero if the select statements returns no rows

please give me reply
thanx a lot
Re: Replace No Rows Returned with Zeros [message #246208 is a reply to message #246202] Wed, 20 June 2007 05:19 Go to previous messageGo to next message
Michel Cadot
Messages: 64145
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Too less information.

Regards
Michel
Re: Replace No Rows Returned with Zeros [message #246209 is a reply to message #246202] Wed, 20 June 2007 05:19 Go to previous message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
Quote:
why i going for cursor means to replace the row by zero if the select statements returns no rows


I have absolutely no idea what you are talking about. Sorry.

But I'd have a look at my cursors. If the conditions really are very similar and you're selecting from the same tables all the time, there's a good change that you can rewrite it as a single query.

MHE
Previous Topic: need column headers
Next Topic: Table changes capture through triggers
Goto Forum:
  


Current Time: Fri Dec 09 11:31:46 CST 2016

Total time taken to generate the page: 0.11354 seconds