Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Help with Conversion of Sybase Function to Oracle Function

Help with Conversion of Sybase Function to Oracle Function

From: Hotshot <scheldon_at_my-deja.com>
Date: 2000/08/02
Message-ID: <8maavr$krv$1@nnrp1.deja.com>#1/1

Hello,

    I am currently using a Sybase SQL Anywhere 5.0 database. I have migrated data to a Personal Oracle 8i database. I have recreated the table structures and data on the Oracle database. But since I am new to Oracle, I'm not too sure about the CREATE FUNCTION syntax on the Oracle database. I've looked through the documentation, but it does not answer my questions. This is the function on the Sybase database. It takes in two arguments, day of the week and a time value. It processes these and returns a string value. Can anyone please give the Oracle equivalent for this function. Thanks.

CREATE function "DBA".f_timeframe(in ll_dayofweek integer,in lt_issue_time time)
returns varchar(35)
begin
  declare ls_timeframe varchar(35);
  if ll_dayofweek=1 then
    set ls_timeframe='Sundays 00:30 - 00:29'   else
    if ll_dayofweek>=2 and ll_dayofweek<=6 then

      if lt_issue_time>='00:30:00' and lt_issue_time<='06:29:59'
then         set ls_timeframe='Weekdays 00:30 - 06:29'
      else if lt_issue_time<='09:29:59' then
          set ls_timeframe='Weekdays 06:30 - 09:29'
        else if lt_issue_time<='14:59:59' then
            set ls_timeframe='Weekdays 09:30 - 14:59'
          else if lt_issue_time<='18:59:59' then
              set ls_timeframe='Weekdays 15:00 - 18:59'
            else set ls_timeframe='Weekdays 19:00 - 00:29'
            end if
          end if
        end if
      end if
    else
      if ll_dayofweek=7 then
        if lt_issue_time>='00:30:00' and lt_issue_time<='16:59:59'
then           set ls_timeframe='Saturdays 15:00 - 16:59'
        else set ls_timeframe='Saturdays 17:00 - 00:29'
        end if
      else set ls_timeframe=Undefined
      end if

    end if
  end if
  ;
  return(ls_timeframe)
end

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Wed Aug 02 2000 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US