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

Stored Procedure - error message

Status
Not open for further replies.

ArnaudAbadie

Programmer
Mar 14, 2001
43
FR
I have created the following stored proc

Procedure:
create procedure DupParam(out :param1 integer,in :param2 integer,in :param3 integer,in :param4 integer);
begin
declare :maxkey integer;
insert into param(iDB,iType,iOrder,iLien,sCod,sLib)
select iDB,iType,iOrder,iLien,'Copy'+sCod,'Copy'+sLib from param where iKey = :param2 and iDB = :param3;
select max(iKey) into :maxkey from param;
set :param1=:maxkey;
end;

Error message retrieved:
[Pervasive][ODBC Client Interface][LNA][Pervasive][ODBC Engine Interface][Data Record Manager][SPEng][Pervasive][ODBC Engine Erreur SQL general Interface] Non unique table reference: param

Any suggestion would be welcome
 
The problem is the duplicate reference to the param table in the query. Use an Alias on one of the references, e.g.:

insert into param(iDB,iType,iOrder,iLien,sCod,sLib)
select a.iDB, a.iType, a.iOrder, a.iLien, 'Copy'+a.sCod, 'Copy'+a.sLib from param a where a.iKey = :param2 and a.iDB = :param3;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top