sql - error using two cursors in plsql code -


i have 2 tables error_description , error_column.

error_description has below data :
"error processing column a_type"
"error processing column a_type"
"error processing column a_type"

error_column has below data:
"abc",123334,"jdjjd"
"jdjd",2344,"djjd"
"djjd",234,"kkfkf"

at last data should :

error processing column a_type -"abc",123334,"jdjjd"
error processing column a_type - "jdjd",2344,"djjd"

so on ...

"a_type" column name error_column table

i trying achieve using cursors .

declare     cursor c_log  select * error_description error_data_log like'error%' order error_data_log;    r_log error_description %rowtype;    v_error varchar2(1000);     cursor c_dsc select * error_column; r_dsc error_column%rowtype; begin   open c_log;     loop          fetch c_log v_error;            open c_dsc ;               fetch c_dsc r_dsc                dbms_output.put_line( 'error is'||v_error||'-'||r_dsc.xyz);   close c_dsc ;   end loop;    close c_log;    end ; 

i not able desired result .

r_dsc.xyz column defined record type

can 1 tell how can above result.

i prefer not use cursor when can achieve result simple queries, can result mentioned below join using substr function:

select d.val || substr(d.val,24) || c.val2 || c.val3 error_description d join error_column c on substr(d.val,24)=c.val1 

assuming structure is: error_description(val), error_column(val1,val2,val2) according sample data provided.

edit:(after comments , edit of question) if don't have specific formula or pattern join , want join them on base of number of recor use rownum within subquery:

select d.val || '-' || c.val1,c.val2,c.val3 (select rownum rn,val error_description) d join (select rownum rn,val1,val2,val3 error_column) c on d.rn=c.rn 

Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -