Rao_S
asked on
Can you help me resolve a ORA-01006?
hi, i get a ORA-01006: bind variable does not exist ..... error with this, from a packaged proc, can you please help me with this...
EXECUTE IMMEDIATE
'select oldest_backup_time,newest_ backup_tim e into :lv_oldest, :lv_newest from '
|| lv_dbname
|| '.'
|| 'rc_backup_set_summary'
|| '@'
|| 'LINK_ABCDEF '
USING lv_oldest,lv_newest,lv_dbn ame;
EXECUTE IMMEDIATE
'select oldest_backup_time,newest_
|| lv_dbname
|| '.'
|| 'rc_backup_set_summary'
|| '@'
|| 'LINK_ABCDEF '
USING lv_oldest,lv_newest,lv_dbn
Missing colon, here: ... || lv_dbname
You are passing 3 variables (using ,,) and defined 2 in your query :lv.
You can't pass however the databaselink name as a bind variable, so you must include it in the query text.
Try
lv_dbname := ' 'LINK_ABCDEF ';
EXECUTE IMMEDIATE
'select oldest_backup_time,newest_ backup_tim e into :lv_oldest, :lv_newest from '
|| lv_dbname
|| '.'
|| 'rc_backup_set_summary'
|| '@'
|| lv_dbname
USING lv_oldest,lv_newest;
You can't pass however the databaselink name as a bind variable, so you must include it in the query text.
Try
lv_dbname := ' 'LINK_ABCDEF ';
EXECUTE IMMEDIATE
'select oldest_backup_time,newest_
|| lv_dbname
|| '.'
|| 'rc_backup_set_summary'
|| '@'
|| lv_dbname
USING lv_oldest,lv_newest;
Is the schema name same as dblink ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Try
EXECUTE IMMEDIATE
'select oldest_backup_time,newest_backup_time into :lv_oldest, :lv_newest from '
|| lv_dbname
|| '.'
|| 'rc_backup_set_summary'
|| '@'
|| 'LINK_ABCDEF '
USING lv_oldest,lv_newest;
1) Your query does not have and conditions and therefore will none of the posted variations will work unless the table has ONE row.
2) In the EXECUTE IMMEDIATE statement, the "USING" part is to supply bind variable values to the query and the "INTO" part is to receive results from the query.
3) Other than variables, in order to supply information that builds the query and which is contained in variables (like schema and/or table name and/or database link. etc...), you must CONCATENATE these variables to the query text.
2) In the EXECUTE IMMEDIATE statement, the "USING" part is to supply bind variable values to the query and the "INTO" part is to receive results from the query.
3) Other than variables, in order to supply information that builds the query and which is contained in variables (like schema and/or table name and/or database link. etc...), you must CONCATENATE these variables to the query text.
ASKER
hi flow, the schema name is not same as the link name, i tried to use the link name as a variable, but your script did not work...
hi mikeom_dba, i tried your scipt, and it worked thank you...
hi mikeom_dba, i tried your scipt, and it worked thank you...
ASKER
thank you..