Home » SQL & PL/SQL » SQL & PL/SQL » Creating custom error message (Oracle 10g)
Creating custom error message [message #582988] Wed, 24 April 2013 08:29 Go to next message
konvictx
Messages: 6
Registered: April 2013
Location: Pakistan
Junior Member
hy iam trying to create my own error message but when ever i used sp_addmessage it gives error sp2-0734 unknown command biggning... what to do??


[EDITED by LF: fixed topic title typos; was "creating coustum error messagw", "sql oracal 10g"]

[Updated on: Fri, 26 April 2013 00:08] by Moderator

Report message to a moderator

Re: creating coustum error messagw [message #582989 is a reply to message #582988] Wed, 24 April 2013 08:35 Go to previous messageGo to next message
Michel Cadot
Messages: 58573
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Where do you want to create an error message?
"sp_addmessage" is not an Oracle function.
"sp2-0734" is an SQL*Plus error message that seems to indicate you want to execute this procedure in it.
If "sp_addmessage" is a custom PL/SQL function you have to execute it in SQL*Plus using the "execute" command or in a PL/SQL block.

ALWAYS copy and paste what you did or got so that we can also see.
Before, Please read OraFAQ Forum Guide and How to use [code] tags and make your code easier to read.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code, use code tags and align the columns in result.
Use the "Preview Message" or "Preview Quick Reply" button to verify.
Also always post your Oracle version, with 4 decimals.

Regards
Michel
Re: creating coustum error messagw [message #582990 is a reply to message #582989] Wed, 24 April 2013 08:39 Go to previous messageGo to next message
konvictx
Messages: 6
Registered: April 2013
Location: Pakistan
Junior Member
i want to creat it on sql command line oracal 10 g
Re: creating coustum error messagw [message #582991 is a reply to message #582989] Wed, 24 April 2013 08:41 Go to previous messageGo to next message
konvictx
Messages: 6
Registered: April 2013
Location: Pakistan
Junior Member
./fa/10761/0/./fa/10761/0/hope this will help
  • Attachment: sql.png
    (Size: 35.70KB, Downloaded 222 times)

[Updated on: Wed, 24 April 2013 08:42]

Report message to a moderator

Re: creating coustum error messagw [message #582992 is a reply to message #582991] Wed, 24 April 2013 08:57 Go to previous messageGo to next message
ThomasG
Messages: 3089
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
Well, you have to make up your mind:

1) Do you want to use Oracle?
--- Then you can't use sp_addmessage.

2) Do you want to use sp_addmessage?
--- Then you can't use Oracle, you have to use Microsoft SQLServer.

Choose 1) or 2)

[Updated on: Wed, 24 April 2013 08:58]

Report message to a moderator

Re: creating coustum error messagw [message #582993 is a reply to message #582992] Wed, 24 April 2013 08:59 Go to previous messageGo to next message
konvictx
Messages: 6
Registered: April 2013
Location: Pakistan
Junior Member
so how can i create my own error message? in oracal sql???
Re: creating coustum error messagw [message #582994 is a reply to message #582993] Wed, 24 April 2013 09:02 Go to previous messageGo to next message
Michel Cadot
Messages: 58573
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
1/ You MUST not post an image for text
2/ An error message for what?
3/ To create a function use CREATE FUNCTION.

I advice you to read:
SQL*PlusĀ® User's Guide and Reference
Database SQL Reference
PL/SQL User's Guide and Reference
Application Developer's Guide - Fundamentals

You cannot expect Oracle will understand your own syntax.

Regards
Michel

[Updated on: Wed, 24 April 2013 09:02]

Report message to a moderator

Re: creating coustum error messagw [message #582995 is a reply to message #582994] Wed, 24 April 2013 09:07 Go to previous messageGo to next message
konvictx
Messages: 6
Registered: April 2013
Location: Pakistan
Junior Member
look just like we ge line 1 error or command line missing error these all are the predefined error messages. i just want to make user define error.
i searched in the form it gives sp_addmessage(mesgnum,severity,msgtext)
i tried this but nothing happen?
Re: creating coustum error messagw [message #582996 is a reply to message #582995] Wed, 24 April 2013 09:28 Go to previous messageGo to next message
ashwani0301
Messages: 44
Registered: March 2013
Location: Karnatka, Bangalore
Member
HI konvictx,

Quote:
i searched in the form it gives sp_addmessage(mesgnum,severity,msgtext)

This is for SQL server not for Oracle database.

Quote:
i am trying to create my own error message

What is called creating error message? Smile

If you really want to do please read the documents provided by @Michel Cadot

Thanks
Re: creating coustum error messagw [message #582997 is a reply to message #582996] Wed, 24 April 2013 09:30 Go to previous messageGo to next message
konvictx
Messages: 6
Registered: April 2013
Location: Pakistan
Junior Member
thanks alot...... i read that but still same error Sad
Re: creating coustum error messagw [message #582999 is a reply to message #582997] Wed, 24 April 2013 09:38 Go to previous messageGo to next message
BlackSwan
Messages: 22500
Registered: January 2009
Senior Member
Please read and follow the forum guidelines, to enable us to help you:

http://www.orafaq.com/forum/t/88153/0/
Re: creating coustum error messagw [message #583000 is a reply to message #582997] Wed, 24 April 2013 10:33 Go to previous messageGo to next message
Michel Cadot
Messages: 58573
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
konvictx wrote on Wed, 24 April 2013 16:30
thanks alot...... i read that but still same error Sad


You read 4 books in half an hour? Wooo! You are the world champion.
Read, understand and apply, you are too far from being able to do anything with Oracle.

Regards
Michel

Re: creating coustum error messagw [message #583111 is a reply to message #583000] Thu, 25 April 2013 23:59 Go to previous message
Barbara Boehmer
Messages: 7935
Registered: November 2002
Location: California, USA
Senior Member
In Oracle, errors are referred to as exceptions and you create custom messages in functions and procedures that apply to only those functions and procedures. Please read the following section of the online documentation, paying particular attention to user-defined exceptions and raise_application_error.

PL/SQL Error Handling
Previous Topic: FIFO Store Consumption
Next Topic: how to execute the type variable procedure.
Goto Forum:
  


Current Time: Fri Jul 25 15:01:32 CDT 2014

Total time taken to generate the page: 0.46600 seconds