Home » SQL & PL/SQL » SQL & PL/SQL » anonymous block (oracle 10g)
anonymous block [message #386841] Tue, 17 February 2009 02:43 Go to next message
rajasekhar857
Messages: 500
Registered: December 2008
Senior Member
hi,
is there any other alternative way rather than using a function here in below mentioned way.

BEGIN IF(0=VWIsExists('select count(id) from System Where 1=2')) THEN EXECUTE IMMEDIATE('Update System Set Val = ' || CHR(39) || '6.2.0' || CHR(39) || ' Where Upper(Name) = Upper(' || CHR(39) || 'Database.Version' || CHR(39) || ')' ); END IF; END;
/
Re: anonymous block [message #386850 is a reply to message #386841] Tue, 17 February 2009 02:51 Go to previous messageGo to next message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
You could start by telling us
  1. what vwisexists does.
  2. what you want to do.

MHE
Re: anonymous block [message #386851 is a reply to message #386850] Tue, 17 February 2009 02:55 Go to previous messageGo to next message
rajasekhar857
Messages: 500
Registered: December 2008
Senior Member
vwexists is astored function which returns the value 0.it is like this
CREATE OR REPLACE FUNCTION VWIsExists(PARAMS VARCHAR2) RETURN INT As
TExist INT;
begin
BEGIN
EXECUTE IMMEDIATE(PARAMS) INTO TExist;
EXCEPTION
WHEN NO_DATA_FOUND THEN
RETURN(0);
NULL;
WHEN OTHERS THEN
RETURN(0);
NULL;
END;
RETURN(TExist);
end;
/

now i want an alternative way in doing so rather than a function
Re: anonymous block [message #386854 is a reply to message #386841] Tue, 17 February 2009 03:10 Go to previous messageGo to next message
cookiemonster
Messages: 12403
Registered: September 2008
Location: Rainy Manchester
Senior Member
Alternate way of doing what?
Executing a query?
Checking if a table exists?
Updating a table?

You need to explain a LOT more clearly what it is you are trying to do.
Re: anonymous block [message #386855 is a reply to message #386854] Tue, 17 February 2009 03:12 Go to previous messageGo to next message
rajasekhar857
Messages: 500
Registered: December 2008
Senior Member
yeah i am going to update a table here through that following query,even executing that query too and i am not looking here to check for a table
Re: anonymous block [message #386859 is a reply to message #386855] Tue, 17 February 2009 03:19 Go to previous messageGo to next message
rajasekhar857
Messages: 500
Registered: December 2008
Senior Member
why i am asking is while wrapping the code it is throwing exceptions with that anonymous blocks not with the function.function is working good.
Re: anonymous block [message #386862 is a reply to message #386841] Tue, 17 February 2009 03:20 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
From your previous posts:
BlackSwan wrote on Tue, 17 February 2009 05:35
You need to help us by following the Posting Guidelines as stated below.
http://www.orafaq.com/forum/t/88153/0/
So we can help you & please be consistent & correct in your postings.


Yes, if you are willing to Read The Fine Manual.

BlackSwan wrote on Tue, 10 February 2009 05:58
>iam getting exceptions
Exceptions? What exceptions? I don't see any problem.

You need to help us by following the Posting Guidelines as stated below.
http://www.orafaq.com/forum/t/88153/0/
So we can help you


Michel Cadot wrote on Tue, 10 February 2009 07:55
From your previous topic:
Michel Cadot wrote on Mon, 09 February 2009 07:28
Copy and paste EXACTLY what you did.
Before read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter), use code tags.
Use the "Preview Message" button to verify.
Also always post your Oracle version (4 decimals).

Regards
Michel

Which the same one than this one, so I merged one and the following is still true:
Michel Cadot wrote on Mon, 09 February 2009 12:32
You still didn't post what I asked and how I asked it.

Regards
Michel


And so on.

Regards
Michel

Re: anonymous block [message #386864 is a reply to message #386841] Tue, 17 February 2009 03:21 Go to previous messageGo to next message
cookiemonster
Messages: 12403
Registered: September 2008
Location: Rainy Manchester
Senior Member
It might have helped if you'd said that in the first place.
What exceptions?
Re: anonymous block [message #386869 is a reply to message #386864] Tue, 17 February 2009 03:25 Go to previous messageGo to next message
rajasekhar857
Messages: 500
Registered: December 2008
Senior Member
leave that exceptions i want an alternative way in modifying the anonymous block without a function.can any one guide me in that
Re: anonymous block [message #386877 is a reply to message #386869] Tue, 17 February 2009 03:31 Go to previous message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
The function is not working good. At least, there's no saying whether it works good or not. How can you tell whether an exception has been raised? It would never make it to production at our site. Since you can't be bothered whether your function is returning any significant value or returns 0 as a result of *any* exception, you might as well drop the 'if' in your anonymous block.

MHE
Previous Topic: Automatically converting all numbers to floats
Next Topic: I need to sort the record omiting negative sign.
Goto Forum:
  


Current Time: Sun Dec 04 02:23:29 CST 2016

Total time taken to generate the page: 0.10058 seconds