DB2

DB2 is IBM's offering to the highend database market. The latest version of DB2 (Universal Database) is ideal for OLTP, Data Warehousing, Decision Support and everything in between. It's well priced, extremely scalable and runs on virtually every platform out there from handhelds to mainframes.

sql query--need help


Hi fellow developers,
I have to implement below mentioned design using SQL queries(DB2 Database).Pls help with your suggestions.
The base table 'BA' has an attribute (say X), which has two values - 'active' and 'inactive'. table BA is to be joined with table BA_ALT(which is identical to BA, but it stores 1 days history data). And the data is to be loaded in the target table 'tgt'. And the condtion to be implementated is - if the value of X is 'active', then the row must be loaded directlt in the tgt, but if the x='inactive', then some transformation logic is to be implementated and the row is to be loaded.
Now my query is , can this be implemented with 2 insert statements, in one using where x='active' in the join condition and in second insert , using where x='inactive'? will this work? Or is there a better way of implementin this if else situation?
PS-- the OS is unix. The queries will be executed in a unix scrpit.
Originally Posted by indigo3
will this work?
Yes.
Originally Posted by indigo3
is there a better way of implementin this if else situation?
You might try using the CASE expression.

Related Links

problem with creation of buffer pool
Arabic char conversion from CCSID1256 to 420
SQL Stored Procedure
dBase 4
Runstats problem
Issues with EXECUTE IMMEDIATE with USING Clause and it's alternative in DB2
DB2 Stored Procedure Builder
To timeout db connection, what can I do?
COBOL program on OS390 can access a SQL2000 database?
Error using || or CONCAT in DB2 SQL procedure
Using Autonomus transactions in DB2
What is FOR FETCH ONLY parameter
Error Building DB2 SQL Procedure
formula for calculating tablespace growth
Error Building DB2 SQL Procedure
DB2 Command Centre

Categories

DataBase Dev
MongoDB
Adabas
DB2
Informix
Microsoft SQL Server
MySQL
Oracle
Pervasive.SQL
PostgreSQL
Sybase
Other
ASP
Crystal Reports
Delphi, C etc
JAVA
Perl and the DBI
PHP
ANSI SQL
Unix Shell Scripts
Visual Basic
Brilliant Database
Corel Paradox
FileMaker
Microsoft Access
Microsoft Excel
Other PC Databases
New Members & Introduc...
Applications & Tools
Database Concepts & De...
Chit Chat
Marketplace
Job Opportunities
Suggestions & Feedback

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App