For Loop in PL/SQL
NickName:Bharat Ask DateTime:2014-09-18T16:24:54

For Loop in PL/SQL

I am new to PL/SQL. I have a scenario where we have one staging table STG_MAIN_CF_EVENT. It has the information that needs to be loaded into two different tables: CUSTOMER_FEEDBACK_STG and CF_EVENT_STG.

For every record in STG_MAIN_CF_EVENT, I need to create a primary key in CUSTOMER_FEEDBACK_STG and insert into this.

Can someone let me know how to achieve this in For looping dynamically.

Copyright Notice:Content Author:「Bharat」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/25907682/for-loop-in-pl-sql

More about “For Loop in PL/SQL” related questions

PL/SQL While Loop

I am a beginner in PL/SQL. I want to run simple WHILE LOOP and I am receiving errors. Here is my code: DECLARE counter INTEGER := 01; BEGIN WHILE counter <= 30 LOOP SELECT name, cou...

Show Detail

Dynamic loop in PL/SQL

I am currently looping through values in PL/SQL with the following: for c in (select * from example_table where name is not null) loop -- logic end loop; I would like to replace the SQL

Show Detail

Loop through PL/SQL Row

I'm searching for a long time for some way to iterate through PL/SQL row, but I did not get any appropriate results. For example, if I have a PL/SQL row that looks like this row(first_name,last_n...

Show Detail

PL/SQL Trigger with a cursor and loop

I'm very new to PL/SQL and i'm trying to have a DBMS output on the console of the total amount of cars for each brand. I've been breaking my head over this but don't seem to get out of it... What ...

Show Detail

PL/SQL: Concat string in a loop

I want to exec a CURSOR in SQL*Plus, but I'm getting this error message : ORA-06502: PL/SQL: numeric or value error: character string buffer too small ORA-06512: at line 11 This is my PL/SQL ...

Show Detail

Pl/SQL Procedure CURSOR For Loop

I am new to PL/SQL and experimenting with CURSOR. I desire to verify an insertion procedure so I wrote another procedure to do so. CREATE OR REPLACE PROCEDURE verify_insert IS CURSOR map_cur...

Show Detail

For In loop in Oracle PL/SQL

In PL/SQL, I can use a FOR IN loop to iterate from 1-20 by saying: FOR counter IN 1..20 What I'm wondering is, is there a simple alteration I can make to this that will allow me to iterate throug...

Show Detail

PL/SQL nested loop (loop within a loop)

Below is a PL/SQL I'm working on declare v_sql varchar2(500); BEGIN for t in ( SELECT distinct ID FROM TABLEB ) loop for c in ( select * from ( select 'delete...

Show Detail

For loop and columns in PL/SQL

I am new in PL/SQL. I have a problem with loop in this language. I' d like to make loop like this: FOR nr IN 1..102 LOOP DBMS_OUTPUT.PUT_LINE(nr); IF rec.column_||nr IS NULL THEN

Show Detail

Oracle PL/SQL loop issue

Hey guys trying to use a loop to cycle though days so my script doesn't fail the loop fails to execute each time I am not sure what I am doing wrong however i know for a fact the select statement i...

Show Detail