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
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