0
create or replace procedure NrCopii2 (NrNume varchar2)
as
  NrNume COPIL.nume%type;
begin
  select count(nume) from Copil
  dbms_output.put_line(NrNume);
end;
/
0

2 Answers 2

1

There are some typoes need to be fixed :

  • add into NrNume (just before from) and add ; to the end of that statement presuming the data type of nume column is plain number or integer, otherwise you may replace copil.nume%type with int too
  • either remove NrNume parameter of the procedure or local variable NrNume while replacing NrCopii2 (NrNume varchar2) with NrCopii2 (NrNume out varchar2), those have same names, and one of them should be preferred to use

PS. don't forget to issue set serveroutput on whenever the procedure is invoked, in order to display the value returned for NrNume

As a result, the following code block might be used

SQL> SET SERVEROUTPUT ON
SQL> CREATE OR REPLACE PROCEDURE NrCopii2 AS
  NrNume INT;
BEGIN
  SELECT COUNT(nume) INTO NrNume FROM Copil;
  DBMS_OUTPUT.PUT_LINE(NrNume);
END;
/
Sign up to request clarification or add additional context in comments.

1 Comment

you can pls show how its need to look the code because I'm pretty bad and i can't understand the second point pls if need i can show the data base
0

You can make anonymous procedure as well.

DECLARE
  NrNume COPIL.nume%type;
BEGIN
  
  SELECT count(nume) INTO NrNume
  FROM Copil;
  
  dbms_output.put_line(NrNume);
END;
/

1 Comment

Can u make it in a procedure pls ?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.