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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stored Procedure creation

Status
Not open for further replies.

dgillz

Instructor
Mar 2, 2001
10,043
US
I am trying to create an SP using Pervasive SQL v8.5. I cannot figure out what I am doing wrong. Here is my code:

Code:
CREATE PROCEDURE UpdatePoStatus() 
returns(select ord_no char(8) from POORDHDR_SQL)

I am getting this error:
"ODBC Error: SQLSTATE = S1000, Native error code = -5099
2: 'select': Syntax error"

Any ideas?

Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports
 
Can't do that. It would need to be:
Code:
CREATE PROCEDURE UpdatePoStatus()
returns(ord_no char(8))
as 
begin
select ord_no char(8) from POORDHDR_SQL;
end;

Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
Custom VB and Btrieve development.
 
I am now getting the following error:

ODBC Error: SQLSTATE = S1000, Native error code = -5099
Syntax Error: SELECT ord_no char<< ??? >>( 8) from POORDHDR_SQL

I cut and paste your code exactly. Any ideas what is wrong?

Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports
 
Try removing the 'char(8)' from your select statment.

zemp
 
Yep.. Sorry about that.. Zemp's right. It should be:
Code:
CREATE PROCEDURE UpdatePoStatus()
returns(ord_no char(8))
as
begin
select ord_no from POORDHDR_SQL;
end;

Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
Custom VB and Btrieve development.
 
How do I create a simple procedure that not only returns a value, but updates a value?

Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports
 
WHat do you mean by update a value? Are you talking about what's sent back to the application or updating a value in the database?

Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
Custom VB and Btrieve development.
 
In MS SQL, I can do this easily:

Update POORDHDR_SQL
Set Status='P'
Where Status='R'

Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports
 
The syntax for an update SQL statement in MS SQL Server and Pervasive are virtually the same.



zemp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top