Solved

need help with this SQL

Posted on 2007-04-05
2
257 Views
Last Modified: 2013-12-11
i have the following table called TBLA
ID number
NAME varchar2
CLOSE_FLAG varchar2

I want to populate TBLA from TBLB
CUST number
CUST_NAME

and insert a 'N' to CLOSE_FLAG

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is my SQL

insert into TBLA values(
(select CUST    from TBLB),
(select CUST_NAME from TBLB),
 'N');

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 THIS IS WHAT I WANT TO DO..

take CUST and CUST_NAME from TBLB and insert it into TBLA , rows CUST and CUST_NUMBER, and insert an 'N' into CLOSE_FLAG
0
Comment
Question by:joekeri
2 Comments
 
LVL 11

Accepted Solution

by:
dready earned 50 total points
ID: 18862140
insert into tbalA (ID, Name, CLOSE_FLAG)  select CUST, CUSTNAME, 'N' from tblB

Or, if the names of the columns in tblA are CUST and CUST_NUMBER like you wrote in the last sentence:

insert into tbalA (CUST_NUMBER, CUST, CLOSE_FLAG)  select CUST, CUSTNAME, 'N' from tblB
0
 

Author Comment

by:joekeri
ID: 18864892
excellent!!! bang on !!! to what i was tryign to do.. Thanks for your help....
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question