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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:57:33+00:00 2026-06-13T05:57:33+00:00

I am new to PL/SQL but have plenty of other SQL experience, including Oracle

  • 0

I am new to PL/SQL but have plenty of other SQL experience, including Oracle (just not so much scripting). I want to declare a numeric (integer) var, set it to a row count, and display it in a sentence-wrapped string. The end goal of this exercise is to have a SQL*Plus script that prints the string “There are 1 rows”.

In SQL*Plus on Unix, I do:

SQL> variable v_dCnt number;
SQL> select count(*) into :v_dCnt from dual;

  COUNT(*)
----------
         1

SQL> select 'There are ' || :v_dCnt || ' rows' as MESSAGE from dual;

MESSAGE 
-------------------------------------------------------
There are  rows

Note how it displays blank for v_dCnt rather than a value of 1

In Rapid SQL on Win7, I do

variable v_dCnt number;
select count(*) into :v_dCnt from dual;
select 'There are ' || :v_dCnt || ' rows' from dual;

and get ORA-01008: not all variables bound

What am I doing wrong?

  • 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-13T05:57:34+00:00Added an answer on June 13, 2026 at 5:57 am

    In SQL*Plus, you most likely just need to put the SELECT INTO in a PL/SQL block

    SQL>  variable v_dCnt number;
    SQL> begin
      2    select count(*)
      3      into :v_dCnt
      4      from dual;
      5  end;
      6  /
    
    PL/SQL procedure successfully completed.
    
    SQL> ed
    Wrote file afiedt.buf
    
      1* select 'There are ' || :v_dCnt || ' rows' from dual
    SQL> /
    
    'THEREARE'||:V_DCNT||'ROWS'
    -------------------------------------------------------
    There are 1 rows
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have extensive experience working in ASP.NET and Sql Server but I am new
I'm rusty in SQL and completely new to SQL Alchemy , but have an
I am new to LINQ to SQL, but have done a lot of database
I have this: var blockRegEx = new Regex((proc sql;)(.*?)(quit;), RegexOptions.IgnoreCase | RegexOptions.Multiline); but it
I have SQL server 2000 dev edition. But it isn't compatible with my new
I am relatively very new to SQL queries but I have this stored procedure
I have a (simplified) Oracle SQL like this: declare xd number; xm number; DataOut
Quite new to this but i have created a SQL script that groups by
I am fairly new to SQL joins, but I have a tricky issue here.
Hi I'm very new to sql but have been passed a job in which

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.