4
I need to make a trial copy of my TAB_FORNECEDOR table, everything you have in it and pass to TAB_FORNECEDOR2 table.
I know I need to make a loop cursor, a commit delete before everything, can give me a light on how to assemble my project?
4
I need to make a trial copy of my TAB_FORNECEDOR table, everything you have in it and pass to TAB_FORNECEDOR2 table.
I know I need to make a loop cursor, a commit delete before everything, can give me a light on how to assemble my project?
5
One solution is to create the table from scratch with the data from the previous one:
CREATE TABLE
TAB_FORNECEDOR2
AS
SELECT
*
FROM
TAB_FORNECEDOR;
Recalling that to do so you must remove TAB_FORNECEDOR2 if it already exists.
If you just need to keep both synchronized, you’d better give more details on the question.
Important: if you need to define constraints in the copy, you will have to do this manually, because the CREATE AS
does not copy indexes, triggers, etc.
If you want to copy only the data, you can use this syntax:
INSERT INTO
TAB_FORNECEDOR2 (
campo1,
campo2
...
)
SELECT
TAB_FORNECEDOR.campo1 ...
FROM
TAB_FORNECEDOR
And optionally you can use a WHERE
to filter the desired lines.
I have to make a proc that takes the fields of table "SUPPLIER" and copy to table "FORNECEDORES2", but I have to create a proc that copies only fields from one table to another.
Browser other questions tagged oracle select procedure stored-procedures
You are not signed in. Login or sign up in order to post.
Hello Welcome to [en.so]. I adjusted your title to be more consistent with the question raised. If you want to reverse my edition.
– Caputo
Have you done anything? Post an excerpt from your code
– LucasMotta