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

  • Home
  • SEARCH
  • 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 8034833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:08:18+00:00 2026-06-05T02:08:18+00:00

I got this stored procedure in oracle create or replace procedure mayor_sueldo as cursor

  • 0

I got this stored procedure in oracle

create or replace
procedure mayor_sueldo
as
  cursor c_depto is select deptno from dept;
  c_deptno dept.deptno%type;
  c_empno number;
  c_ename emp.ename%type;
  c_job emp.job%type;
  c_sal emp.sal%type;
begin
  open c_depto;
  fetch c_depto into c_deptno;
  while ( c_depto%found )loop
    select empno, ename, job, sal into c_empno, c_ename, c_job, c_sal from emp where sal = (select max(sal) from emp where(deptno = c_deptno) );
    dbms_output.put_line( c_empno||'-'||c_ename||'-'||c_job||' '||c_sal );
    fetch c_depto into c_deptno;
  end loop;
close c_depto;
end;

the problem is inside the query inside the while block if the query returns one and only one row there is no problem but what about when the query return more than one row i was thinking that i could use another cursor but idk how.
please help me

  • 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-05T02:08:19+00:00Added an answer on June 5, 2026 at 2:08 am

    maybe this will help: for _row in (select ....) loop dbms_output(_row.a || ..); end loop;

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a stored procedure which runs this to create a new ticket number:
I've got a mySql stored procedure that looks like this-- delimiter | create procedure
I'm using the Oracle command dbms_output.get_line to retrieve output from a stored procedure. Once
I got an error invalid Object SubSkillIds while executing this in a stored procedure?
I've got a very simple stored procedure : create procedure spFoo(v varchar(50)) as insert
I've got various flash files stored on my server. For this exmaple - here
Got this as an interview question from Amazon to test basic SQL skills and
Got this code for a viewscroller from the apple developers site. @synthesize scrollView1, scrollView2;
I need some help in combining a stored procedure with another function. I've got
i got this Table: CREATE TABLE Test_Table ( old_val VARCHAR2(3), new_val VARCHAR2(3), Updflag NUMBER,

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.