Home » SQL & PL/SQL » SQL & PL/SQL » function
function [message #409098] Fri, 19 June 2009 06:43 Go to next message
ursfriendvinay
Messages: 2
Registered: June 2009
Junior Member
hi
is it possible to create a table inside a function?
thanks in advance
Re: function [message #409099 is a reply to message #409098] Fri, 19 June 2009 06:46 Go to previous messageGo to next message
ThomasG
Messages: 3189
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
Short answer: No.

Longer answer: There are some workarounds to do it, but it is a REALLY, REALLY bad idea in 99.99% percent of cases.

People tend to try to do it because they think it is necessary, but there are always better solutions to the actual problem.

So first tell us what your actual problem/goal is.
Re: function [message #409130 is a reply to message #409099] Fri, 19 June 2009 10:27 Go to previous messageGo to next message
Kevin Meade
Messages: 2101
Registered: December 1999
Location: Connecticut USA
Senior Member
Yes please, I too would like to hear what problem it is you are trying to solve.

I have woked on systems that created tables on the fly. I remember one in particular. The programming team thought that creating tables on the fly was a slick thing. I kept hearing these phrases:

Quote:
They are only work tables.

Quote:
Nobody uses these tables but our app.

Quote:
Its not real data.

Quote:
but we can create one generic piece of code that does all the work.

Of course when they started having performance issues this same development team abdicated their responsibilities and punted to the DBA staff.

One wonders about the code review process the application went through.

Kevin x79427

[Updated on: Fri, 19 June 2009 10:29]

Report message to a moderator

Re: function [message #409164 is a reply to message #409130] Fri, 19 June 2009 15:22 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Hehe.. all too familiar.
Also seen: final step is to get rid of Oracle in favor of MS SQLServer, because Oracle has bad performance..
Re: function [message #409171 is a reply to message #409164] Fri, 19 June 2009 16:50 Go to previous messageGo to next message
ThomasG
Messages: 3189
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
He. Oracle and SQL Server.

Trying to program SQLServer the Oracle way will bring you grief without end, because all the locking stuff that you just forget about in Oracle you have to do by hand. (And all the workarounds you need to do because there is no real exception handling you can use inside procedures)

Trying to program Oracle the way you program SQLServer on the other hand brings this story to mind:

A guy was used to using a ripsaw for years (SQL Server). He got really good at using it, and could all he needed to to with it, and cut down maybe three or four trees an hour.

One day he buys a chain saw (Oracle). But it was just not working out. He took an entire day just to cut down one tree. So he returns it to the shop and complains it doesn't work. The salesman is surprised and starts it up to check. And the guy goes "Hey, what is that sound?"

Laughing

Re: function [message #409175 is a reply to message #409171] Fri, 19 June 2009 17:16 Go to previous message
Kevin Meade
Messages: 2101
Registered: December 1999
Location: Connecticut USA
Senior Member
Nice.

Let me re-tell a conversation I had with my boss a year ago.

Quote:
So, Kevin, what did you think about the SQLServer demo for all those upgrades they are delivering in their latest release. You must have an opinion since you are our Oracle guy.

Well boss, I think the stuff they are delivering is great. The deliverables I saw make excellent enhancements to any database.

Quote:
OK, but you seem a bit disappointed.

I am. As great as this stuff is, I don't see anything that is new or different. The fact is, all this "NEW" stuff for SQL Server, Oracle has had for five years or more. Why don't they have anything cutting edge?

Quote:
Well Kevin, you need to understand something. It is all about picking your spot in a market. In one sense, it is actually pretty smart for SQL Server not to have anything at the cutting edge. Someone at MicroSoft decided that they could still sell a lot of SQL Server because they were MicroSoft. They decided to let the leader of the industry bring forth new fuctionality. Then they wait and see what works and who wants it. Then after they see what is successful and profitable, they copy that and forget the rest of the stuff. It really is an excellent business strategy in that sense. Essentially MicroSoft decided long ago that they were happy with SQLServer begin a second place product. There is still a market niche for it and they do not have the massive R&D that Oracle has. For those companies that are happy with going with a second place product for whatever reason, it works for them.


OH... OK Boss... I guess that makes sense. You aren't going to make me learn SQLServer are you?

Quote:
Kev, you are my database guy. I expect you to handle whatever I need. Fortunately we don't need it right now because as you know we are an all Oracle shop.


It was an interesting conversation.

Kevin

[Updated on: Fri, 19 June 2009 17:17]

Report message to a moderator

Previous Topic: Index concept
Next Topic: Different Equals !!!
Goto Forum:
  


Current Time: Sat Dec 10 09:01:23 CST 2016

Total time taken to generate the page: 0.24559 seconds