?
Solved

need help with this SQL

Posted on 2007-04-05
2
Medium Priority
?
263 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 11

Accepted Solution

by:
dready earned 200 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

PowerShell Core for Advanced Linux Administrators

Understand advanced principals around Powershell Core with a focus on the Linux Administrator.  This course covers how to administer numerous environments across multiple platforms including Linux, Azure, AWS, and Google Cloud from a single shell instance.

Question has a verified solution.

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

Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…

765 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