I am trying to run the following statement, which attempts to dynamically pass the dblink name, in a procedure:
select nvl(max(report_key), 0) into v_max_report_key from cym_reports||v_sn;
Where v_sn is initialized above to be '@dblink' using the statement - select '@'||CDS_SERVICE_NAME into v_sn from cym_org_list where org_id = x.org_id;
The statement is producing an error. The error is caused because it expects an @ symbol or a ; after the table name.
How can I dynamically append the dblink name to an sql statement and get it to execute from within a procedure?
Thanks
select nvl(max(report_key), 0) into v_max_report_key from cym_reports||v_sn;
Where v_sn is initialized above to be '@dblink' using the statement - select '@'||CDS_SERVICE_NAME into v_sn from cym_org_list where org_id = x.org_id;
The statement is producing an error. The error is caused because it expects an @ symbol or a ; after the table name.
How can I dynamically append the dblink name to an sql statement and get it to execute from within a procedure?
Thanks