Home » SQL & PL/SQL » SQL & PL/SQL » How Can I Execute Table Name in Order without using ORDER BY Clayuse (Oracle11g)
How Can I Execute Table Name in Order without using ORDER BY Clayuse [message #668751] Tue, 13 March 2018 07:35 Go to next message
ssyr
Messages: 50
Registered: January 2017
Member
Hi All,

My requirement is I have 1 table containing all table names information .But when I have selecting data from that table I have to execute some base table at last how can I do this?

Please suggest some help on this?

Thanks in advance.

  Table Trans:
  Data :
  Table_name   Col_name 
  AA            Name
  CC            ADD
  ZX            DA
  BOOKED        FFF
  SM_BOOKED     ggg
 
 I am forming DELETE SQL from above table .But I have some conditions that some talbes should be executed at last of all DELETE SQL .
Ex.  first DELETE 
DELETE AA
DELETE CC
DELETE BB
DELETE SM_BOOKED
DELTE BOOKED
How Can I do this? Means I have to execute in some Table Order not Alphabetical Order
Re: How Can I Execute Table Name in Order without using ORDER BY Clayuse [message #668752 is a reply to message #668751] Tue, 13 March 2018 07:49 Go to previous messageGo to next message
BlackSwan
Messages: 26192
Registered: January 2009
Location: SoCal
Senior Member
It is a fatally flawed "design" that stores table names or column names in columns to be used as input for dynamic SQL

I refuse to contribute & be complicit in fostering such a horrendous implementation.
Re: How Can I Execute Table Name in Order without using ORDER BY Clayuse [message #668763 is a reply to message #668752] Tue, 13 March 2018 09:40 Go to previous messageGo to next message
cookiemonster
Messages: 13279
Registered: September 2008
Location: Rainy Manchester
Senior Member
You'll need a column to indicate the order of course.
Re: How Can I Execute Table Name in Order without using ORDER BY Clayuse [message #668765 is a reply to message #668751] Tue, 13 March 2018 10:07 Go to previous messageGo to next message
John Watson
Messages: 7618
Registered: January 2010
Location: Global Village
Senior Member
If you set your foreign key constraints to deferred and then do all the DELETEs in one transaction, the order shouldn't matter.
Re: How Can I Execute Table Name in Order without using ORDER BY Clayuse [message #668772 is a reply to message #668763] Tue, 13 March 2018 23:31 Go to previous messageGo to next message
ssyr
Messages: 50
Registered: January 2017
Member
Thank you for your suggestion.

But how can I do this using column to maintain order .
Re: How Can I Execute Table Name in Order without using ORDER BY Clayuse [message #668775 is a reply to message #668772] Wed, 14 March 2018 04:13 Go to previous messageGo to next message
cookiemonster
Messages: 13279
Registered: September 2008
Location: Rainy Manchester
Senior Member
Order by the column when selecting the data.
Re: How Can I Execute Table Name in Order without using ORDER BY Clayuse [message #668777 is a reply to message #668775] Wed, 14 March 2018 05:37 Go to previous message
msol25
Messages: 396
Registered: June 2011
Senior Member
Hi,

Order not matter when your foreign key constraints is deferred.
Previous Topic: Help required for taking distinct count without using DISTINCT keyword
Next Topic: Help on running difference sql query (2 merged by CM)
Goto Forum:
  


Current Time: Wed Oct 17 16:18:28 CDT 2018