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 6644105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:07:43+00:00 2026-05-26T00:07:43+00:00

I am somewhat new to PL/SQL, and am having a little trouble using a

  • 0

I am somewhat new to PL/SQL, and am having a little trouble using a cursor that I created. I am writing a procedure that sends emails to particular people. Here is the relevant code:

sql stmt := ' -- All my sql is in here -- ';

open email_cursor for sql stmt;
fetch email_cursor into term, award, desc, id, name, xmdt;

.....


if v_id is not null then
    email_adr := schema1.get_email_adr(v_id);   --This is partly where problem is.

    if v_opt_ltr = 'Y' then       --a variable that decides if an email should be sent

                  UTL_MAIL.SEND (sender => email_from,
                       recipients => email_adr,
                       subject => v_email_subject,
                       mime_type => 'text/html',
                       message => email_body );

    END IF;

END IF;

Okay, so I dont get any errors or anything when I run this, but for some reason when I run the function for the email_adr variable it fails, and doesnt give me anything, and in turn wont send an email.

Another question (because I am new to cursors): The v_id in the cursor should have about 25 records, if I run the line “stu_email := schema1.get_email_adr(v_id);” will this give me all 25 records, and then will the “utl_mail.send” send an email to all the recipients?

  • 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-05-26T00:07:43+00:00Added an answer on May 26, 2026 at 12:07 am

    As I understand it, you cursor is inside the get_email_adr function, is that right? Althought none of those variables looks obviously like an email address, so I’m a little confused.

    If so then it all depends on how the code inside the get_email_adr function works. Every time you open a cursor it “resets” it. So if you want to combine all 25 records you’ll need to have some code for it. Something like this:

    FUNCTION get_email_adr( f_id IN NUMBER ) RETURN VARCHAR2 IS
        result VARCHAR2(32000);
        CURSOR cur_email ( c_id IN NUMBER ) IS
            SELECT email_address FROM some_table WHERE id = c_id;
    BEGIN
        FOR rec IN cur_email( f_id )
        LOOP
            IF( result IS NULL )
            THEN
                result := rec.email_address;
            ELSE
                result := result || ',' || rec.email_address;
            END IF;
        END LOOP;
        RETURN result;
    END get_email_adr;
    

    Does that kind of answer you question or have I missed the point entirely?

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

Sidebar

Related Questions

I'm somewhat new to using XML in sql server, and am having a problem
I'm somewhat new to SQL queries, and I'm struggling with this particular problem. Let's
Somewhat new to SQL queries and I need a little help with my join.
I am somewhat new to writing sql, and I know I can write a
This is somewhat new territory for me. I'm using MVC3 with SQL CompactEdition version
I'm somewhat new to SQL and need help with query syntax. My issue involves
I have a SQL question that I could use some help with. Still somewhat
I'm somewhat new to OOP with C++, so I'm hoping that I've just made
I am still somewhat new to Linq to SQL. I am looking for a
I have a somewhat simple query in SQL that I would like to convert

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.