Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8684641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:21:32+00:00 2026-06-12T22:21:32+00:00

in postresql function we can list table by FOR i IN (SELECT …) CREATE

  • 0

in postresql function we can list table by FOR i IN (SELECT …)

CREATE OR REPLACE FUNCTION f()
  RETURNS trigger AS
$BODY$
DECLARE
table_to_row RECORD;
BEGIN
<<for_loop>>
FOR table_to_row IN SELECT id FROM table1
LOOP
    //do something
END LOOP for_loop;
RETURN NULL;
END;
$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;

How can we do such thing in Oracle 11g?
I need this part

FOR table_to_row IN SELECT id FROM table1
LOOP
   //do something
END LOOP;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T22:21:33+00:00Added an answer on June 12, 2026 at 10:21 pm

    In Oracle you do not have to explicitly declare a cursor loop variable. It implicitly will be of table_name%rowtype data type.

    Here is an example:

    For i in (select col_1, .., col_n
                from your_table)
    loop
      -- do something
    end loop;
    

    Demonstration:

    create table test_1(col1 varchar2(11));
    
    Table created
    
    SQL> insert into test_1(col1) values('data_1');
    
    1 row inserted
    
    SQL> insert into test_1(col1) values('data_2');
    
    1 row inserted
    
    SQL> insert into test_1(col1) values('data_3');
    
    1 row inserted
    
    SQL> commit;
    
    Commit complete
    
    SQL> set serveroutput on;
    
    SQL>begin
      2    for i in (select col1 from test_1)
      3    loop
      4      dbms_output.put_line(i.col1);
      5    end loop;
      6  end;
      7  /
    
    data_1
    data_2
    data_3
    
    PL/SQL procedure successfully completed
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using PostgreSQL 9.1.3 and the following functions: CREATE OR REPLACE FUNCTION cad(INOUT args
On Pavel's page is the following function: CREATE OR REPLACE FUNCTION makedate(year int, dayofyear
I have a PostgresQL function that returns multiple resultsets. I can extract these resultsets
Working solution: CREATE OR REPLACE FUNCTION my_search(tsq tsquery, translation_id integer, lang regconfig, count integer
I am attempting to issue a notification from a PostgreSQL trigger function. I can
I have postgresql (in perlu) function getTravelTime(integer, timestamp), which tries to select data for
I'm writing a function in node.js to query a PostgreSQL table. If the row
Is there an existing function to replace accented characters with unadorned characters in PostgreSQL?
Is there a function in PostgreSQL that can convert a base 10 number like
In PostgreSQL, how can I select some values into a 2D array? For example,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.