sql - Comparing two columns in an IF statement in a stored procedure in Oracle -
i have 2 different tables in sql developer, tb_temp , tb_main. want compare 2 columns these tables, eg. want compare user_id column in tb_temp , user_payment column in tb_main.
both these tables have been imported excel files. if there match, want instance, output debug using dbms_output logging.
so far have; comparison part struggle if statement! 2 tables contain values uploaded new information, therefore getting @ cant declare values stored in table, changing if makes sense? need know if columns match, there needs output!
create procedure pr_test user_payment number; cursor c select user_payment tb_main; cursor tmp select * tb_temp user_ref null or user_ref = user_payment ctemp%rowtype begin --loop through cursor--- ctemp_count:=0; in ctemp loop end loop
do know joins , ref_cursors output? note: when playing imported data, may have non-display characters such space. if user_payment '123' , user id '123 ' no match found.
shows details both tables user_payment matches user_id
select * tb_main m inner join tb_temp t on m.user_payment = t.user_id shows records both tables , when matches exist shows records aligned (on same row) eachother if multiple matches occur, multiple rows produced.
select * tb_main m full outer join tb_temp t on m.user_payment = t.user_id shows records tb_main , details if matches tb_temp
select * tb_main m left join tb_temp t on m.user_payment = t.user_id shows records tb_temp , details if matches tb_main
select * tb_main m right join tb_temp t on m.user_payment = t.user_id
Comments
Post a Comment