| RAJNISH |
Posted: Sep 02, 2008 08:13:41 AM |
Total Post: 92
Joined: Jan, 2007
|
Hi All,
can v do initialized Function With Variable.
example.
x number :=10
y number :=select decode(x,10,20) from dual;
or
va1 number := select func1 from dual;
is it correct?
if i want store value from the function wt should i do?
|
|
|
vino |
| Posted: Sep 02, 2008 08:23:33 AM | |
|
Total Post: 357
Joined: Aug, 2008
|
Hi,
You are right. We can initialise the value via variable.
|
|
|
|
|
vino |
| Posted: Sep 02, 2008 08:28:08 AM | |
|
Total Post: 357
Joined: Aug, 2008
|
Am Sorry, I was wrong at the first time.
We will not be able initialise function with a variable.
|
|
|
|
|
Vish |
| Posted: Sep 02, 2008 01:29:56 PM | |
|
Total Post: 127
Joined: Jan, 2007
|
you can declare one variable of return type of funcation and that variable you can assinge to any field.
|
|
|
|
|
RAJNISH |
| Posted: Sep 04, 2008 01:42:03 AM | |
|
Total Post: 92
Joined: Jan, 2007
|
hi vish,
can you give me some example.
|
|
|
|
|
babi |
| Posted: Sep 04, 2008 02:13:27 AM | |
|
Total Post: 16
Joined: Aug, 2008
|
Here is the example
CREATE OR REPLACE function test_func( x number) return number as
n number;
begin
select decode(x,10,10,20) into n from dual;
return n;
end;
/
create or replace procedure test_proc as
x number :=10;
y number;
begin
y := test_func(x);
dbms_output.put_line(' The value of y is '|| to_char(y));
end;
/
|
|
|
|
|
RAJNISH |
| Posted: Sep 04, 2008 02:17:51 AM | |
|
Total Post: 92
Joined: Jan, 2007
|
hi babi,
Thank you dear u got my Question.
Exactly Thats i want.
--Rajnish
|
|
|
|
|
Vish |
| Posted: Sep 04, 2008 02:23:08 AM | |
|
Total Post: 127
Joined: Jan, 2007
|
Hope u got your answer
Thank Babi
|
|
|
|
|
RAJNISH |
| Posted: Sep 04, 2008 03:04:56 AM | |
|
Total Post: 92
Joined: Jan, 2007
|
hi babi,
even you can do this without Procedure.
see bellow.
declare
x number:= 10;
n number;
y number ;
begin
select decode(x,10,20) into n from dual;
dbms_output.put_line(' The value of y is '|| to_char(x));
y := n;
dbms_output.put_line(' The value of y is '|| to_char(y));
end;
---RAJNISH
|
|
|
|
|
| Time Zone: EDT |
Send this thread to your friend |