dbTalk Databases Forums  

How to update a table with another table

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss How to update a table with another table in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
nick048
 
Posts: n/a

Default How to update a table with another table - 01-23-2008 , 03:35 AM






Hi to All,

I have in my 'schema' 2 tables:

CREATE TABLE T_ITEMS
(
ITEM_GROUP VARCHAR2(10 BYTE) NOT NULL,
ITEM_CODE VARCHAR2(25 BYTE) NOT NULL,
ITEM_DESCRIPTION VARCHAR2(40 BYTE) NOT NULL,
ITEM_QTA NUMBER(16,4),
ITEM_PRICE NUMBER(18,5)
)
TABLESPACE DOM8DATI
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 2M
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
BUFFER_POOL DEFAULT
)
LOGGING
NOCOMPRESS
NOCACHE
NOPARALLEL
MONITORING;

CREATE TABLE T_PRICES
(
ITEM_GROUP VARCHAR2(10 BYTE) NOT NULL,
ITEM_CODE VARCHAR2(25 BYTE) NOT NULL,
ITEM_PRICE NUMBER(18,5)
)
TABLESPACE DOM8DATI
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 2M
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
BUFFER_POOL DEFAULT
)
LOGGING
NOCOMPRESS
NOCACHE
NOPARALLEL
MONITORING;

I need to create a script that for each record in T_ITEMS, read if
exist the code (ITEM_GROUP,ITEM_CODE) in T_PRICES and update
ITEM_PRICE in T_ITEMS.

Can anyone help me?

Thank You and Best Regards
Gaetano

Reply With Quote
  #2  
Old   
shakespeare
 
Posts: n/a

Default Re: How to update a table with another table - 01-23-2008 , 03:47 AM







"nick048" <nicosia.gaetano (AT) moonsoft (DOT) it> schreef in bericht
news:58c09989-2361-41e1-9db9-dee2dd6cc99c (AT) z17g2000hsg (DOT) googlegroups.com...
Quote:
Hi to All,

I have in my 'schema' 2 tables:

CREATE TABLE T_ITEMS
(
ITEM_GROUP VARCHAR2(10 BYTE) NOT NULL,
ITEM_CODE VARCHAR2(25 BYTE) NOT NULL,
ITEM_DESCRIPTION VARCHAR2(40 BYTE) NOT NULL,
ITEM_QTA NUMBER(16,4),
ITEM_PRICE NUMBER(18,5)
)
TABLESPACE DOM8DATI
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 2M
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
BUFFER_POOL DEFAULT
)
LOGGING
NOCOMPRESS
NOCACHE
NOPARALLEL
MONITORING;

CREATE TABLE T_PRICES
(
ITEM_GROUP VARCHAR2(10 BYTE) NOT NULL,
ITEM_CODE VARCHAR2(25 BYTE) NOT NULL,
ITEM_PRICE NUMBER(18,5)
)
TABLESPACE DOM8DATI
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 2M
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
BUFFER_POOL DEFAULT
)
LOGGING
NOCOMPRESS
NOCACHE
NOPARALLEL
MONITORING;

I need to create a script that for each record in T_ITEMS, read if
exist the code (ITEM_GROUP,ITEM_CODE) in T_PRICES and update
ITEM_PRICE in T_ITEMS.

Can anyone help me?

Thank You and Best Regards
Gaetano
You don't need a script, only one sql statement (update t_items set price =
select .. from t_prices where.. ), and this smells like homework.
And you should normalize your model.

Shakespeare




Reply With Quote
  #3  
Old   
shakespeare
 
Posts: n/a

Default Re: How to update a table with another table - 01-23-2008 , 03:47 AM




"nick048" <nicosia.gaetano (AT) moonsoft (DOT) it> schreef in bericht
news:58c09989-2361-41e1-9db9-dee2dd6cc99c (AT) z17g2000hsg (DOT) googlegroups.com...
Quote:
Hi to All,

I have in my 'schema' 2 tables:

CREATE TABLE T_ITEMS
(
ITEM_GROUP VARCHAR2(10 BYTE) NOT NULL,
ITEM_CODE VARCHAR2(25 BYTE) NOT NULL,
ITEM_DESCRIPTION VARCHAR2(40 BYTE) NOT NULL,
ITEM_QTA NUMBER(16,4),
ITEM_PRICE NUMBER(18,5)
)
TABLESPACE DOM8DATI
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 2M
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
BUFFER_POOL DEFAULT
)
LOGGING
NOCOMPRESS
NOCACHE
NOPARALLEL
MONITORING;

CREATE TABLE T_PRICES
(
ITEM_GROUP VARCHAR2(10 BYTE) NOT NULL,
ITEM_CODE VARCHAR2(25 BYTE) NOT NULL,
ITEM_PRICE NUMBER(18,5)
)
TABLESPACE DOM8DATI
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 2M
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
BUFFER_POOL DEFAULT
)
LOGGING
NOCOMPRESS
NOCACHE
NOPARALLEL
MONITORING;

I need to create a script that for each record in T_ITEMS, read if
exist the code (ITEM_GROUP,ITEM_CODE) in T_PRICES and update
ITEM_PRICE in T_ITEMS.

Can anyone help me?

Thank You and Best Regards
Gaetano
You don't need a script, only one sql statement (update t_items set price =
select .. from t_prices where.. ), and this smells like homework.
And you should normalize your model.

Shakespeare




Reply With Quote
  #4  
Old   
shakespeare
 
Posts: n/a

Default Re: How to update a table with another table - 01-23-2008 , 03:47 AM




"nick048" <nicosia.gaetano (AT) moonsoft (DOT) it> schreef in bericht
news:58c09989-2361-41e1-9db9-dee2dd6cc99c (AT) z17g2000hsg (DOT) googlegroups.com...
Quote:
Hi to All,

I have in my 'schema' 2 tables:

CREATE TABLE T_ITEMS
(
ITEM_GROUP VARCHAR2(10 BYTE) NOT NULL,
ITEM_CODE VARCHAR2(25 BYTE) NOT NULL,
ITEM_DESCRIPTION VARCHAR2(40 BYTE) NOT NULL,
ITEM_QTA NUMBER(16,4),
ITEM_PRICE NUMBER(18,5)
)
TABLESPACE DOM8DATI
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 2M
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
BUFFER_POOL DEFAULT
)
LOGGING
NOCOMPRESS
NOCACHE
NOPARALLEL
MONITORING;

CREATE TABLE T_PRICES
(
ITEM_GROUP VARCHAR2(10 BYTE) NOT NULL,
ITEM_CODE VARCHAR2(25 BYTE) NOT NULL,
ITEM_PRICE NUMBER(18,5)
)
TABLESPACE DOM8DATI
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 2M
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
BUFFER_POOL DEFAULT
)
LOGGING
NOCOMPRESS
NOCACHE
NOPARALLEL
MONITORING;

I need to create a script that for each record in T_ITEMS, read if
exist the code (ITEM_GROUP,ITEM_CODE) in T_PRICES and update
ITEM_PRICE in T_ITEMS.

Can anyone help me?

Thank You and Best Regards
Gaetano
You don't need a script, only one sql statement (update t_items set price =
select .. from t_prices where.. ), and this smells like homework.
And you should normalize your model.

Shakespeare




Reply With Quote
  #5  
Old   
shakespeare
 
Posts: n/a

Default Re: How to update a table with another table - 01-23-2008 , 03:47 AM




"nick048" <nicosia.gaetano (AT) moonsoft (DOT) it> schreef in bericht
news:58c09989-2361-41e1-9db9-dee2dd6cc99c (AT) z17g2000hsg (DOT) googlegroups.com...
Quote:
Hi to All,

I have in my 'schema' 2 tables:

CREATE TABLE T_ITEMS
(
ITEM_GROUP VARCHAR2(10 BYTE) NOT NULL,
ITEM_CODE VARCHAR2(25 BYTE) NOT NULL,
ITEM_DESCRIPTION VARCHAR2(40 BYTE) NOT NULL,
ITEM_QTA NUMBER(16,4),
ITEM_PRICE NUMBER(18,5)
)
TABLESPACE DOM8DATI
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 2M
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
BUFFER_POOL DEFAULT
)
LOGGING
NOCOMPRESS
NOCACHE
NOPARALLEL
MONITORING;

CREATE TABLE T_PRICES
(
ITEM_GROUP VARCHAR2(10 BYTE) NOT NULL,
ITEM_CODE VARCHAR2(25 BYTE) NOT NULL,
ITEM_PRICE NUMBER(18,5)
)
TABLESPACE DOM8DATI
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 2M
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
BUFFER_POOL DEFAULT
)
LOGGING
NOCOMPRESS
NOCACHE
NOPARALLEL
MONITORING;

I need to create a script that for each record in T_ITEMS, read if
exist the code (ITEM_GROUP,ITEM_CODE) in T_PRICES and update
ITEM_PRICE in T_ITEMS.

Can anyone help me?

Thank You and Best Regards
Gaetano
You don't need a script, only one sql statement (update t_items set price =
select .. from t_prices where.. ), and this smells like homework.
And you should normalize your model.

Shakespeare




Reply With Quote
  #6  
Old   
nick048
 
Posts: n/a

Default Re: How to update a table with another table - 01-23-2008 , 08:31 AM



On 23 Gen, 10:47, "shakespeare" <what... (AT) xs4all (DOT) nl> wrote:
Quote:
"nick048" <nicosia.gaet... (AT) moonsoft (DOT) it> schreef in berichtnews:58c09989-2361-41e1-9db9-dee2dd6cc99c (AT) z17g2000hsg (DOT) googlegroups.com...



Hi to All,

I have in my 'schema' 2 tables:

CREATE TABLE T_ITEMS
(
ITEM_GROUP VARCHAR2(10 BYTE) NOT NULL,
ITEM_CODE VARCHAR2(25 BYTE) NOT NULL,
ITEM_DESCRIPTION VARCHAR2(40 BYTE) NOT NULL,
ITEM_QTA NUMBER(16,4),
ITEM_PRICE NUMBER(18,5)
)
TABLESPACE DOM8DATI
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 2M
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
BUFFER_POOL DEFAULT
)
LOGGING
NOCOMPRESS
NOCACHE
NOPARALLEL
MONITORING;

CREATE TABLE T_PRICES
(
ITEM_GROUP VARCHAR2(10 BYTE) NOT NULL,
ITEM_CODE VARCHAR2(25 BYTE) NOT NULL,
ITEM_PRICE NUMBER(18,5)
)
TABLESPACE DOM8DATI
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 2M
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
BUFFER_POOL DEFAULT
)
LOGGING
NOCOMPRESS
NOCACHE
NOPARALLEL
MONITORING;

I need to create a script that for each record in T_ITEMS, read if
exist the code (ITEM_GROUP,ITEM_CODE) in T_PRICES and update
ITEM_PRICE in T_ITEMS.

Can anyone help me?

Thank You and Best Regards
Gaetano

You don't need a script, only one sql statement (update t_items set price =
select .. from t_prices where.. ), and this smells like homework.
And you should normalize your model.

Shakespeare
Thank You
Bye
Gaetano


Reply With Quote
  #7  
Old   
nick048
 
Posts: n/a

Default Re: How to update a table with another table - 01-23-2008 , 08:31 AM



On 23 Gen, 10:47, "shakespeare" <what... (AT) xs4all (DOT) nl> wrote:
Quote:
"nick048" <nicosia.gaet... (AT) moonsoft (DOT) it> schreef in berichtnews:58c09989-2361-41e1-9db9-dee2dd6cc99c (AT) z17g2000hsg (DOT) googlegroups.com...



Hi to All,

I have in my 'schema' 2 tables:

CREATE TABLE T_ITEMS
(
ITEM_GROUP VARCHAR2(10 BYTE) NOT NULL,
ITEM_CODE VARCHAR2(25 BYTE) NOT NULL,
ITEM_DESCRIPTION VARCHAR2(40 BYTE) NOT NULL,
ITEM_QTA NUMBER(16,4),
ITEM_PRICE NUMBER(18,5)
)
TABLESPACE DOM8DATI
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 2M
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
BUFFER_POOL DEFAULT
)
LOGGING
NOCOMPRESS
NOCACHE
NOPARALLEL
MONITORING;

CREATE TABLE T_PRICES
(
ITEM_GROUP VARCHAR2(10 BYTE) NOT NULL,
ITEM_CODE VARCHAR2(25 BYTE) NOT NULL,
ITEM_PRICE NUMBER(18,5)
)
TABLESPACE DOM8DATI
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 2M
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
BUFFER_POOL DEFAULT
)
LOGGING
NOCOMPRESS
NOCACHE
NOPARALLEL
MONITORING;

I need to create a script that for each record in T_ITEMS, read if
exist the code (ITEM_GROUP,ITEM_CODE) in T_PRICES and update
ITEM_PRICE in T_ITEMS.

Can anyone help me?

Thank You and Best Regards
Gaetano

You don't need a script, only one sql statement (update t_items set price =
select .. from t_prices where.. ), and this smells like homework.
And you should normalize your model.

Shakespeare
Thank You
Bye
Gaetano


Reply With Quote
  #8  
Old   
nick048
 
Posts: n/a

Default Re: How to update a table with another table - 01-23-2008 , 08:31 AM



On 23 Gen, 10:47, "shakespeare" <what... (AT) xs4all (DOT) nl> wrote:
Quote:
"nick048" <nicosia.gaet... (AT) moonsoft (DOT) it> schreef in berichtnews:58c09989-2361-41e1-9db9-dee2dd6cc99c (AT) z17g2000hsg (DOT) googlegroups.com...



Hi to All,

I have in my 'schema' 2 tables:

CREATE TABLE T_ITEMS
(
ITEM_GROUP VARCHAR2(10 BYTE) NOT NULL,
ITEM_CODE VARCHAR2(25 BYTE) NOT NULL,
ITEM_DESCRIPTION VARCHAR2(40 BYTE) NOT NULL,
ITEM_QTA NUMBER(16,4),
ITEM_PRICE NUMBER(18,5)
)
TABLESPACE DOM8DATI
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 2M
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
BUFFER_POOL DEFAULT
)
LOGGING
NOCOMPRESS
NOCACHE
NOPARALLEL
MONITORING;

CREATE TABLE T_PRICES
(
ITEM_GROUP VARCHAR2(10 BYTE) NOT NULL,
ITEM_CODE VARCHAR2(25 BYTE) NOT NULL,
ITEM_PRICE NUMBER(18,5)
)
TABLESPACE DOM8DATI
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 2M
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
BUFFER_POOL DEFAULT
)
LOGGING
NOCOMPRESS
NOCACHE
NOPARALLEL
MONITORING;

I need to create a script that for each record in T_ITEMS, read if
exist the code (ITEM_GROUP,ITEM_CODE) in T_PRICES and update
ITEM_PRICE in T_ITEMS.

Can anyone help me?

Thank You and Best Regards
Gaetano

You don't need a script, only one sql statement (update t_items set price =
select .. from t_prices where.. ), and this smells like homework.
And you should normalize your model.

Shakespeare
Thank You
Bye
Gaetano


Reply With Quote
  #9  
Old   
nick048
 
Posts: n/a

Default Re: How to update a table with another table - 01-23-2008 , 08:31 AM



On 23 Gen, 10:47, "shakespeare" <what... (AT) xs4all (DOT) nl> wrote:
Quote:
"nick048" <nicosia.gaet... (AT) moonsoft (DOT) it> schreef in berichtnews:58c09989-2361-41e1-9db9-dee2dd6cc99c (AT) z17g2000hsg (DOT) googlegroups.com...



Hi to All,

I have in my 'schema' 2 tables:

CREATE TABLE T_ITEMS
(
ITEM_GROUP VARCHAR2(10 BYTE) NOT NULL,
ITEM_CODE VARCHAR2(25 BYTE) NOT NULL,
ITEM_DESCRIPTION VARCHAR2(40 BYTE) NOT NULL,
ITEM_QTA NUMBER(16,4),
ITEM_PRICE NUMBER(18,5)
)
TABLESPACE DOM8DATI
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 2M
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
BUFFER_POOL DEFAULT
)
LOGGING
NOCOMPRESS
NOCACHE
NOPARALLEL
MONITORING;

CREATE TABLE T_PRICES
(
ITEM_GROUP VARCHAR2(10 BYTE) NOT NULL,
ITEM_CODE VARCHAR2(25 BYTE) NOT NULL,
ITEM_PRICE NUMBER(18,5)
)
TABLESPACE DOM8DATI
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 2M
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
BUFFER_POOL DEFAULT
)
LOGGING
NOCOMPRESS
NOCACHE
NOPARALLEL
MONITORING;

I need to create a script that for each record in T_ITEMS, read if
exist the code (ITEM_GROUP,ITEM_CODE) in T_PRICES and update
ITEM_PRICE in T_ITEMS.

Can anyone help me?

Thank You and Best Regards
Gaetano

You don't need a script, only one sql statement (update t_items set price =
select .. from t_prices where.. ), and this smells like homework.
And you should normalize your model.

Shakespeare
Thank You
Bye
Gaetano


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.