Home » Developer & Programmer » Forms » Have a look at this people, it's strange SQL things
Have a look at this people, it's strange SQL things [message #78619] Wed, 06 March 2002 02:13 Go to next message
nik
Messages: 55
Registered: January 2002
Member
The following cursor returns a different value compared to when the select is run in SQL, does anyone know why please?

SQL> get time_cur
1 declare
2 v_time number;
3 cursor c1 is
4 select 6 + (to_number(to_char(trunc(90/60))))||'.'||to_number(to_char(mod(90,60)))
5 from dual;
6 begin
7 open c1;
8 fetch c1 into v_time;
9 dbms_output.put_line('time is'||' '||v_time);
10 close c1;
11* end;
SQL> /
time is 7.3

PL/SQL procedure successfully completed.

SQL> get time_cur_sql
1 select 6 + (to_number(to_char(trunc(90/60))))||'.'||to_number(to_char(mod(90,60)))
2* from dual
SQL> /

6+(T
----
7.30

SQL>
Re: Have a look at this people, it's strange SQL things [message #78620 is a reply to message #78619] Wed, 06 March 2002 03:31 Go to previous message
pratap kumar tripathy
Messages: 660
Registered: January 2002
Senior Member
the argument to dbms_output.put_line is always varchar2. when u pass a number to this procedure then automatic character conversion occurs

try

dbms_output.put_line('time is'||' '||to_char(v_time,'99.99'));
Previous Topic: Re: Master Detail Delete
Next Topic: works in sql+ but not in reports
Goto Forum:
  


Current Time: Fri Apr 19 09:32:29 CDT 2024