Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2004

    Unanswered: casting int as float

    I have a procedure code similar to this :

    create or replace procedure my
    var INT;
    var1 int;
    var3 DECIMAL;
    var3 := 2*(cast(var as float) / cast(var1 as float)) ;

    This throws :
    PL/SQL: Statement ignored
    PLS-00382: expression is of wrong type

    so int cannot be cast to float. what can I do to avoid the error ? Is there some other function that I can use instead ?

  2. #2
    Join Date
    Aug 2003
    Where the Surf Meets the Turf @Del Mar, CA
    Provided Answers: 1
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Apr 2004
    THanks for the direction. But the assignment as given above i.e var3 := 2*(cast(var as float) / cast(var1 as float)) ; doesn't seem to work. It gives me the same compilation error.

    Tried the same in Oracle 9i and it WORKED when the assigment statement was changed to SELECT...INTO statement. But both the approaches failed in 8i. Is it a known thing that cast functions cannot be used in assignment/select intos in Oracle 8i ?

    Appreciate your help !

Posting Permissions

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