Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2004
    Posts
    205

    Unanswered: CAST function in assignment statement ?

    Hi,

    In the below procedure I couldn't use the cast function in assignment statement. Please explain ?

    create or replace procedure test
    as
    var int;
    var1 float;
    var2 decimal(19,4);
    begin
    var2 := cast(var as float);
    end;

    But the following query works fine :

    select cast(sno as float) from test

    ( Here sno is of int datatype )

    Please advise, how can I solve this in procedure level.

    Thanks,
    Sam

  2. #2
    Join Date
    Apr 2004
    Posts
    69
    I am facing a similar problem

    http://www.dbforums.com/t1008272.html

  3. #3
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    Would this be OK?
    Code:
    CREATE OR REPLACE PROCEDURE TEST
    AS
       var    INT;
       var1   FLOAT;
       var2   DECIMAL (19, 4);
    BEGIN
       SELECT CAST (var AS FLOAT)
         INTO var2
         FROM DUAL;
    END;

  4. #4
    Join Date
    Mar 2004
    Posts
    205
    Hi,

    Thanks for your reply. But this is not working in Oracle 8i. I too had tried this earlier. Any solution for Oracle 8i ?

    Thanks,
    Sam

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •