Synonym, stored proc, parameter
Posted in 1997
Hi all.
This one's really bugging me.
I have a stored procedure which I pass a parameter to.
I then select some rows from one table to insert into
another, using the passed parameter in the select
statement so it's value gets inserted too.
This worked fine until I changed the table I'm selecting
from to be a synonym to a table in another instance.
I now get a 201 syntax error when I try and execute the
procedure. It's as if the the SQL is passed to the other
instance without "expanding" the reference to the passed
parameter, so (I guess) the other instance is wrongly
trying to select the item as if it's a column. Here's an example, and it
doesn't matter if I use an absolute
reference to the remote table or a synonym:
CREATE PROCEDURE friday1(passed_instance_id CHAR(8))
INSERT INTO sometable (instance_id, week)SELECT
passed_instance_id,
a_week_no
FROM other@xxxxtcp:remote_table ; -- Could be synonym
END PROCEDURE;
Does anyone have any ideas?
This is On-Line 7.23UC1 on AIX 4.2.1 by the way.
Cheers,
Jon Myatt
IBM OATD UK