• Post Reply Bookmark Topic Watch Topic
  • New Topic

Deep copy  RSS feed

 
Anant Rao
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I sorry I don't know where to place this topic...bear with me here...

Actually I have flow such as in one jsp it created the project id and name , 2nd jsp it adds the details , 3rd jsp it has some further actions with that project id....so on.

Now , there a copy function in first jsp when i click it , it should create a copy of all the details which are done from 1st to last for that project Id with new project Id and remaining details as it is.

Can anyuone suggest me how it can carried on....is there any simple process. Right now I am calling each select statment and stuff them into insert statement but its going to really big funciton in my service class.

I hope I made myself clear

Any help would be appreciated.

Regards
Infyniti.
 
Scott Selikoff
author
Bartender
Posts: 4093
21
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you have many database connection calls, you should wrap them in a single stored procedure. What is really going to hurt performance isn't usually the number of database commands, but the number of independent calls to the database server.
 
Anant Rao
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think I did not make myself clear

first the project Id and project are add and submitted database. when u ask display all project id it will display the table. At any point of I can add the details. ...and submit which will be inserted into different tables. so on so forth i can add any number of details.. one jsp can call antoher jsp and sumbitt to different tables.that one part which is done.

Now when we dispaly all project id and pick one projectId from the jsp table and say i want to make copy of it with diffrent projectId and same details as entered to the orignal( ie. we are creating a project Id with details not through GUI but through our classes.)I mean I am making duplicate of existing project Id with all its details.

As in cascade delete we pick that project Id and delete all the stuff with referential intergrity. Now I want cascase copy ( i know its not there). I just want better idea instead of calling select statement return a result set and insert back into DTO and to datbase.

Regards
infyniti
[ November 17, 2005: Message edited by: infyniti Molugu ]
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can copy from one table to another with select into. I'm relying on distantly remembered procedures we used in a class, not real experience, so could be wrong. I don't know if you can use that to copy to the same table. Would be interesting. Editing later: One of our db guys says "Maybe, if the primary key is an automatic sequence number and you select all the columns but the key"

Otherwise the select and insert routine sounds straight forward. How bad would that be? Worse than selecting everything to edit and writing it back when you're done?
[ November 17, 2005: Message edited by: Stan James ]
 
Anant Rao
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Stan James , what u said is write even that i worked it out but even proj desc should be added with a ramdom number.

can we concantate in sql....



like projectDesc=technical
so for the duplicate it should be 342342technical(i.e some random number with orgianl name). Any idea

Here is the code how it works for getting nextval.

INSERT INTO Project(project_flag,LAST_UPDT_TIMSTM, LAST_UPDATED_USER_ID,project_ID)
SELECT project_flag,LAST_UPDT_TIMSTM, LAST_UPDATED_USER_ID, (
SELECT MAX(project_ID)+1
FROM project ) project_ID
FROM project WHERE project_ID=501


Regards
infyniti
 
Anant Rao
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thats done

project_DESC||'SOMETHING'

Remaining everything as same


Thanks for the response
Infyniti
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!