Delete table before loading

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

sun786
Participant
Posts: 34
Joined: Mon Feb 07, 2005 5:48 am

Delete table before loading

Post by sun786 »

In px job if i want to delete the table before loading how do we acheive it.
truncate is not working.
Also i dont want to call sqlplus thru unix shell in before job routine..
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Hello Sun786,

it depends upon the database you are using and how you connect. For instance, if you connect straight to Oracle you can use the write method "Replace" which does a "Replace by dropping table and creating new".
sun786
Participant
Posts: 34
Joined: Mon Feb 07, 2005 5:48 am

Post by sun786 »

Yes I am using oracle. Could you give me more details.how to go ahead to implement that.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You might also want to explain what "truncate is not working" means. If it's a permissions problem, I'd be surprised if you could turn around and drop the table. Plus, don't forget you'd lose everything associated with that table when you drop it - grants, indexes, yada yada yada. :shock: Those (if any) would need to be recreated.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

sun786,

in your Px Oracle stage, choose the attribute for write method on the left side, and in the drop-down list on the right you can choose "replace". More details can be found on page 13-12 of the Parallel Job Developer's Guide.
sun786
Participant
Posts: 34
Joined: Mon Feb 07, 2005 5:48 am

Post by sun786 »

Thanks, I will try and let you know.
bchau
Charter Member
Charter Member
Posts: 46
Joined: Tue Jan 18, 2005 7:39 am
Location: Japan
Contact:

Post by bchau »

how do you delete a UniVerse table?
richdhan
Premium Member
Premium Member
Posts: 364
Joined: Thu Feb 12, 2004 12:24 am

Post by richdhan »

Hi,

You can delete the Universe table(Hash file) using DELETE.FILE command.

HTH
Rich
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

No, a Universe table is something else and you would use DROP TABLE on it, from what I recall.
-craig

"You can never have too many knives" -- Logan Nine Fingers
T42
Participant
Posts: 499
Joined: Thu Nov 11, 2004 6:45 pm

Post by T42 »

Now put down that Universe weapon and slowly back away. It's dangerous to manipulate your own project tables directly, even if you think you know what you're doing.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

How you delete a UniVerse table depends solely on how it was created; there are three or four possibilities. Searching the forum will yield all of them.

Never delete a DataStage repository table; they are too difficult to recover. Exception: if you are instructed to do so by support, as part of recovering from an even worse situation, then follow their instructions exactly.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
bchau
Charter Member
Charter Member
Posts: 46
Joined: Tue Jan 18, 2005 7:39 am
Location: Japan
Contact:

Post by bchau »

ray.wurlod wrote:How you delete a UniVerse table depends solely on how it was created; there are three or four possibilities. Searching the forum will yield all of them.
I created the table via a UniVerse stage. I checked the box "Create table in target database". On the Edit DDL tab, I clicked on the "Create DDL" button and did not specify any of the Create table options.

Is there any other documentation on UniVerse tables besides the Server Job Developer's Guide? I've tried to search using several criteria on this forum but do not see anything about the 3 or 4 possibilities of creating/deleting. Perhaps I need more training in forum searches.... :oops:
bchau
Charter Member
Charter Member
Posts: 46
Joined: Tue Jan 18, 2005 7:39 am
Location: Japan
Contact:

Post by bchau »

OK, I think I found it......drop table, not delete table is the magic criteria :)
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

DROP TABLE if created with CREATE TABLE or UV stage

DELETE.FILE if created with CREATE.FILE or with Hashed File stage in account

rm -rf (or DEL /S) if created with mkdbfile or with Hashed File stage in directory (a subsequent DELETE VOC 'hashedfilename' may be required if SETFILE has been used to create a VOC pointer)

Other information can be found in on-line help for the Engine (use the command HELP SQL CREATE TABLE for example in a dssh environment) or in UniVerse manuals that can be downloaded at no charge from IBM's web site
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
bchau
Charter Member
Charter Member
Posts: 46
Joined: Tue Jan 18, 2005 7:39 am
Location: Japan
Contact:

Post by bchau »

ray.wurlod wrote:DROP TABLE if created with CREATE TABLE or UV stage
I was able to DROP TABLE, but it was really ugly how I did it. In the UniVerse stage, I checked the "Create table in target database" again and edited the DDL with DROP Table "tablename". I ran the job to drop the table. It solved my problem. Is this the only way to use the DROP TABLE command (via EDIT DDL tab in UniVerse stage)?


Thanks so much Ray....I apologize for making you dig everything up for me. I'm quite new to this forum and it seems like you would be a great ally to have.
Post Reply