mardi 15 août 2017

Comparing two fields( If Statement) in Stored Proceedure SQL

I have two different tables in SQL Developer.. TB_Temp and TB_Main. I want to compare just two fields in these tables, so eg. I want to compare the user_id field in tb_temp and the user_payment field in tb_main.. both these tables have been imported using excel files. If there is a match, I want it to for instance, Output just a debug using dbms_output logging..so far I have; Its the comparison part I struggle with in the If Statment

create PROCEDURE PR_TEST AS

user_payment number;

CURSOR c is
SELECT user_payment 
FROM tb_main;

CURSOR tmp is

SELECT * 
FROM tb_temp
WHERE user_ref is null or user_ref = user_payment

cTemp%ROWTYPE

BEGIN

--loop through cursor---

 cTemp_COUNT:=0;

 FOR I IN cTemp LOOP

 end loop

Aucun commentaire:

Enregistrer un commentaire