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

Stored Procedure Help

Status
Not open for further replies.

skizdigidy

Programmer
May 7, 2008
1
US
Hello Everyone,

I'm fairly new to Pervasive SQL and SQL in general I guess. I'm a VB.NET programmer. We use Pervasive for our ERP server at my workplace. The Pervasive Control Center is version 8.70.014.000. I'm trying to create some stored procedures for an application I'm working on. For the life of me, I cannot seem to get the thing to work. I keep getting the following error:

ODBC Error: SQLSTATE = S1000, Native error code = 0
Incompatible types in expression.

This is my code for the stored procedure:

CREATE PROCEDURE P_SRC_GetParent(IN :parentNumber CHAR(20));
BEGIN
SELECT ROUTER
FROM ROUTER_HEADER
WHERE ROUTER = :parentNumber;
END;

Pretty simple right? You'd think so anyways.

The datatype for ROUTER in table ROUTER_HEADER is CHAR(20). I've tried using the CONVERT function in various ways and I cannot seem to get any output. If I hard code a value in place of :parentNumber I can get output. So it's definitely something with my parameter and its data type.

If someone could please help me I'd greatly appreciate.
 
What is your goal with the stored procedure? As it's written now, it won't return anything. You'd need a Returns clause to return any data. The following worked for me:
Code:
CREATE PROCEDURE P_SRC_GetParent1(IN :ParentNumber CHAR(20)) returns (ParentNr char(20));
BEGIN
    SELECT ROUTER
    FROM ROUTER_HEADER
    WHERE ROUTER = :ParentNumber;
END;

What does your code look like when you call the procedure?


Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top