Home » SQL & PL/SQL » SQL & PL/SQL » Variable (10)
Variable [message #356856] Sun, 02 November 2008 21:44 Go to next message
maheshmhs
Messages: 93
Registered: October 2008
Location: Nepal
Member
hi,

I HAVE DECLARED A VARIABLE total.

i have counted the no of rows of a table and assigned that value to the variable total.

Now if total is 0 ie no rows in the table i want to store 1 in the variable total, else i want to store the no of rows in the table in that variable. How shall i do it.

thanx
Re: Variable [message #356862 is a reply to message #356856] Sun, 02 November 2008 22:35 Go to previous messageGo to next message
nagurtilak
Messages: 2
Registered: December 2006
Location: bangalore
Junior Member

useing decode function.
Re: Variable [message #356873 is a reply to message #356856] Sun, 02 November 2008 23:20 Go to previous messageGo to next message
Michel Cadot
Messages: 64140
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
In SQL or PL/SQL?
Which kind of variable? Bind variable, PL/SQL variable, SQL*Plus substitution variable?

Regards
Michel
Re: Variable [message #356874 is a reply to message #356856] Sun, 02 November 2008 23:21 Go to previous messageGo to next message
flyboy
Messages: 1832
Registered: November 2006
Senior Member
From one of your previous posts:
Quote:
You shall not guess the syntax and find it in Oracle documentation instead. It is accessible e.g. online on http://tahiti.oracle.com/.

The same goes with finding the required functionality. Open PL/SQL User's Guide and Reference and explore it. You maybe interested in Chapter 4 "Using PL/SQL Control Structures".
Re: Variable [message #356875 is a reply to message #356862] Sun, 02 November 2008 23:27 Go to previous message
maheshmhs
Messages: 93
Registered: October 2008
Location: Nepal
Member
thanx

i found "if{}end if" easier to use.

Previous Topic: Diff Between Schema and user
Next Topic: Dead Lock In Oracle
Goto Forum:
  


Current Time: Fri Dec 09 06:04:29 CST 2016

Total time taken to generate the page: 0.08291 seconds