How to delete the indexes of a table using routine

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
Madhu1981
Participant
Posts: 69
Joined: Wed Feb 22, 2006 7:49 am

How to delete the indexes of a table using routine

Post by Madhu1981 »

Hi

I have to delete the indexes of a table using routines. Can anyone help me... please
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Post by narasimha »

Write a script which will drop indices.
Execute this script in your routine!
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Or you can do it in the OPEN command of a database stage. And how exactly are you going to do it in a routine? Are you planning do use a Basic Transformer?
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Re: How to delete the indexes of a table using routine

Post by chulett »

Madhu1981 wrote:I have to delete the indexes of a table using routines.
No, you don't. You may need to drop them but why do you believe that you 'need' to do this in a routine?

As noted, the OPEN command is a more appropriate place for commands of that nature. Another solution, seeing as how most users would not have the privledges needed for this, would be the creation of procedure under a user that does and then grant your user the ability to execute it.

You'll need to rebuild them once you are done.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Craig beat me to it.

Always challenge unreasonable and preposterous requirements.

Surely if you can drop indexes without a routine, that is more efficient? How good are your C++ skills? What resources do "they" have for maintaining routines?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Madhu1981
Participant
Posts: 69
Joined: Wed Feb 22, 2006 7:49 am

Post by Madhu1981 »

DSguru2B wrote:Or you can do it in the OPEN command of a database stage. And how exactly are you going to do it in a routine? Are you planning do use a Basic Transformer?
Hi Guru...

could you explain me in detail. I haven't used this OPEN command in database stage. Can you tell me the syntax of this open command also.

Thanks in advance
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Its in the database stage. Syntax will be the same as you would use in your favourite sql tool. OPEN command will run only once when the connection to the database opens, before the main sql. You just need to drop index <<index_name>> on <<table_name>> . Search in google for the exact syntax for your database.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The syntax for OPEN and CLOSE command is "any valid SQL".

"Valid" includes your having appropriate database/table privileges to execute the said command.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

What is the stage you are using to load the data.
Oracle Enterprise stage has "Index mode" as a option, where you can select "Rebuild". Where these drop and recreate will be taken care by Datastage.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Post Reply