INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Stored Procedure Help

Stored Procedure Help

(OP)
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.   

RE: Stored Procedure Help

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
http://www.mirtheil.com

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close