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 -> Re: Convert code from SQL Server 2000 to SQL Plus for Oracle

Re: Convert code from SQL Server 2000 to SQL Plus for Oracle

From: DA Morgan <damorgan_at_exxesolutions.com>
Date: Tue, 08 Apr 2003 09:02:06 -0700
Message-ID: <3E92F27E.BF8C5B20@exxesolutions.com>


Intikhab Bashir wrote:

> Hi, how can I change the following so Oracle SQL can recognise.
> Thanks in advance:
>
> -------------------DATE-------------------------
> declare @year varchar(4)
> set @year = datepart(yy, getdate())
>
> declare @month varchar(2)
> set @month = datepart(month, getdate())
>
> if (@month) = '1'
> begin
> set @month = '12'
> set @year = @year -1
> end
> else
> set @month = @month - 1
>
> declare @monthName varchar(3)
> declare @day varchar(2)
>
> if @month = '1'
> begin
> set @day = '31'
> set @monthName = 'Jan'
> end
> else if @month = '3'
> begin
> set @day = '31'
> set @monthName = 'Mar'
> end
> else if @month = '4'
> begin
> set @day = '30'
> set @monthName = 'Apr'
> end
> else if @month = '5'
> begin
> set @day = '31'
> set @monthName = 'May'
> end
> else if @month = '6'
> begin
> set @day = '30'
> set @monthName = 'Jun'
> end
> else if @month = '7'
> begin
> set @day = '31'
> set @monthName = 'Jul'
> end
> else if @month = '8'
> begin
> set @day = '31'
> set @monthName = 'Aug'
> end
> else if @month = '9'
> begin
> set @day = '30'
> set @monthName = 'Sep'
> end
> else if @month = '10'
> begin
> set @day = '31'
> set @monthName = 'Oct'
> end
> else if @month = '11'
> begin
> set @day = '30'
> set @monthName = 'Nov'
> end
> else if @month = '12'
> begin
> set @day = '31'
> set @monthName = 'Dec'
> end
> else
> begin
> set @day = '28'
> set @monthName = 'Feb'
> end
>
> declare @date varchar(20)
> set @date = @monthName + ' ' + right(@year, 2)
>
> declare @from varchar(30)
> declare @to varchar(30)
>
> set @from = '01 ' + @date
> set @to = @day + ' ' + @date
>
> print @from
> print @to

You can either pay someone's hourly consulting rate to do your job for you ... or go to http://tahiti.oracle.com and study Oracle.

Your code bears no relationship to anything in Oracle so you have a lot of study to do.

Daniel Morgan Received on Tue Apr 08 2003 - 11:02:06 CDT

Original text of this message

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