Solved

need help with this SQL

Posted on 2007-04-05
2
261 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ER Diagram 3 42
Toad 12.10 Enterprise visual interface 4 33
SQL Syntax 6 32
Oracle programming for starter 14 34
I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.

733 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