plsql - Cursor and SUBSTR usage in procedure -


i need trim instance name complete dblink name .for example select query returns result hhvisdev.triniti.com. need hhvisdev. , ofcourse there such multiple results. need use cursor , print final result. getting warning: procedure created compilation errors., when compile. , when call procedure getting error @ line 1: ora-06575: package or function deletedblinks1 in invalid state. can 1 please guide me.

create or replace procedure deletedblinks1   cursor mycursor     select substr(db_link, 1, instr(db_link, '.', 1, 1) - 1)       dba_db_links;   myvar dba_db_links.dblinks%type; begin   open mycursor;    loop     fetch mycursor       myvar;      exit when mycursor%notfound;     dbms_output.put_line(myvar);   end loop;    close mycursor; end; / 

if see warning: procedure created compilation errors, then, can guess, compile procedure in sql*plus. in sql*plus can run command

show errors 

and see errors list. procedure looks ok, think problem - have no access dba_db_links view. try use all_db_links or user_db_links instead.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -