Skip to Main Content

Using a database link in dynamic sql

user545194Nov 28 2022 — edited Nov 28 2022

Hi,
We are struggling a little bit with using a database link in a dynamic sql section in a procedure.

v_sql := 'CREATE TABLE ' || v_target_schema ||'.'|| v_tbl_prefix || v_table_name ||' AS SELECT * FROM '|| v_source_schema ||'@'|| v_db_link ||'.'|| p_table_name;

EXECUTE IMMEDIATE v_sql;

ORA-02019: connection description for remote database not found
The db_link is public and the remote database can be accessed.
We believe that the issue could be with the '@' sign and the single quotes.
Help greatly appreciated. Thanks!

This post has been answered by Solomon Yakobson on Nov 28 2022
Jump to Answer
Comments
Post Details
Added on Nov 28 2022
2 comments
34 views