Discussions
Categories
- 385.5K All Categories
- 5.1K Data
- 2.5K Big Data Appliance
- 2.5K Data Science
- 453.4K Databases
- 223.2K General Database Discussions
- 3.8K Java and JavaScript in the Database
- 47 Multilingual Engine
- 606 MySQL Community Space
- 486 NoSQL Database
- 7.9K Oracle Database Express Edition (XE)
- 3.2K ORDS, SODA & JSON in the Database
- 584 SQLcl
- 4K SQL Developer Data Modeler
- 188K SQL & PL/SQL
- 21.5K SQL Developer
- 45 Data Integration
- 45 GoldenGate
- 298.4K Development
- 4 Application Development
- 20 Developer Projects
- 166 Programming Languages
- 295K Development Tools
- 150 DevOps
- 3.1K QA/Testing
- 646.7K Java
- 37 Java Learning Subscription
- 37.1K Database Connectivity
- 201 Java Community Process
- 108 Java 25
- 22.2K Java APIs
- 138.3K Java Development Tools
- 165.4K Java EE (Java Enterprise Edition)
- 22 Java Essentials
- 176 Java 8 Questions
- 86K Java Programming
- 82 Java Puzzle Ball
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 94.3K Java SE
- 13.8K Java Security
- 208 Java User Groups
- 25 JavaScript - Nashorn
- Programs
- 666 LiveLabs
- 41 Workshops
- 10.3K Software
- 6.7K Berkeley DB Family
- 3.6K JHeadstart
- 6K Other Languages
- 2.3K Chinese
- 207 Deutsche Oracle Community
- 1.1K Español
- 1.9K Japanese
- 474 Portuguese
How to fix this error?
Answers
-
So it means that in_dep_id is valid?
-
The procedure doesn't have any DBMS_OUTPUT in it (anymore) so there will not be any output in the DBMS output buffer.
There are two possible errors:
1) when you pass a NULL
2) when the department doesn't exist.
When you pass in 50, the procedure will complete successfully without exceptions.
If you put a DBMS_OUTPUT after the select count(*), like
sys.dbms_output.put_line ('Count: '||to_char (l_count));
you will see something in the DBMS output buffer (if switched on, of course)
-
Ok, thanks I added dbms.. output and saw the output. Now I have another issue similar to departments. Whenever I test code
create or replace procedure triangles(a in out number, b in out number, c in out number) is ex_invalid_id exception; begin if c is null and a is not null and b is not null then c:=sqrt((b**2)+(a**2)); elsif b is null and a is not null and c is not null then b:=sqrt((c**2)-(a**2)); elsif a is null and b is not null and c is not null then a:= sqrt((c**2)-(b**2)); else RAISE ex_invalid_id; ---raise_application_error(-20000,'Undefined triangle'); end if; EXCEPTION WHEN ex_invalid_id THEN dbms_output.put_line('ORA-20000: Undefined triangle'); end triangles;
After testing I am getting this error:
DESCRP: Consider right triangle with legs A and B and hypotenuse C. Create a procedure with parameters A, B and C for
calculating length of one of the triangle sides. When calling the procedure any two parameters should contain values
while the third one should be NULL. The procedure should calculate the missing length and return it via the
respective parameter-A, B or C – the one which initially was NULL. If more than one parameter is passed as NULL
the procedure should raise an error: ORA-20000: Undefined triangle
Hint: Pythagorean theorem: a2+b2=c
2
-
So as those parameters are of type in/out you need to provide variables where the result of the procedure can be stored in instead of passing literals.
declare l_variableA number := 5; ... begin triangles (a => l_variableA, ...); sys.dbms_output.put_line('A : ' || to_char(l_variableA)); ... end;
and please ... do not open one thread to ask x questions ...
-
... isn't it time to close this thread and start a new one?
-
Thanks
-
Did you change the subject?
I see there are 30 more replies or so, after my last one. I thought you were close to an answer already. Now I see a lot of new replies and code that seem to have absolutely nothing to do with your original question.
If that is indeed so, then please read again the "rules of the game". If you have a different question, don't post it in a thread that was about something else - start a different thread.
-
Ok I see, thanks, I try follow the rules.
-
I have checked above code and I always getting : raise_application_error(-20001,'Null parameter is passed.')?