Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2003
    Posts
    3

    Unanswered: DBMS_OUTPUT question

    Hi,

    I'm currently working on a project for my Database Management class working with PL/SQL (Oracle 9i) which concerns the use of explicit cursors.

    Basically, I have to use an explicit cursor to select two values from three different tables and display them. I think I've got the basic idea of how it works but I'm having issues with displaying the actual results in SQL*Plus.

    So far, I'm only working with one variable from one table until I can get this problem solved.

    ------- Here's what I have now:

    DECLARE
    CURSOR project_cursor IS
    SELECT customerid
    FROM Customer;
    project_row project_cursor%ROWTYPE;
    BEGIN
    FOR project_row IN project_cursor LOOP
    DBMS_OUTPUT.PUT_LINE('Blah Blah');
    END LOOP;
    END;
    /

    ----

    I get no output from that and only get
    "PL/SQL Procedure successfully completed"

    Any ideas? I'm fairly desperate here. I've been working on this for the past few days and it's due tomorrow. I don't wanna sit around here pulling my hair out anymore so I thought I might try seeking a little expert advice =)

    Thanks!

  2. #2
    Join Date
    Nov 2003
    Posts
    3
    I found the problem!

    I never did "set serverouput on".. I feel like an idiot =)

  3. #3
    Join Date
    Nov 2003
    Posts
    3
    Ok.. I have a different question.

    I'm trying to nest a FOR loop inside of an IF statement and can't figure out how to encapsulate the statement.

    For other languages I have used, it's usually bracketed but it doesn't seem to work here. Is this even possible?

    Example:

    IF project_p.loanid = '10011' THEN
    (
    FOR project_p IN project_payment LOOP
    DBMS_OUTPUT.PUT_LINE(project_p.payment);
    END LOOP;
    )
    ELSE EXIT;
    END IF;

  4. #4
    Join Date
    Nov 2003
    Location
    Bangalore, INDIA
    Posts
    333

    Thumbs up

    U can nest a FOR loop inside of an IF statement and there's no need for brackets.


    IF project_p.loanid = '10011' THEN
    FOR project_p IN project_payment LOOP
    DBMS_OUTPUT.PUT_LINE(project_p.payment);
    END LOOP;
    ELSE
    EXIT;
    END IF;
    SATHISH .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •