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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:51:17+00:00 2026-06-12T17:51:17+00:00

Good Day, I have a PL-SQL query as follows. I’m trying to execute a

  • 0

Good Day,

I have a PL-SQL query as follows. I’m trying to execute a query and store the results into a variable. So far I have this query which works:

    SELECT DECODE(COUNT(*), 0, 'N', 'Y') REC_EXISTS
    FROM
         (SELECT 
                COUNT(*) AS TOTAL_COUNT
           FROM DEV.BASEOBJECT INNER JOIN
                DEV.ANIMAL ON DEV.BASEOBJECT.ID = DEV.ANIMAL.BASEOBJECT_ID
       GROUP BY DEV.BASEOBJECT.ID, 
                DEV.BASEOBJECT.FIRST_NAME, 
                DEV.BASEOBJECT.LAST_NAME, 
                DEV.BASEOBJECT.CITY,
                DEV.BASEOBJECT.STATE,
                DEV.BASEOBJECT.ZIP,
                DEV.ANIMAL.ID,
                DEV.ANIMAL.NAME,
                DEV.ANIMAL.BREED, 
                DEV.ANIMAL.DATE_OF_BIRTH, 
                DEV.ANIMAL.GENDER,
                DEV.ANIMAL.SPECIES
         HAVING (COUNT(*) > 1));

But when I try to save the results into a variable with this query:

DECLARE
    v_name  VARCHAR2(2);
BEGIN
    SELECT DECODE(COUNT(*), 0, 'N', 'Y') REC_EXISTS
        INTO v_name
    FROM
         (SELECT 
                COUNT(*) AS TOTAL_COUNT
           FROM DEV.BASEOBJECT INNER JOIN
                DEV.ANIMAL ON DEV.BASEOBJECT.ID = DEV.ANIMAL.BASEOBJECT_ID
       GROUP BY DEV.BASEOBJECT.ID, 
                DEV.BASEOBJECT.FIRST_NAME, 
                DEV.BASEOBJECT.LAST_NAME, 
                DEV.BASEOBJECT.CITY,
                DEV.BASEOBJECT.STATE,
                DEV.BASEOBJECT.ZIP,
                DEV.ANIMAL.ID,
                DEV.ANIMAL.NAME,
                DEV.ANIMAL.BREED, 
                DEV.ANIMAL.DATE_OF_BIRTH, 
                DEV.ANIMAL.GENDER,
                DEV.ANIMAL.SPECIES
         HAVING (COUNT(*) > 1));
END

I get an error:

ERROR
ORA-06550: line 1, column 8:
PLS-00103: Encountered the symbol "" when expecting one of the following:

   begin function package pragma procedure subtype type use
   <an identifier> <a double-quoted delimited-identifier> form
   current cursor
The symbol "" was ignored.    

Eventually, this is going to be a stored procedure, but I don’t have that part ready yet, because I wanted to verify that what I have is working so far.

TIA,

coson

  • 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-12T17:51:19+00:00Added an answer on June 12, 2026 at 5:51 pm

    How are you running this? What tools are you using? I think that the problem is your tool/IDE is trying to compile this as a function/procedure. This code looks ok and would probably run with no problems if you ran it as a script in SQL*Plus. If you run this as a script, you should add a dbmbs_output.put_line(v_name) after the query to see the result.

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

Sidebar

Related Questions

Good Day, I have a sql query that returns the following data: EmployeeID...Employee 555..........John
Good day - several days have passed while i was trying to transport my
Good Day, I have a Hibernate mapping that looks something like this: public class
G'day, OK, I have now rewritten this question totally: I am trying to import
Good day, I have searched far and wide but all I can find is
Good day everyone, so here, I have a problem with my repeater control's SQL
Good day, In SQL Server 2005, I have a table numerous columns, including a
Good day, In SQL Server 2005, when I write a new query, I like
Good day I have a custom TextBox that has a IndicatorTextBox.ui.xml file as well
Good day I wanted to have a general URL to access the Desktop of

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.