gbcbr
asked on
Insert into Oracle table column with permanent value
I need to add column which will have permanent string value.
I have tables which have two columns each one, when I execute SELECT from all of them I need to have identification column.
Let's say this sample of query so I need to add column SYMBOL, so I can separate these data into array by this way.
I know that I can make trigger and insert EUR/USD and other symbols each time when inserting value in specified table.
But I need to create 50 triggers by this way.
Please advice
I have tables which have two columns each one, when I execute SELECT from all of them I need to have identification column.
Let's say this sample of query so I need to add column SYMBOL, so I can separate these data into array by this way.
I know that I can make trigger and insert EUR/USD and other symbols each time when inserting value in specified table.
But I need to create 50 triggers by this way.
Please advice
ASKER
No, this will complicate my code.
Main question is to create two arrays according to currency pairs and use pair symbol as identification, so I will only add to the existing query:
Main question is to create two arrays according to currency pairs and use pair symbol as identification, so I will only add to the existing query:
String s = data.getSymbol();
double bpx = data.getOpenBid();
String bb = data.getBotBuy();
if (s.equals("EUR/USD")) {
openBid[0] = bpx;
botBuy[0] = bb;
and I will have as much arrays as I need.
if it's a value needed at insert just use column default values - no need for triggers or default values
alternately, use a table with lookups, can you give an example of what you're trying to do?
inputs and expected outputs
alternately, use a table with lookups, can you give an example of what you're trying to do?
inputs and expected outputs
ASKER
When I created these tables, I'm especially make them separated by names to see separated data in each table.
public void statistic_EURUSD_S(boolean bl0) throws SQLException,
ClassNotFoundException,
InstantiationException,
IllegalAccessException {
if (bl0 == false) {
ts = new java.util.Date();
sell_px[0] = DCC.getInstance().getSellPriceEURUSD();
System.out.println(" EUR/USD Sell signal at " + ts +
" : with price = " + sell_px[0]);
lionconn.insertBotResult(sell_px, buy_px, ts);
} else {
}
}
CREATE TABLE "LIONFX"."EURUSD_BOT_BUY"
(
"BUY_PX" VARCHAR2(20 BYTE),
"TS" TIMESTAMP (6) NOT NULL ENABLE,............
At the moment I need to use this tables for charts creating together with with another table, but this table full and has all columns
CREATE TABLE "LIONFX"."EURUSD"
(
"ID" NUMBER NOT NULL ENABLE,
"SYMBOL" VARCHAR2(20 BYTE),
"BIDPX" FLOAT(126),
"ASKPX" FLOAT(126),
"TIMEST" TIMESTAMP (0),.......
So, I want to use the same query
String s = data.getSymbol();
double bpx = data.getOpenBid();
String bb = data.getBotBuy();
if (s.equals("EUR/USD")) {
openBid[0] = bpx;
botBuy[0] = bb;
where String bb will be value from BUY_PX column
ASKER
@sdstuber
of course I can change application code and insert "EUR/USD" value, but this is big enough job for 50 tables.
So, I just try to minimize my job. This reason why I suppose that much easy to insert in each table just one more column with permanent value.
Thank you
of course I can change application code and insert "EUR/USD" value, but this is big enough job for 50 tables.
So, I just try to minimize my job. This reason why I suppose that much easy to insert in each table just one more column with permanent value.
Thank you
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
this is exactly what I'm asking for. Thank you
// "SELECT 'whatever you want to show here' SYMBOL, x.* FROM EURUSD_BOT_SELL x where timest = ( select max( timest ) from EURUSD_BOT_SELL ) and rownum = 1 union all " +...
hope that helps