Insert data in 2 different columns
Hello
I need a little help to do the following:
Name | Per_complete |
Tasks | 85 |
Works of art | 60 |
Note per_complete is the percentage complete
I have to separate the per_complete missions and structures
For tasks, I have to enter data in the per_complete_tasks
Structures to introduce data into the per_complete_structures
Name | Per_complete | Per_complete_tasks | Per_complete_structures |
---|---|---|---|
Tasks | 85 | ||
Works of art | 60 |
Thanks for the help
Are you looking for this kind of SQL
SQL> with existing_data as (select 'Tasks' Name , 85 Per_complete from dual 2 union all 3 select 'Structures', 60 from dual) 4 select Name 5 ,Per_complete 6 ,case when Name='Tasks' 7 then Per_complete 8 end as Per_complete_tasks 9 ,case when Name='Structures' 10 then Per_complete 11 end as Per_complete_structures 12 from existing_data; NAME PER_COMPLETE PER_COMPLETE_TASKS PER_COMPLETE_STRUCTURES ---------- ------------ ------------------ ----------------------- Tasks 85 85 Structures 60 60 SQL>
Tags: Database
Similar Questions
-
How to insert data into a BLOB column using sql
Hi all
How to insert data into the BLOB column directly using sql.
Thank youcreate table temp ( a blob, b clob); SQL> / Insert into temp values ('32aasdasdsdasdasd4e32','adsfbsdkjf') ; * ERROR at line 1: ORA-01465: invalid hex number Please help in this.
Prakash PInsert into temporary values (UTL_RAW. CAST_TO_RAW ('32aasdasdsdasdasd4e32'), 'adsfbsdkjf');
-
What is the DateTime format, when you insert data in the DateTime column in the DB?
Hi all
I can't find an example to insert data into db that contains a DateTime column. I tried different date format, but none of them works. Someone has an idea how to do that? Is there a sample project?
Thank you
Dong
Thanks for your reply, I'll check and give it a try.
Dong
-
Trigger to insert data on the null columns
Hi all
How can I create triggers to insert data into a column null, this column is a Varchar2.
Thanks in advance.
Something like this:
create or replace the TRG_BI_MYTABLE before insert on MYTABLE for each line
Start
: new. MYCOLUMN: = nvl(:new.) MYCOLUMN, 'A value');
end;
-
How to insert data into the BLOB column
Hi all
Can someone help me to insert data in the BLOB data type column?
The structure of the table is
CREATE TABLE XXATFL_DM_FORCAST_STG
(
TASK_ID NUMBER,
USER_ID NUMBER,
CREATED_BY NUMBER (15),
CREATION_DATE DATE,
LAST_UPDATED_BY NUMBER (15),
DATE OF LAST_UPDATE_DATE,
LAST_UPDATE_LOGIN NUMBER (15),
RECORD_STATUS VARCHAR2 (1 BYTE),
ERROR_MESSAGE VARCHAR2 (4000 BYTE),
DATA_FILE BLOB
)
I want to insert data into the column DATA_FILE. and this insert statement inside a procedure.
Please help me as soon as possible because it is very urgent for me
Thank you and best regards,
CharrierCharrier,
If you form the string yourself, you can use the function utl_raw.cast_to_raw on your channel.
http://download.Oracle.com/docs/CD/B12037_01/AppDev.101/b10802/u_raw.htm#997086
sql> create table t( 2 id number, 3 l_blob blob 4 ); sql> insert into t values(1, utl_raw.cast_to_raw('SampleString')); 1 row created. sql> commit; Commit complete.
-
How to load data from a different column string
Hello
In a table, I get the data as a string
101, SAM, 2000, 20, SALES
"102, RAM, 3000, 30, MARKETING"
I want to load this data into another column in the target table
So I have to cut these data and having to load them into different target column.Select SUBSTR (101, SAM, 2000, 20, SALES,)
INSTR('101,SAM,2000,20,SALES',',',1,4) + 1)
Double; -
Split a column of data in 4 different columns
Hi all
I have a column that bring the friom of data in the database like this:
1.1.01 10.1 M10-08: this is the best deal ever
I want that divided into 4 columns (prefrebely in RPD). 1 column will be 1.1.01, 2nd column just M or Q (according to the data). 3rd column as M10-08. 4th column as the vervbage (for example: this is the best deal ever).
How can I do this. Any help will be appreciated.
Thank youHi user599926,
The business model and the mapping of (logical) layer in the RPD is the right place for this kind of change. Here's what you do
(1) import your physical table in the RPD
(2) drag and drop this table in a MDB file
(4) make a right click on the logic table and select 'New object'-> 'logic column... '. »
(5) give the column a name
6) click the Data Type tab
7) double-click the logical Table Source (LTS) * make sure that "show all logical sources" is checked
(8) uncheck "Show mapped columns.
(9) check "see the deleted the column mapping.
(10) you should now see your new column.
11) click on the three dots «...» "next to the name of the column.
(12) use the SUBSTRING() function on your original field. E.g. substring (Field1 FROM 1 TO 6)
13) press OK
14) press OK
(15) repeat steps 4-14 for the 2nd, 3rd and 4th column. They will have just a number and different FROM.Good luck!
-Joe
-
Different filters to the data in 2 different columns
Oracle BI 11g
Hello
I have 1 fact tables Sales (ID, Date, VersionID, Count) and dimension 2 - calendar (Date, year, month, week, day,...), Versions (ID, Name).
I created the Time hierarchy on table calendar, so I can use the AGO. I've done new logical column "Count (1 month ago). It works fine.
Now, I need create analysis with columns: month number, County, (1 month ago). BUT! In the column "number of" I need to see only the values of version of Budget, and in the column "Count (1 month ago)" I need to see only the version values are real.
I try to use the filter for the column "number of '-"Version is equal to the Budget", but this works for all analyses, but not for the column 'number '.
How can I solve this problem?Hello
in the formula for the column in the criteria tab we have filter option. This is useful to filter this column only.
syntax:
Filter (if using dimensioncolumn) -
Generate the command Id and insert data into two different tables: oracle apex 5.0
I have three tables. name of the tables: PRODUCT, ORDER_HEADER, ORDER_DETAIL. I took REPORT inter ASSETS in which the VALUES from TABLE product. I need to use the trigger here, there is a TEXT ARTICLE called ORDER ID: it will generate through trigger. so whenever new order placed order id must be unique. There is a button when this button is clicked, the VALUES of REPORT must be inserted in to ORDER_HEADER , ORDER_DETAIL (in fact, I am in confusion is it even possible).
I tried to create the trigger: not work if
CREATE OR REPLACE TRIGGER "EMP_TRG1".
Before Insert on order_header
for each line
Start
If: new. Order_ID is null
then
Select lpad (demo_seq.nextval, 8, '0'): new. Order_ID order_header;
end if;
end;
SQL:
Select
apex_item. Text(1,p.PRODUCT_ID) PID.
PN.product_name,
apex_item. Text(2,p.PRODUCT_QTY) qt.
apex_item. Text(3,p.unit_price) upward,
apex_item. Text(4,p.TOTAL_AMOUNT) am
OMS_SHIP_CART_DETAIL p, pn OMS_PRODUCT
where p.product_id = pn.product_id
DA:
var arr_f01 = [];
var arr_f02 = [];
var arr_f03 = [];
var arr_f04 = [];
var arr_f05 = [];
product_id var;
unit_price var;
Var Qty;
var total_1;
() $("input[name='f01']").each
function() {}
product_id = $(this).closest('tr') .children ('td [headers = 'PID']') .text ();
unit_price = $(this).closest('tr') .children ('td [headers = "Uprice"]') .text ();
Qty = $(this).closest('tr') .children ('td [headers = "Qty"]') .text ();
total_1 = $(this). Closest ('tr'). Children ('td [headers = "total"]'). Text();
arr_f01.push ($(this).) Val());
arr_f02.push (product_id);
arr_f03.push (total_1);
arr_f04.push (unit_price);
arr_f05.push (Qty);
} );
(apex). Server.Process
"Insert a command."
, {f01: arr_f01, f02: arr_f02, f03: arr_f03, f04: arr_f04, f05: arr_f05}
}
, {dataType: "text", success: function (pData) {alert ('added product') ;}}
);
Ajax callback:
declare
l_count number;
Start
-insert into OMS_ORDER_HEADER (USER_ID, TOTAL_AMOUNT, batch, ORDER_DATE) values(:P1_USER_ID,:P42_TOTAL,'PENDING',SYSDATE);
I'm looping 1.apex_application.g_f01.count
insert into OMS_ORDER_DETAIL (PRODUCT_ID, UNIT_QTY, UNIT_PRICE, TOTAL_AMOUNT)
values (APEX_APPLICATION. G_F01 (i), APEX_APPLICATION. G_F03 (i), APEX_APPLICATION. G_F04 (i), APEX_APPLICATION. G_F05 (i));
commit;
end loop;
end;
Hi Dominique,.
I create a process page away present in your application
declare l_order_id varchar2(8); begin insert into order_header(ORDER_ID , STATUS , ORDER_DATE) values(lpad(demo_seq.nextval,8,'0') , 'Pending' , sysdate) returning ORDER_ID into l_order_id; for rec in(select ID , QTY , PRICE from product) loop Insert Into Order_Detail ( ORDER_ID , PRODUCT_ID , QTY , UNIT_PRICE) Values(l_order_id , rec.id , rec.qty , rec.price); commit; end loop; end;
Please check and let me know.
Kind regards
Jitendra
-
How to display rows of data in different columns?
I'm new to SQL and currently, that's what I try to do:
Display multiple lines of data in different columns in the same row
I have a table like this:
CREATE TABLE TRIPLEG)
T # NUMBER (10) NOT NULL,
STEP # NUMBER (2) NOT NULL,
DEPARTURE VARCHAR (30) NOT NULL,
VARCHAR (30) DESTINATION NOT NULL,.
CONSTRAINT TRIPLEG_PKEY PRIMARY KEY (T #, LEG #).
TRIPLEG_UNIQUE UNIQUE CONSTRAINT (T #, DEPARTURE, DESTINATION).
CONSTRAINT TRIPLEG_FKEY1 FOREIGN KEY (T #) REFERENCES TRIP(T#));
INSERT INTO TRIPLEG VALUES (1, 1, 'Sydney', 'Melbourne');
INSERT INTO TRIPLEG VALUES (1, 2, 'Melbourne', 'Adélaïde');
The result should be something like this:
> T # | ORIGIN | DESTINATION1 | DESTINATION2
> 1 | SYDNEY | MELBORUNE | ADELAIDE
The request must include the ' COUNT(T#) < 3' since I only need to display the records of less than 3. How can I get the results I want to use relational views?
Thank you!!!
I replaced the syntax "where" with the syntax 'account '. The reason why I do this is because I want to only display records with a number of travel of less than 3. By defining where the legs #.<=3, the="" result="" will="" be="" all="" the="" records="" of="" the="" tripleg="" table="" since="" each="" record="" could="" also="" have="" leg#="" is="">=3,>
The answer is:
with t as (SELECT t #,)
REGEXP_REPLACE)
LISTAGG (start |) '->' || destination, ' ')
THE Group (ORDER BY t #, leg #).
'([^ ]+) \1+',
"\1") str
OF tripleg
HAVING COUNT (T #)<>
GROUP BY t #)
Select T #, regexp_substr (str, ' [^->] +', 1, 1) departure
, regexp_substr (str, ' [^->] +', 1, 2) destination_1
, regexp_substr (str, ' [^->] +' 1, 3) destination_2
, regexp_substr (str, ' [^->] +' 1, 4) destination_3
Thanks to Marty and knani!
-
OBIEE 11 g Date between guest in different columns
Hello
I did, between guest day in Obiee by using this statement: link. It works well, but I need to manipulate different in a different column, for example:
Data source values:
100 2009
100 2010
100 2011
100 2012
100 2013
Guest (what I choose in the analysis)
StartDate: 2011
EndDate: 2012
Results of the analysis (sum):
Column A column B
200 400
Explanation of the results: column A contains the sum of 2011 and 2012, it is ok and works well. My problem is the B column; I want to use prompt EndDate, but ignore the prompt StartDate, the result should be 400 (2009:100 + 2010:100 + 2011:100 + 2012:100).
Do I need to use this prompt EndDate in colum of B?
I found the solution! Here it is if anyone else have the same problems:
1. create guests: startdate and enddate
2. then call created invites in the formula editor:
FILTER ("some". "WITH something' ('time'". "the dimension' between 2000 and @{enddate})))"
FILTER ("some". "WITH something' ('time'". "between dimension' @{startdate} and @{enddate})))"
-
Insert the ROWNUM in a column of data type of NUMBER table
Hello
I have a table that has a column named "rank" of the NUMBER data type. Basically, I want to make an analysis of top-n and insert the ROWNUM with other columns in the table.
Definition of table1:
CREATE TABLE
(
col1 VARCHAR2 (10),
Col2 NUMBER,
NUMBER of col3,
rank NUMBER
);
INSERT INTO table1
SELECT col1, col2, col3, rownum
DE)
SELECT col1, col2, col3
FROM table2
ORDER BY DESC of col3
)
WHERE rownum < = 5;
I get an error ORA-01722: invalid number. I think the mistake is virtual ROWNUM is not data type of NUMBER, so I tried to cast as CAST (ROWNUM AS NUMBER), but it does not work, same error. Can can you please shed some light on how to convert a ROWNUM number or if the issue is something else.
you're right, your example worked. It is an example of table I just created just to illustrate the problem, but my real table was always showing the same problem. Weird, isn't? However when I added the column names after that insert the question but statement I resolved. Adding code
INSERT INTO TABLE1
(col1, col2, col3, rank) - added
SELECT col1, col2, col3, rownum
DE)
SELECT col1, col2, col3
FROM table2
ORDER BY DESC of col3
)
WHERE rownum<=>=>
So that means ROWNUM returns number; and another confusion: why the inclusion of the column has solved my problem when it is not necessary for your example. in any case thank you.
-
Insert data according to the length of column in table
Hello
If the length of the characters is more than one defined causes error. It's very embarrassing especially when get data dynamically
and our query does not insert information that we expect.
While trying to find the solution an idea came to my mind that, before insertion, so we check that the next data is greater than the specified length
Take only the amount of characters that can be inserted and ignore the rest.
I thought that the query as follows but failed.
Is it possible to insert data up to the amount this column length defined by ignoring the obsolete characters and if the dataSQL> insert into cvDetails(cv_id,objectives) values(9687,substr("Hello",1,3950)); insert into cvDetails(cv_id,objectives) values(9687,substr("Hello",1,3950)) * ERROR at line 1: ORA-00984: column not allowed here
length is less defined length of column, and then insert it as it is?
Thank you in anticipationHello
Do not use double quotes as the string delimiters:
SQL> create table test_nsa (str varchar2(10)); Table created. Elapsed: 00:00:00.88 SQL> insert into test_nsa values (substr('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',1,10)); 1 row created. Elapsed: 00:00:00.08
-
inserting data in a column in an existing table
Hi the gems...
I have an existing table TABLE_1 which has more data in it. This table has no primary key. now, I added a new column 'ID' and want to make it a primary key for this table. currently it is not allowed because the column is null...
so I need to insert data into the column.
now, my plan is to fill the column with the data as well as rownumber.
means that if there are 15 records in this table, then the 'ID' column should contain data from 1 to 15. After that, I'll do the column as a primary key...
the script I wrote for this:
declare
number of v_rownum;
Start
Select max (rownum) in the v_rownum from TABLE_1;
because me in 1.v_rownum
loop
Update t set i = t.id TABLE_1 where rownum = i;
commit;
end loop;
end;
but it refreshes only the first record and the rest of the records are not updated.
Please help... Thanks in advance...Select max (rownum) in the v_rownum from TABLE_1;
How many rows do you think that this query will retrieve?
Why not just
Update TABLE_1 t
the value t.id = rownum; -
Inserting data block to the SPOUT making varchar2 (150) column with currupted
Hi Chris,
We are facing a problem with the insertion of bulk data on the BEAK in a table
Insert data block to the SPOUT making varchar2 (150) column in a table with the corrupted values.
column of first row inserted correct, but the second line, columns in the new row as null
We had trace OIC just before the insertion, these values are correctly coming
But integration doesn't work properly
Could you suggest, what could be the problem, we use the OIC during the client/server connection, this problem is for a direct connection alsoIn general, please do not post questions forum for questions where you have already opened a SR. This translates simply by duplication of efforts and is unlikely to lead to a faster resolution. If the problem is serious or complex that you opened a SR, it is very likely that anyone in the forum (including me) will have an instant response and it will probably ask a lot of questions and do a lot of research that is already made by Oracle support.
Thank you for your understanding and your cooperation.
Chris
Maybe you are looking for
-
Unable to communicate with the wireless router
When I open the Customer Manager. I have a full signal strength and the correct SSID/network name. But there is a warning saying problem IRQ or encryption. I disabled the encryption, and there is no conflict for my card Wifi (Lucent on a Tecra8200).
-
Satellite A110-294 does not recognize the wireless card
Hello the question is:Why my Satellite A110-294 does not recognize the wireless card? I re - install Xp PRO with all the drivers. I have try all the drivers Wireless: Wlan intel + proset intel atheros wlan + wlesscmgr I don't understand, can you help
-
HP a110z-251 HP: my pc HP 251-a110z has internal speakers?
I can't hear any sound - if I plug headphones I hear.If I use a USB bluetooth and use my earpiece to my android phone, it works - but the microphone does not work.But without either of the above, I cannot hear any sound. This pc is no internal speake
-
Diagnostics of Lenovo - standalone boot works? not!
https://forums.Lenovo.com/T5/ThinkPad-T400-T500-and-newer-T/help-kernel-panic-Lenovo-diagnostic-boot... 4.0.0.6027, start of Linux version works, 29/10/2014.
-
I got a Notification recommending a download for my computer called HP wireless button Driver. I tried several times to download. Each time, after about two hours of waiting, he continues to say that it is downloading. Every time at this point, I