I have next 3 tables:
I have to populate the FiboPrime table, with the prime numbers from Fibonacci table (prime=1 => the number is prime, else the number is not prime.)
I have to use MERGE statement and it is attempt:
DECLARE
BEGING
MERGE INTO FiboPrime fp
USING fibonacci f, prime p
ON (f.value=p.value)
WHEN MATCHED THEN
UPDATE SET
fp.value=f.value,
fp.prime=1;
WHEN NOT MATCHED THEN
INSERT VALUES(f.value,0);
END;
I get the next error: Econtered the symbol "INTO" when expecting one of the following: := .( @ ; not null range character. Who can help me to solve it?
DECLARE
BEGING
You don't need the keyword DECLARE
, since you don't have anything to declare.
The keyword is BEGIN
and NOT BEGING.
Modify the USING
clause to a SELECT
query. For example:
USING (select t1.col1,t2.col2 from t1,t2)
MERGE
as SQL. No need of wrapping it with BEGIN-END
block.