dbTalk Databases Forums  

Converting Sybase SP to Oracle procedure

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss Converting Sybase SP to Oracle procedure in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Tim Slattery
 
Posts: n/a

Default Converting Sybase SP to Oracle procedure - 08-13-2008 , 09:47 AM






I'm converting a Sybase database to Oracle. Part of this involves
stored procedures. I have a number of very simple Sybase SPs that
consist of a single select statement:

CREATE PROCEDURE dbo.getContactData
@resp char(9)

as
begin

select Respondent, Contact_Name, Contact_Company_Name_1,
Contact_Company_Name_2, Contact_Address, Contact_City,
Contact_State, Contact_Zip, Contact_Zip_Extension,
Contact_EMail,
Contact_Telephone, Contact_Telephone_Suffix, Contact_Fax
from registry
where respondent = @resp
end

This simply returns a number of rows to the caller.

But when I convert it to this Oracle procedure:

create or replace procedure getContactData
(p_resp char)

IS
BEGIN

select Respondent, Contact_Name, Contact_Company_Name_1,
Contact_Company_Name_2, Contact_Address, Contact_City,
Contact_State, Contact_Zip, Contact_Zip_Extension,
Contact_EMail,
Contact_Telephone, Contact_Telephone_Suffix, Contact_Fax
from registry
where respondent = p_resp;
END;
/


it tells me that I need an "into" clause on the "select" statement.
But I don't want to capture the data within the procedure, I want to
return it to the caller.

What do I need to do?

--
Tim Slattery
Slattery_T (AT) bls (DOT) gov
http://members.cox.net/slatteryt

Reply With Quote
  #2  
Old   
gym dot scuba dot kennedy at gmail
 
Posts: n/a

Default Re: Converting Sybase SP to Oracle procedure - 08-13-2008 , 10:48 AM







"Tim Slattery" <Slattery_T (AT) bls (DOT) gov> wrote

Quote:
I'm converting a Sybase database to Oracle. Part of this involves
stored procedures. I have a number of very simple Sybase SPs that
consist of a single select statement:

CREATE PROCEDURE dbo.getContactData
@resp char(9)

as
begin

select Respondent, Contact_Name, Contact_Company_Name_1,
Contact_Company_Name_2, Contact_Address, Contact_City,
Contact_State, Contact_Zip, Contact_Zip_Extension,
Contact_EMail,
Contact_Telephone, Contact_Telephone_Suffix, Contact_Fax
from registry
where respondent = @resp
end

This simply returns a number of rows to the caller.

But when I convert it to this Oracle procedure:

create or replace procedure getContactData
(p_resp char)

IS
BEGIN

select Respondent, Contact_Name, Contact_Company_Name_1,
Contact_Company_Name_2, Contact_Address, Contact_City,
Contact_State, Contact_Zip, Contact_Zip_Extension,
Contact_EMail,
Contact_Telephone, Contact_Telephone_Suffix, Contact_Fax
from registry
where respondent = p_resp;
END;
/


it tells me that I need an "into" clause on the "select" statement.
But I don't want to capture the data within the procedure, I want to
return it to the caller.

What do I need to do?

--
Tim Slattery
Slattery_T (AT) bls (DOT) gov
http://members.cox.net/slatteryt
You can return a ref cursor to the caller as an out parameter. See ref
cursor in the docs.




Reply With Quote
  #3  
Old   
gym dot scuba dot kennedy at gmail
 
Posts: n/a

Default Re: Converting Sybase SP to Oracle procedure - 08-13-2008 , 10:48 AM




"Tim Slattery" <Slattery_T (AT) bls (DOT) gov> wrote

Quote:
I'm converting a Sybase database to Oracle. Part of this involves
stored procedures. I have a number of very simple Sybase SPs that
consist of a single select statement:

CREATE PROCEDURE dbo.getContactData
@resp char(9)

as
begin

select Respondent, Contact_Name, Contact_Company_Name_1,
Contact_Company_Name_2, Contact_Address, Contact_City,
Contact_State, Contact_Zip, Contact_Zip_Extension,
Contact_EMail,
Contact_Telephone, Contact_Telephone_Suffix, Contact_Fax
from registry
where respondent = @resp
end

This simply returns a number of rows to the caller.

But when I convert it to this Oracle procedure:

create or replace procedure getContactData
(p_resp char)

IS
BEGIN

select Respondent, Contact_Name, Contact_Company_Name_1,
Contact_Company_Name_2, Contact_Address, Contact_City,
Contact_State, Contact_Zip, Contact_Zip_Extension,
Contact_EMail,
Contact_Telephone, Contact_Telephone_Suffix, Contact_Fax
from registry
where respondent = p_resp;
END;
/


it tells me that I need an "into" clause on the "select" statement.
But I don't want to capture the data within the procedure, I want to
return it to the caller.

What do I need to do?

--
Tim Slattery
Slattery_T (AT) bls (DOT) gov
http://members.cox.net/slatteryt
You can return a ref cursor to the caller as an out parameter. See ref
cursor in the docs.




Reply With Quote
  #4  
Old   
gym dot scuba dot kennedy at gmail
 
Posts: n/a

Default Re: Converting Sybase SP to Oracle procedure - 08-13-2008 , 10:48 AM




"Tim Slattery" <Slattery_T (AT) bls (DOT) gov> wrote

Quote:
I'm converting a Sybase database to Oracle. Part of this involves
stored procedures. I have a number of very simple Sybase SPs that
consist of a single select statement:

CREATE PROCEDURE dbo.getContactData
@resp char(9)

as
begin

select Respondent, Contact_Name, Contact_Company_Name_1,
Contact_Company_Name_2, Contact_Address, Contact_City,
Contact_State, Contact_Zip, Contact_Zip_Extension,
Contact_EMail,
Contact_Telephone, Contact_Telephone_Suffix, Contact_Fax
from registry
where respondent = @resp
end

This simply returns a number of rows to the caller.

But when I convert it to this Oracle procedure:

create or replace procedure getContactData
(p_resp char)

IS
BEGIN

select Respondent, Contact_Name, Contact_Company_Name_1,
Contact_Company_Name_2, Contact_Address, Contact_City,
Contact_State, Contact_Zip, Contact_Zip_Extension,
Contact_EMail,
Contact_Telephone, Contact_Telephone_Suffix, Contact_Fax
from registry
where respondent = p_resp;
END;
/


it tells me that I need an "into" clause on the "select" statement.
But I don't want to capture the data within the procedure, I want to
return it to the caller.

What do I need to do?

--
Tim Slattery
Slattery_T (AT) bls (DOT) gov
http://members.cox.net/slatteryt
You can return a ref cursor to the caller as an out parameter. See ref
cursor in the docs.




Reply With Quote
  #5  
Old   
gym dot scuba dot kennedy at gmail
 
Posts: n/a

Default Re: Converting Sybase SP to Oracle procedure - 08-13-2008 , 10:48 AM




"Tim Slattery" <Slattery_T (AT) bls (DOT) gov> wrote

Quote:
I'm converting a Sybase database to Oracle. Part of this involves
stored procedures. I have a number of very simple Sybase SPs that
consist of a single select statement:

CREATE PROCEDURE dbo.getContactData
@resp char(9)

as
begin

select Respondent, Contact_Name, Contact_Company_Name_1,
Contact_Company_Name_2, Contact_Address, Contact_City,
Contact_State, Contact_Zip, Contact_Zip_Extension,
Contact_EMail,
Contact_Telephone, Contact_Telephone_Suffix, Contact_Fax
from registry
where respondent = @resp
end

This simply returns a number of rows to the caller.

But when I convert it to this Oracle procedure:

create or replace procedure getContactData
(p_resp char)

IS
BEGIN

select Respondent, Contact_Name, Contact_Company_Name_1,
Contact_Company_Name_2, Contact_Address, Contact_City,
Contact_State, Contact_Zip, Contact_Zip_Extension,
Contact_EMail,
Contact_Telephone, Contact_Telephone_Suffix, Contact_Fax
from registry
where respondent = p_resp;
END;
/


it tells me that I need an "into" clause on the "select" statement.
But I don't want to capture the data within the procedure, I want to
return it to the caller.

What do I need to do?

--
Tim Slattery
Slattery_T (AT) bls (DOT) gov
http://members.cox.net/slatteryt
You can return a ref cursor to the caller as an out parameter. See ref
cursor in the docs.




Reply With Quote
  #6  
Old   
DA Morgan
 
Posts: n/a

Default Re: Converting Sybase SP to Oracle procedure - 08-13-2008 , 03:10 PM



Tim Slattery wrote:
Quote:
I'm converting a Sybase database to Oracle. Part of this involves
stored procedures. I have a number of very simple Sybase SPs that
consist of a single select statement:

CREATE PROCEDURE dbo.getContactData
@resp char(9)

as
begin

select Respondent, Contact_Name, Contact_Company_Name_1,
Contact_Company_Name_2, Contact_Address, Contact_City,
Contact_State, Contact_Zip, Contact_Zip_Extension,
Contact_EMail,
Contact_Telephone, Contact_Telephone_Suffix, Contact_Fax
from registry
where respondent = @resp
end

This simply returns a number of rows to the caller.

But when I convert it to this Oracle procedure:

create or replace procedure getContactData
(p_resp char)

IS
BEGIN

select Respondent, Contact_Name, Contact_Company_Name_1,
Contact_Company_Name_2, Contact_Address, Contact_City,
Contact_State, Contact_Zip, Contact_Zip_Extension,
Contact_EMail,
Contact_Telephone, Contact_Telephone_Suffix, Contact_Fax
from registry
where respondent = p_resp;
END;
/


it tells me that I need an "into" clause on the "select" statement.
But I don't want to capture the data within the procedure, I want to
return it to the caller.

What do I need to do?
You are making a very common and fatal mistake ... thinking you can
treat Oracle like another brand of whatever product you know. This
strategy will lead to substantial use of colorful language but never
to success. So start by reading the concept books at
http://tahiti.oracle.com and understand how Oracle works. Oracle is
not an outgrowth of the UC Berkeley Ingress project and thus has a
very different way of doing things.

Another resource that will help you is Morgan's Library at www.psoug.org.

There you will find working demos of the following that will help you:

ANONYMOUS BLOCKS
STORED PROCEDURES
REF CURSORS

And review them in this order.

But until you understand why, in Oracle, reads don't block writes and
writes don't block reads, system change numbers, and MVCC you should
not even consider working on your procedure. The code you provided
contains two fatal errors and at least one other that should be of
concern.
--
Daniel A. Morgan
Oracle Ace Director & Instructor
University of Washington
damorgan@x.washington.edu (replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org


Reply With Quote
  #7  
Old   
DA Morgan
 
Posts: n/a

Default Re: Converting Sybase SP to Oracle procedure - 08-13-2008 , 03:10 PM



Tim Slattery wrote:
Quote:
I'm converting a Sybase database to Oracle. Part of this involves
stored procedures. I have a number of very simple Sybase SPs that
consist of a single select statement:

CREATE PROCEDURE dbo.getContactData
@resp char(9)

as
begin

select Respondent, Contact_Name, Contact_Company_Name_1,
Contact_Company_Name_2, Contact_Address, Contact_City,
Contact_State, Contact_Zip, Contact_Zip_Extension,
Contact_EMail,
Contact_Telephone, Contact_Telephone_Suffix, Contact_Fax
from registry
where respondent = @resp
end

This simply returns a number of rows to the caller.

But when I convert it to this Oracle procedure:

create or replace procedure getContactData
(p_resp char)

IS
BEGIN

select Respondent, Contact_Name, Contact_Company_Name_1,
Contact_Company_Name_2, Contact_Address, Contact_City,
Contact_State, Contact_Zip, Contact_Zip_Extension,
Contact_EMail,
Contact_Telephone, Contact_Telephone_Suffix, Contact_Fax
from registry
where respondent = p_resp;
END;
/


it tells me that I need an "into" clause on the "select" statement.
But I don't want to capture the data within the procedure, I want to
return it to the caller.

What do I need to do?
You are making a very common and fatal mistake ... thinking you can
treat Oracle like another brand of whatever product you know. This
strategy will lead to substantial use of colorful language but never
to success. So start by reading the concept books at
http://tahiti.oracle.com and understand how Oracle works. Oracle is
not an outgrowth of the UC Berkeley Ingress project and thus has a
very different way of doing things.

Another resource that will help you is Morgan's Library at www.psoug.org.

There you will find working demos of the following that will help you:

ANONYMOUS BLOCKS
STORED PROCEDURES
REF CURSORS

And review them in this order.

But until you understand why, in Oracle, reads don't block writes and
writes don't block reads, system change numbers, and MVCC you should
not even consider working on your procedure. The code you provided
contains two fatal errors and at least one other that should be of
concern.
--
Daniel A. Morgan
Oracle Ace Director & Instructor
University of Washington
damorgan@x.washington.edu (replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org


Reply With Quote
  #8  
Old   
DA Morgan
 
Posts: n/a

Default Re: Converting Sybase SP to Oracle procedure - 08-13-2008 , 03:10 PM



Tim Slattery wrote:
Quote:
I'm converting a Sybase database to Oracle. Part of this involves
stored procedures. I have a number of very simple Sybase SPs that
consist of a single select statement:

CREATE PROCEDURE dbo.getContactData
@resp char(9)

as
begin

select Respondent, Contact_Name, Contact_Company_Name_1,
Contact_Company_Name_2, Contact_Address, Contact_City,
Contact_State, Contact_Zip, Contact_Zip_Extension,
Contact_EMail,
Contact_Telephone, Contact_Telephone_Suffix, Contact_Fax
from registry
where respondent = @resp
end

This simply returns a number of rows to the caller.

But when I convert it to this Oracle procedure:

create or replace procedure getContactData
(p_resp char)

IS
BEGIN

select Respondent, Contact_Name, Contact_Company_Name_1,
Contact_Company_Name_2, Contact_Address, Contact_City,
Contact_State, Contact_Zip, Contact_Zip_Extension,
Contact_EMail,
Contact_Telephone, Contact_Telephone_Suffix, Contact_Fax
from registry
where respondent = p_resp;
END;
/


it tells me that I need an "into" clause on the "select" statement.
But I don't want to capture the data within the procedure, I want to
return it to the caller.

What do I need to do?
You are making a very common and fatal mistake ... thinking you can
treat Oracle like another brand of whatever product you know. This
strategy will lead to substantial use of colorful language but never
to success. So start by reading the concept books at
http://tahiti.oracle.com and understand how Oracle works. Oracle is
not an outgrowth of the UC Berkeley Ingress project and thus has a
very different way of doing things.

Another resource that will help you is Morgan's Library at www.psoug.org.

There you will find working demos of the following that will help you:

ANONYMOUS BLOCKS
STORED PROCEDURES
REF CURSORS

And review them in this order.

But until you understand why, in Oracle, reads don't block writes and
writes don't block reads, system change numbers, and MVCC you should
not even consider working on your procedure. The code you provided
contains two fatal errors and at least one other that should be of
concern.
--
Daniel A. Morgan
Oracle Ace Director & Instructor
University of Washington
damorgan@x.washington.edu (replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org


Reply With Quote
  #9  
Old   
DA Morgan
 
Posts: n/a

Default Re: Converting Sybase SP to Oracle procedure - 08-13-2008 , 03:10 PM



Tim Slattery wrote:
Quote:
I'm converting a Sybase database to Oracle. Part of this involves
stored procedures. I have a number of very simple Sybase SPs that
consist of a single select statement:

CREATE PROCEDURE dbo.getContactData
@resp char(9)

as
begin

select Respondent, Contact_Name, Contact_Company_Name_1,
Contact_Company_Name_2, Contact_Address, Contact_City,
Contact_State, Contact_Zip, Contact_Zip_Extension,
Contact_EMail,
Contact_Telephone, Contact_Telephone_Suffix, Contact_Fax
from registry
where respondent = @resp
end

This simply returns a number of rows to the caller.

But when I convert it to this Oracle procedure:

create or replace procedure getContactData
(p_resp char)

IS
BEGIN

select Respondent, Contact_Name, Contact_Company_Name_1,
Contact_Company_Name_2, Contact_Address, Contact_City,
Contact_State, Contact_Zip, Contact_Zip_Extension,
Contact_EMail,
Contact_Telephone, Contact_Telephone_Suffix, Contact_Fax
from registry
where respondent = p_resp;
END;
/


it tells me that I need an "into" clause on the "select" statement.
But I don't want to capture the data within the procedure, I want to
return it to the caller.

What do I need to do?
You are making a very common and fatal mistake ... thinking you can
treat Oracle like another brand of whatever product you know. This
strategy will lead to substantial use of colorful language but never
to success. So start by reading the concept books at
http://tahiti.oracle.com and understand how Oracle works. Oracle is
not an outgrowth of the UC Berkeley Ingress project and thus has a
very different way of doing things.

Another resource that will help you is Morgan's Library at www.psoug.org.

There you will find working demos of the following that will help you:

ANONYMOUS BLOCKS
STORED PROCEDURES
REF CURSORS

And review them in this order.

But until you understand why, in Oracle, reads don't block writes and
writes don't block reads, system change numbers, and MVCC you should
not even consider working on your procedure. The code you provided
contains two fatal errors and at least one other that should be of
concern.
--
Daniel A. Morgan
Oracle Ace Director & Instructor
University of Washington
damorgan@x.washington.edu (replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.