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

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

Status
Not open for further replies.

Mimi2012

Programmer
Aug 28, 2012
3
0
0
CA
Hi,

What I try to do is 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 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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top