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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:19:55+00:00 2026-06-14T01:19:55+00:00

I am trying to print the TEXT when condition is TRUE. The select code

  • 0

I am trying to print the TEXT when condition is TRUE. The select code is perfectly working fine. It’s showing 403 value when i only run select code. But I have to print some text when condition exists. What’s the problem with following code.

BEGIN
IF EXISTS(
SELECT CE.S_REGNO FROM
COURSEOFFERING CO
JOIN CO_ENROLMENT CE
  ON CE.CO_ID = CO.CO_ID
WHERE CE.S_REGNO=403 AND CE.COE_COMPLETIONSTATUS = 'C' AND CO.C_ID = 803
)
THEN
    DBMS_OUTPUT.put_line('YES YOU CAN');
END;

Here is the error report:

Error report:
ORA-06550: line 5, column 1:
PLS-00103: Encountered the symbol "JOIN" when expecting one of the following:

   ) , with group having intersect minus start union where
   connect
06550. 00000 -  "line %s, column %s:\n%s"
*Cause:    Usually a PL/SQL compilation error.
*Action:
  • 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-14T01:19:57+00:00Added an answer on June 14, 2026 at 1:19 am

    IF EXISTS() is semantically incorrect. EXISTS condition can be used only inside a SQL statement. So you might rewrite your pl/sql block as follows:

    declare
      l_exst number(1);
    begin
      select case 
               when exists(select ce.s_regno 
                             from courseoffering co
                             join co_enrolment ce
                               on ce.co_id = co.co_id
                            where ce.s_regno=403 
                              and ce.coe_completionstatus = 'C' 
                              and ce.c_id = 803
                              and rownum = 1
                            )
               then 1
               else 0
             end  into l_exst
      from dual;
    
      if l_exst = 1 
      then
        DBMS_OUTPUT.put_line('YES YOU CAN');
      else
        DBMS_OUTPUT.put_line('YOU CANNOT'); 
      end if;
    end;
    

    Or you can simply use count function do determine the number of rows returned by the query, and rownum=1 predicate – you only need to know if a record exists:

    declare
      l_exst number;
    begin
       select count(*) 
         into l_exst
         from courseoffering co
              join co_enrolment ce
                on ce.co_id = co.co_id
        where ce.s_regno=403 
          and ce.coe_completionstatus = 'C' 
          and ce.c_id = 803
          and rownum = 1;
    
      if l_exst = 0
      then
        DBMS_OUTPUT.put_line('YOU CANNOT');
      else
        DBMS_OUTPUT.put_line('YES YOU CAN');
      end if;
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to print a particular text using awk if string is empty.
I'm trying to figure out how to get text to print sideways in a
I am trying to print out true if there is such letter/word and false
I am trying to print a table inside an e-mail using plain text. I
I was trying to print some text between <textarea> and </textarea> tags, but I've
I'm trying to read a text file line-by line. I added a condition where
I am trying to print (to a text file) the fragmentation information give by
I am trying to pull a value (only) from some XML in Python using
this piece of code is driving me crazy. I'm trying to print a help
I am trying to print a text file with tab characters in it. The

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.