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 in Pervasive.SQL V8, using one of table column of "50 TIMES PIC 9(4)" typ

Stored procedure in Pervasive.SQL V8, using one of table column of "50 TIMES PIC 9(4)" typ

Stored procedure in Pervasive.SQL V8, using one of table column of "50 TIMES PIC 9(4)" typ

(OP)
Hi,

I try to create a stored procedure which takes a parameter i.e. :CompanyId char(4) and to get some info about the company.

I tried this SELECT statement into the PERVASIVE.SQL DATA MANAGER (a sort of SQL Analyzer) and it works fine.

SELECT GROUP, NAME
FROM MYTABLE
WHERE (COMPAGNIES like '%0002%')

The outpt is OK:
20 COMPANY NAME INC.

Now, I put the same SELECT statement in the stored procedure like this and it returns absolutely nothing.

COMPANIES is a table's column of type

10 AVISFACT-COMPAGNIES.
20 AVISFACT-COMPAGNIE OCCURS 50 TIMES PIC 9(4).

CREATE PROCEDURE usp_GetCompanyInfo (in :CompanyId char(4))
RETURNS (
Group integer,
NAME varchar(30)
);
BEGIN
SELECT GROUP, NAME
FROM MYTABLE
WHERE (COMPAGNIES LIKE :CompanyId );
END;

In the Database, COMPANIES column is like a "string" but I understand it is not a string: 0061006901610169000000000000000000000000000000000000000000000000000000000....

I never worked with Btrieve neither with Cobol and I don't understand these kind of variables OCCURS 50 TIMES PIC 9(4). Do I need a temporary table with a column of varchar(200) in order to insert COMPANIES data? Is there a mean to do that in Pervasive.SQL V8?

If there aren't, how to convert such a column to a string?
Is there a solution to my stored procedure? Somebody can help me, please!

Thank you very much!
Mimi

RE: Stored procedure in Pervasive.SQL V8, using one of table column of "50 TIMES PIC 9(4)" typ

I'm assuming your not getting any results back. If that's the case, it is most likely related to the lack of wildcards in the LIKE clause.
Your SELECT should some thing like:

CODE

SELECT GROUP NAME
FROM MYTABLE
WHERE (COMPANIES LIKE '%' + :CompanyID + '%'); 

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