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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:44:07+00:00 2026-05-31T11:44:07+00:00

I have the following procedure: CREATE OR REPLACE PROCEDURE My_Procedure AS CURSOR proced IS

  • 0

I have the following procedure:

CREATE OR REPLACE PROCEDURE My_Procedure
AS
CURSOR proced IS
SELECT aID FROM A;
BEGIN
FOR row IN proced LOOP
INSERT INTO AQ VALUES (row.aID, AQ_NT(AQT('',NULL, '', '')));
DELETE TABLE (SELECT Q FROM AQ) AQT WHERE AQT.Year=NULL;
END LOOP;
END My_Procedure;
/

And the procedure creates fine, but I have a problem in executing it, I am using the following command:

EXECUTE My_Procedure;

But i get the following error:

ERROR at line 1:
ORA-01427: single-row subquery returns more than one row
ORA-06512: at “SMITH. My_Procedure”, LINE 8
Ora-06512: at line 1

I have been at this for weeks, I am 100% sure the command for the execute is correct. And ORACLE 10G creates the procedure fine so please can you provide help which I can solve this problem.

Thank You so much

  • 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-31T11:44:09+00:00Added an answer on May 31, 2026 at 11:44 am

    Your procedure only works if input table A contains one row.

    With DELETE TABLE() you are trying to delete some rows from the nested table (AQ.Q), but the DELETE TABLE() works only if you provide one, and only one, nested table (that is, one row of AQ that contains one nested table AQ.Q, that possibly contains many nested rows or zero nested rows). In other words, DELETE TABLE(blabla) only works if blabla returns a single-row, single-column result.

    Once you have two rows inserted into AQ, your sub-query (SELECT Q FROM AQ) returns two rows and you have an ORA-01427 error.

    Side note: Repeating after A.B.Cade’s comment, AQT.Year=NULL will give misleading results in SQL, because NULL=NULL does not hold true. Better use AQT.Year IS NULL.

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

Sidebar

Related Questions

I have the following procedure: CREATE PROCEDURE foo () SELECT * FROM fooBar INTO
I have the following Java stored procedure: CREATE OR REPLACE AND RESOLVE JAVA SOURCE
I have the following SP: CREATE PROCEDURE [dbo].[sp_LockReader] AS BEGIN SET NOCOUNT ON; begin
Actually i have created following procedure,which is working fine. CREATE or REPLACE PROCEDURE GET_NOS(
I have a following stored procedure CREATE PROCEDURE [dbo].[MyStored] @state int AS SELECT blahblahblah
I have the following insert stored procedure: CREATE Procedure dbo.APPL_ServerEnvironmentInsert ( @ServerEnvironmentName varchar(50), @ServerEnvironmentDescription
I have the following SP CREATE PROCEDURE GetAllHouses set @webRegionID = 2 set @sortBy
I have created the following stored procedure.. CREATE PROCEDURE [dbo].[UDSPRBHPRIMBUSTYPESTARTUP] ( @CODE CHAR(5) ,
All, I have the following Package Description: CREATE OR REPLACE PACKAGE ashish.PKG_Customer AUTHID CURRENT_USER
i have a simple oracle stored procedure proc1 as follows: CREATE OR REPLACE PROCEDURE

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.