oracle - compare to_char with float -
i'm trying compare hour , min dual actual data saved in tables .
the to_char(sysdate,'hh.mi') returns char data contains float number
but says no data found .
i'm trying :
create or replace function getsystime return char hhhh intervals.interval_end%type; v_interval_start intervals.interval_start%type; v_interval_end intervals.interval_end%type; v_interval_id intervals.interval_id%type; begin select interval_start ,interval_end , interval_id , to_char(sysdate,'hh.mi') v_interval_start , v_interval_end , v_interval_id , hhhh intervals hhhh = interval_start ; return v_interval_id; end; solved :
sloved using cast char float . cast (to_char(sysdate,'hh.mi') float) between interval_start , interval_end ;
welcome stack overflow!
your where clause used limit select statement rows satisfy condition (i.e. where mytable.favoritenumber = 5). alternatively, can have boolean expression in there. where 1=1 evaluates where true. because it's true, rows returned. where 0=2 evalutes where false , therefore no rows returned, because 0 not equal 2 in row.
in case, think logically. in order set of rows, need give parameters. how database know rows want? first have select fields using select. table? define from. want subset of rows meet conditions? add where. can store values row? add into. because pl/sql procedural doesn't mean read top bottom, left right.
your code not have possibly inserted value hhhh before knew rows meet where condition. therefore, have where null = interval_start.
if answer helped answer question, please choose accepted answer checkmark on left.
Comments
Post a Comment