Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PL/SQL to T-SQL conversion

Status
Not open for further replies.

alrightydooda

Programmer
Jun 27, 2003
13
IE
Hi,

I am trying to convert an oracle database function into a SQL Server function and i am stuck on a particular line of code. Here is the PL/SQL:

OPEN c1;
LOOP
FETCH c1 INTO StageDesc;
EXIT WHEN c1%NOTFOUND;
Treatment := Treatment || StageDesc ||chr(13;
END LOOP;

Here is what i have converted it to in T-SQL:

OPEN c1
While (@@FETCH_STATUS = 0)
BEGIN
FETCH c1 INTO @StageDesc
@Treatment := @Treatment || StageDesc ||chr(13)
END

The error i am getting in query analyzer is "Incorrect syntax near '@Treatment'" on line 5

Any ideas how this should be converted?

 
OK I've figured it out:

OPEN c1
While (@@FETCH_STATUS = 0)
BEGIN
FETCH c1 INTO @StageDesc
set @Treatment = @Treatment + @StageDesc + char(13)
END
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top