Column value separated by commas to convert to another value separated by commas and happening as a component of output sys_refcursor
Hello
I have 3 tables with the following structure.
create table a_os_lang_stls
(ID NUMBER )
SWB_NUMBER VARCHAR2 (30),
Pc_NUMBER VARCHAR2 (30),
PC_FLAG TANK (1),
INSTALLATION_ord NUMBER ,
SP_OR_LATER_VSN TANK (1),
Platform VARCHAR2 (4000),
OS VARCHAR2 (4000),
LANG VARCHAR2 (4000),
LOSS_OF_FUNC_REASON_TXT VARCHAR2 (4000),
CREATION_DATE DATE ,
MODIFIED_DATE DATE ,
CREATED_BY VARCHAR2 (100 BYTE),
MODIFIED_BY VARCHAR2 (100 BYTE)
);
Insert in a_os_lang_stls
values (1 'SWB1' 'SWB0','P',1 of ','11118,14,16,234,124' '12,26,17,24,35''34,28,45,67,123,95',USER, NULL, NULL, NULL, SYSDATE);
Insert in a_os_lang_stls
values (2,'SWB1' 'SWB2','P',2 of ','111,20,14,16,124''11,26,18,24,35''35,27,42,67,123,95', SYSDATE, NULL, NULL, NULL, USER);
insert into a_os_lang_stls
values (3,'SWB1','SWB3','C', 1,'','11118,14,16,234,124','12,26,17,24,35',' 35,27,42,67,123,95', SYSDATE, NULL, NULL, NULL, USER);
insert into a_os_lang_stls
values (4,'SWB1','SWB4','C', 2,'','111,20,14,16,124','11,26,18,24,35'' 34,28,45,67,123,95, SYSDATE, NULL, NULL, NULL, USER)
CREATE TABLE os_dtls
(
OSCODE VARCHAR2 (10 BYTE),
ID NUMBER DEFAULT NULL,
AG_OSCODE VARCHAR2 (250 BYTE),
);
insert into os_dtls
values ('HUX', 12, 'HP UNIX');
insert into os_dtls
values('SUX',26,'SOLARIS');
insert into os_dtls
values ('LUX', 17, 'LINUX');
CREATE TABLE lang_dtls
(
LANGCD TANK (2 BYTE),
LANGNAME VARCHAR2 (255 BYTE),
ID NUMBER DEFAULT 1 NOT NULL
);
insert into lang_dtls
values ('ENG', 'ENGLISH UK', 35);
insert into lang_dtls
values ('UEG', 'USA ENGLISH', 27);
insert into lang_dtls
values('FR','FRENCH',45);
Information on the database:
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64 bit Production
PL/SQL version 11.1.0.7.0 - Production
Production base 11.1.0.7.0
AMT for Linux: Version 11.1.0.7.0 - Production
NLSRTL Version 11.1.0.7.0 - Production
I have to write a procedure like this
procedure os_lang_info (P_SB_NO IN varchar2, p_pcur sys_refcursor, p_ccur, sys_refcursor );
The requirement is to get the details for a given swb_no where pc_flag is P or C pass like 2 different sys_refcursor. But the value of column of bones and lang I need to map to the os_dtls and lang_dtls tables to get the ag_oscode and langname respectively for the corresponding id then through sys_refcursor.
So sys_refcursor structure will be
Open the p_pcur for
Select * from a_os_lang_stls
where swb_number = p_sb_no
and PC_FLAG = 'P' ;
so the output will resemble the following
1 , « SWB1 » , « SWB0 » , 'P' , 1 , 'S' , '11118,14,16,234,124' , «HP UNIX,SOLARIS,LINUX,... « , "UK ENGLISH,US ENGLISH,FRENCH,...» ', NULL, NULL, NULL, USER, SYSDATE
I must get the id separated by commas of column bone and lang and map to the corresponding table to get the names separated by commas of the bones and langs and pass it as a component of sys_refcursor.
Open the p_ccur for
Select * from a_os_lang_stls
where swb_number = p_sb_no
and PC_FLAG = 'C';
Could someone please help me how to convert the value separated by commas in a comma separated value new map to another table and pass it as part of the sys_refcursor.
Thanks in advance.
Kind regards
SB2011
Hello. Here are the queries for the two sys_refcursors.
(1) FOR THE FLAG = 'P '.
SELECT T1.ID,
T1. SWB_NUMBER,
T1. PC_NUMBER,
T1. PC_FLAG,
T1. INSTALLATION_ORD,
T1. SP_OR_LATER_VSN,
T1. PLATFORM,
T1. OS_CODE,
T2. LANG_CODE
DE)
SELECT T1.ID,
SWB_NUMBER,
PC_NUMBER,
PC_FLAG,
INSTALLATION_ORD,
SP_OR_LATER_VSN,
PLATFORM,
RTRIM (XMLAGG (XMLELEMENT(A,AG_OSCODE,',')). Extract ('//Text ()'), ',') OS_CODE
FROM (SELECT ID,
SWB_NUMBER,
PC_NUMBER,
PC_FLAG,
INSTALLATION_ORD,
SP_OR_LATER_VSN,
PLATFORM,
(COLUMN_VALUE). GETNUMBERVAL() os_id
Of a_os_lang_stls t, xmltable (os) t1) T1.
OS_dtls T2
WHERE T2.ID = T1. OS_ID
GROUP OF T1.ID,
SWB_NUMBER,
PC_NUMBER,
PC_FLAG,
INSTALLATION_ORD,
SP_OR_LATER_VSN,
T1 PLATFORM),
(SELECT T1.ID,
SWB_NUMBER,
PC_NUMBER,
PC_FLAG,
INSTALLATION_ORD,
SP_OR_LATER_VSN,
PLATFORM,
RTRIM (XMLAGG (XMLELEMENT(A,LANGNAME,',')). Extract ('//Text ()'), ',') LANG_CODE
FROM (SELECT ID,
SWB_NUMBER,
PC_NUMBER,
PC_FLAG,
INSTALLATION_ORD,
SP_OR_LATER_VSN,
PLATFORM,
(COLUMN_VALUE). GETNUMBERVAL() lang_id
Of a_os_lang_stls t, xmltable (lang) t1) T1.
lang_dtls T2
WHERE T2.ID = T1.lang_id
GROUP OF T1.ID,
SWB_NUMBER,
PC_NUMBER,
PC_FLAG,
INSTALLATION_ORD,
SP_OR_LATER_VSN,
T2 PLATFORM)
WHERE T1.ID = T2.ID
AND T1. SWB_NUMBER = T2. SWB_NUMBER
AND T1. PC_NUMBER = T2. PC_NUMBER
AND T1. INSTALLATION_ORD = T2. INSTALLATION_ORD
AND T1. PLATFORM = T2. PLATFORM
AND T1. PC_FLAG = "P";
(2) PC_FLAG FOR = 'C '.
SELECT T1.ID,
T1. SWB_NUMBER,
T1. PC_NUMBER,
T1. PC_FLAG,
T1. INSTALLATION_ORD,
T1. SP_OR_LATER_VSN,
T1. PLATFORM,
T1. OS_CODE,
T2. LANG_CODE
DE)
SELECT T1.ID,
SWB_NUMBER,
PC_NUMBER,
PC_FLAG,
INSTALLATION_ORD,
SP_OR_LATER_VSN,
PLATFORM,
RTRIM (XMLAGG (XMLELEMENT(A,AG_OSCODE,',')). Extract ('//Text ()'), ',') OS_CODE
FROM (SELECT ID,
SWB_NUMBER,
PC_NUMBER,
PC_FLAG,
INSTALLATION_ORD,
SP_OR_LATER_VSN,
PLATFORM,
(COLUMN_VALUE). GETNUMBERVAL() os_id
Of a_os_lang_stls t, xmltable (os) t1) T1.
OS_dtls T2
WHERE T2.ID = T1. OS_ID
GROUP OF T1.ID,
SWB_NUMBER,
PC_NUMBER,
PC_FLAG,
INSTALLATION_ORD,
SP_OR_LATER_VSN,
T1 PLATFORM),
(SELECT T1.ID,
SWB_NUMBER,
PC_NUMBER,
PC_FLAG,
INSTALLATION_ORD,
SP_OR_LATER_VSN,
PLATFORM,
RTRIM (XMLAGG (XMLELEMENT(A,LANGNAME,',')). Extract ('//Text ()'), ',') LANG_CODE
FROM (SELECT ID,
SWB_NUMBER,
PC_NUMBER,
PC_FLAG,
INSTALLATION_ORD,
SP_OR_LATER_VSN,
PLATFORM,
(COLUMN_VALUE). GETNUMBERVAL() lang_id
Of a_os_lang_stls t, xmltable (lang) t1) T1.
lang_dtls T2
WHERE T2.ID = T1.lang_id
GROUP OF T1.ID,
SWB_NUMBER,
PC_NUMBER,
PC_FLAG,
INSTALLATION_ORD,
SP_OR_LATER_VSN,
T2 PLATFORM)
WHERE T1.ID = T2.ID
AND T1. SWB_NUMBER = T2. SWB_NUMBER
AND T1. PC_NUMBER = T2. PC_NUMBER
AND T1. INSTALLATION_ORD = T2. INSTALLATION_ORD
AND T1. PLATFORM = T2. PLATFORM
AND T1. PC_FLAG = 'C ';
Tags: Database
Similar Questions
-
convert the column values to a single line...
I have to return the column values to a single line separated by commas.
If the nulls in the column just ignore without a comma.
Here is one for example. There are three values and two NULL values in the table
Help, pleaseSQL> select ID from temp_fa; ID ----- 1 2 3 5 6 rows selected. I am expecting an output as 1,2,3,5
There is always more than one title in the Oracle world ;)
You can use the TRIM, for example (same configuration as your example):hoek&XE> create table t as select level col from dual connect by level <= 6; Tabel is aangemaakt. hoek&XE> update t set col = null where col in (1,3,5); 3 rijen zijn bijgewerkt. hoek&XE> select * from t; COL ---------- 2 4 6 6 rijen zijn geselecteerd. hoek&XE> select ltrim(sys_connect_by_path(col, ','), ',') output 2 from ( select col 3 , row_number() over (order by col) rn 4 from t 5 ) 6 where connect_by_isleaf=1 7 start with rn=1 8 connect by rn = prior rn+1; OUTPUT ------------------------------------------------------------------------------------------------------------- 2,4,6,,, 1 rij is geselecteerd. hoek&XE> select trim ( both ',' from sys_connect_by_path(col, ',')) output 2 from ( select col 3 , row_number() over (order by col) rn 4 from t 5 ) 6 where connect_by_isleaf=1 7 start with rn=1 8 connect by rn = prior rn+1; OUTPUT ------------------------------------------------------------------------------------------------------------- 2,4,6 1 rij is geselecteerd.
-
A column value a comma, which leads to a column different while export to CSV file
Hi all
I have a few columns that will be built in the CSV file. The problem is in one of the column value of a comma in there. Thus, it creates a separate column two in CSv file.
For example:
Name of the column: description.
Value: Bumpers, cushion
But then that export in CSV file, it gives me bumper as a column and seat cushion in the second column.
I'm using Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production
Appreciate your help.
Thank you
Suresh
Hello
REPLACE (str
, '"'
, '"'
)
Returns a copy of the string str, but with all the ' "" ' changed substrigs in ' ' ' "
This assumes that your front-end is not treat & like variable substitution marker. If it is so, and -is your SQL * more escape character, then you can say
REPLACE (str
, '\"'
, '"'
)
-
Convert the column values into buckets
Hello
Please help me to convert the column values into buckets.
I have the values of the columns in the following way.
Age of Orderdate * 9 10 12 14 15 18 19 20 21 22 26 27 28 29 33 34 40 45 * and so on
But the requirement is the column values should be displayed in form
Age by order date * 15 1 2 3 4 5 6 7 8 9 10 11 - 16-20 21-25, 26-30 30 + *.
Please someone give me the solution.
Thanks in advance.
Hervé RamaHi Richard,
Just to double check, you have Setup buckets for 1, 2, 3, 4, 5, 6, 7 and 8 individually (each with a fair value). The problem is that you simply do not have all data fall into buckets above, correct?
If this is the case, it looks like has been answered your original question. If so, the label would assign 'Proper' points by clicking on the button label correct next to the appropriate response and open a new thread with your new question. The reason why I say this is it will help other people who have a similar bucket question to your solution, without complicating the issue with subsequent questions.
If you can post a separate thread, I'd be more than happy to help you with your secondary problem.
Best regards
-Joe
-
Change column values become the row values
Hi, how to make the column values become row values as below, please advise and thanks. SELECT sc.configuration, sc.item_type, st.producttype, st.productfamily, sc.multidrive, sp.internalproductname FROM seaeng_productmodel sp , seaeng_stmodel st, seaeng_ccitemnumber sc WHERE sc.productmodelnumber = sp.productmodelnumber AND sp.stmodelnumber = st.stmodelnumber and sc.ccitemnumber = '9NH2D4-575' Output CONFIGURATION ITEM_TYPE PRODUCTTYPE PRODUCTFAMILY MULTIDRIVE INTERNALPRODUCTNAME CUST UNIQUE CC DRIVE FREEAGENT GO 5400.1 FAMILY N SLIPSTREAM Expected to be converted as below, COLUMN NAME COLUMN VALUE CONFIGURATION CUST UNIQUE ITEM_TYPE CC PRODUCTYPE DRIVE PRODUCTFAMILY FREEAGENT GO 5400.1 FAMILY MULTIDRIVE N INTERNALPRODUCTNAME SLIPSTREAM
You mean like this?
SQL> select * from emp where empno = 7788; EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO ---------- ---------- --------- ---------- ------------------- ---------- ---------- ---------- 7788 SCOTT ANALYST 7566 19/04/1987 00:00:00 3000 20 SQL> ed Wrote file afiedt.buf 1 select decode(rn,1,'EmpNo',2,'EName',3,'Job',4,'Mgr',5,'HireDate',6,'Sal',7,'Comm','DeptNo') as column_name 2 ,decode(rn,1,to_char(EmpNo),2,EName,3,Job,4,to_char(Mgr),5,to_char(HireDate,'DD/MM/YYYY'),6,to_char(Sal),7,to_char(Comm),to_char(DeptNo)) as column_value 3 from emp, (select rownum rn from dual connect by rownum <= 8) 4* where empno = 7788 SQL> / COLUMN_N COLUMN_VALUE -------- ---------------------------------------- EmpNo 7788 EName SCOTT Job ANALYST Mgr 7566 HireDate 19/04/1987 Sal 3000 Comm DeptNo 20 8 rows selected. SQL>
-
Transpose the unique column values online
Hi all
How to transpose the values of one column in a row,
COL
1
2
3
4
5
6
7
8
and I want to convert this column into the line as follows:
Line (each in a separate column value). Number of values is not constant.
1,2,3,4,5,6,7,8
Solution without converting them to XML:
WITH row_values
AS (SELECT DISTINCT property_name,
column_order
OF v_rd_property_definition
WHERE lp_id = 5171
ORDER BY column_order)
SELECT Regexp_substr(Wm_concat(property_name), "[^,] +' 1, 1") AS col1,.
Regexp_substr (Wm_concat(property_name), "[^,] +' 1, 2"). AS col2.
Regexp_substr (Wm_concat(property_name), "[^,] +' 1, 3") AS col3.
Regexp_substr (Wm_concat(property_name), "[^,] +' 1, 4") AS col4,.
Regexp_substr (Wm_concat(property_name), "[^,] +' 1, 5") AS col5,.
Regexp_substr (Wm_concat(property_name), "[^,] +' 1, 6") AS col6,.
Regexp_substr (Wm_concat(property_name), "[^,] +' 1, 7") AS col7
OF row_values;
-
two column values in a single column
Hi guys,.
I have a requirement that i want to be viewing the two column values in a single as column... values year & product will be exposed in a unique column values
Kind regards
Sree
Karthickumar Pillaiyarsamy yours is a database, in OBIEE is similar with some limitations...
Sree! you have 2 ways to do this: by using the CONCAT function or the | operator, examples here are 2 concatenating year, a space and production:
"Time". "" T05 annually name | ' ' || ' 'Products ' '. Product P1.
CONCAT ("Time". "T05 per year of name', CONCAT (" ","Products".)" P1 product"))
CONCAT in OBIEE accept only 2 params, so you if want to add a space between the 2 items, you must nest your function call.
In case your year column is a number, you can convert it to a string using CAST ("your column" as VARCHAR (10)).
-
Reports - the values of the checkbox and the conditional column visibility
Although I use Oracle databases for many years, I must admit that I am rather new to APEX. I build a first prototype project to convince our project managers and managers of the usefulness of the product for future projects (as for interfaces Visual of the database where the focus is on forms and reports, it is often quicker and cheaper to build an APEX application instead of a webapp in Java or c# full blown).
I have a few problems however.
I'll start with a quick description. I have the following structures of parent/child:
Provinces > cities > Intersections > earrings > detections in loop.
Basically, I want to do a report on detections of loop. Now, as we have thousands of detections someday, I did kind of a mining structure down. First, you choose your province, then the city, then the intersection and finally the loop. Do not use the lists to make the selection. Instead, I did a (classic) report on each side because it allows me to give detailed information for each part. In each report, I made a link on the identifier. For example, when I select a province (by clicking on the link), I pass the identifier of the province of cities report and use it in the query to restrict my report to these cities in the province. I repeat these step for different parts, which, in the end, gives me the selected loop loop detections. The good news is that all this works very well. However, the person who will use this application made a suggestion and asked if it would be possible to select different loops and thus get the detections for several loops (the rest of the application remains the same). However, this means that I can't use the link in the column more. Now, I thought in the sense of a checkbox control. The link to the column is still there, but the user would also have the possibility to select several items in the report. I have managad to add a checkbox control to the report, associated with the loop identifier column. It's not really hard. I can't understand, however, how I can pass the identifiers found in the next report (detections for the selected loops) and use it in the report's underlying query. The problem is, I do not know how to pass the values checked to the next page and how to use these values in the request of the State of this page. I guess it must be possible, but I couldn't figure out how. I tried to play with APEX_APPLICATION. G_Fxx and others. Don't forget I'm a newbie and this seems to be more advanced features.
I downloaded the images from the 2 on the pages of the report to illustrate:
http://img96.imageshack.us/img96/1497/apex01.jpg
http://img140.imageshack.us/img140/9868/apex02.jpg
A second point that's bothering me is this. In the loop detection report, I show a link column (I chose an icon instead of the value of the column) for each line. I also have a column that displays the number of detections for the given line (and one day). Now, for some lines, there is no detection that has emerged. Therefore, there is no point in the selection of this loop, because the result will be a blank report. However, I still want to show the loop in the loop selection report, as it is always present (it is not as if he suddenly disappeared). Of course, no big problem and most users probably have sufficient intelligence to understand this. However, it would be nice if I could do the icon (link colum) visible only for these loops with detections, or in other words, for these recordings in which number_of_detections (COUNTY of underlying column) is greater than 0. I couldn't find a way to do it either. The conditional display for a column option didn't really offer me a solution here.
Before I forget, I use APEX 4.0.1 on an Oracle XE database.
Any advice or suggestions would be welcome! :)
Thank you.
ErwinHello
You mean something as in this example
https://Apex.Oracle.com/pls/OTN/f?p=40323:55You can store the values checked into collection and then use it in another report where clause
See for example this post for how you can memorize checked lines to the collection
Re: Need help with APEX_CollectionIn the sample report DEPT query is
SELECT CASE WHEN EXISTS(SELECT 1 FROM emp e WHERE e.deptno = d.deptno) THEN APEX_ITEM.CHECKBOX(1,c.c002,'onclick="saveDeptChk(this,'||c.seq_id||')"','true') END AS row_selector, c.c002 AS checked, d.DEPTNO, d.DNAME, d.LOC FROM dept d, apex_collections c WHERE c.collection_name = 'DEPT_CHK_COLLECTION' AND d.deptno = c.c001
And the report on EMP
SELECT e.EMPNO, e.ENAME, e.JOB, e.MGR, e.HIREDATE, e.SAL, e.COMM, e.DEPTNO FROM emp e, apex_collections c WHERE c.collection_name = 'DEPT_CHK_COLLECTION' AND c.c002 = 'true' AND e.deptno = c.c001
Kind regards
Jari -
By the way a column value to Javascript
Hi all
I have an interactive relationship with the following SQL:
Select
EmpNo,
Ename,
"< a href =" # "onclick = 'test ("show it");' > ' |" jobs jobs | "< /a > ' job
de)
Select 10 empno, ename 'John', 'Manager' of the double job
Union
Select the 20 empno, ename 'Bookmark', 'Clerk' double work
)
Here is the definition of the test() function:
< script type = "text/javascript" >
function test (x) {}
Window.Alert (x);
}
< /script >
The report works very well. I can click on the column values of work e.g. Manager, the value hardcoded clerk alerts and function 'show it '. I want to show the value of employment, so if I click Manager, the alert must be 'Manager' and if I click on clerk then the alert should be "clerk." I tried to call the function like test(#job#) but no use.
Help, please.
Thank you
ZKay wrote:
I have an interactive relationship with the following SQL:
Select
EmpNo,
Ename,
'' | job |'' as job
de)
Select 10 empno, ename 'John', 'Manager' of the double job
Union
Select the 20 empno, ename 'Bookmark', 'Clerk' double work
)
Here is the definition of the test() function:
function test(x) {
window.alert(x);
}
The report works very well. I can click on the column values of work e.g. Manager, the value hardcoded clerk alerts and function 'show it '. I want to show the value of employment, so if I click Manager, the alert must be 'Manager' and if I click on clerk then the alert should be "clerk." I tried to call the function like test(#job#) but no use.
It does not seem very useful, but all that is needed is to concatenate the value of employment in the event hours code:
select empno, ename, '' || job || '' as job from( select 10 empno, 'John' ename, 'Manager' job from dual union select 20 empno, 'Mark' ename, 'Clerk' job from dual )
-
By using the link in the column to pass column values
Hello
I have a link to the column in my report which opens a modal page, now I want to use the value of the column clicked in the page that opens.
I don't want to put any article on the opening page of the column value of click rather I want to use the value of the column of the click in my sql query.
for example:
1 P1 has the report < column link by clicking on it opens P2 >
2. on page 2, I want to use the value of the clicked column.
So far, I did
1 link to page 2
2. ask - #column_value_clicked #.
3. in the sql query, I use the same above in the where clause.
Any help...
Thank you
Rakesh
fac586 wrote:
Sunil Bhatia wrote:
Hi Rakesh,
Make use of x 01 parameter included in apex 5.0
You can create a URL to page 1 as:
f? p = 103:1:3241341234123: & x 01: #column_value_clicked #.
Make use on request P2 in the form:
Select * from test_table where id = APEX_APPLICATION. G_X01;
You have not tested who, did you?
I tested it buddy.
Link https://apex.oracle.com/pls/apex/f?p=56971
Click any bar chart and then wait that he freshen up.
Click on report of ENAME and see that he went through the parameter.
Report URL: f? p = 56971:2: & APP_SESSION. : No.: & x 01 = #ENAME #.
-Sunil Bhatia
-
Put text Logo with SORT column values?
Hello
I have a page open IRR w / filters IRR past as follows.
.. /f?p=200:21:0::no:CIR:IREQ_RELEASE,IREQ_PLATFORM:11.2.0.4,Linux:Yes I want to give the page a title with the SORT column values passed as follows.
"LINUX 11.2.0.4 Report" on the text Logo.
Is it possible that I can do this? Or if not possible, a way to put it on the field of text or something?
Hello
To set the value of your property, you will need to pass something in it:
https://Apex.Oracle.com/pls/Apex/f?p=9086:2:113599573679605:P2_TITLE:Linux % 20Server % 20Report
So when I had a session in your application and a value passed to the item value has changed
I'm not fully grasp what you are trying to reach. Are you try to click on the pencil edit go to one another form of change in the title of your page will be set to the column name in the report on your previous page?
You try to dynamically update an element on the page you are on when a filter is added?
If you can give me more tips, I'm happy to help, if your app is just a demo app on apex.oracle.com and you are happy for me to connect and make changes that might help, I'm happy to do.
Thank you
Paul
-
I have two tables (2) RESULT TAB (1)
CREATE TABLE TAB
(
NUMBER OF SNO
A NUMBER,
B THE NUMBER.
NUMBER OF THE SUM
);
CREATE AN ARRAY OF RESULT
(
NUMBER OF SNO
NUMBER OF THE SUM
)
my doubt is:
(1) I want to insert a table TAB, my question is how to insert a column to the SUM using the column A AND B... Here im adding two values of the column and store result in the AMOUNT column.
SNO A B SUM
1 100 150 250
2 300 100 400
I want to like this, it is possible with single insert query?
(2) at the time of the insertion TAB of values that SNO, and the values of table TAB $ insert in the table of RESULTS... is it possible these two inserts at the same time?
in fact, im using another this table.fro TAB and easy to understand I write like that, please solve this problem
First, you post in the wrong forum as this one is only for Oracle's SQL developer tool. So you might ask your question in the general forum of SQL.
Second, you might solve your problems with bind variable:
Insert tab
(sno, a, b, sum)
values
(: SNO,: A: B: A + B :))
You should not use sum as column name because it is a reserved word.
More you cannot insert into two different tables with a single SQL, but you can use PL/SQL to do this:
Start
insert into tab values (: SNO,: A: B: A + B :);)
insert into result values (: SNO,: A + B :);)
end;
If you meet sno from a sequence, you could do something like this:
Start
insert into values tab (seq_sno.nextval,:,: B,: A +: B) return sno in: SNO.
insert into result values (: SNO,: A + B :);)
end;
Hope that helps,
dhalek
-
Hello
I have the table as below, I need to replace the name column value b with X.how to get it.
Table
ID name 1 one 2 b 3 c 4 d 5 e Output
ID name 1 one 2 X 3 c 4 d 5 e Hello
Maybe a little decode?
select id, decode( name, 'b', 'X', name) from ...
concerning
Kay
-
Compare the column values for multiple lines
I am new to oracle and I have a requirement to compare the values of column across multiple lines. If all column values are the same, I want to display that value, if the columns are not the same, I need to display 'no match' as value. I need id to group values and display a status value based on the above logic. Can anyone offer assistance with dispalying the result expected below?
Sample
Table
State ID
1 S
2 L
1 S
2 S
expected results
State ID
1 S
2 no match
Hello
That's what you asked for:
SELECT id
CASE
WHEN COUNT (DISTINCT status) > 1
THEN "no match."
For ANOTHER MIN (status)
The END as status
T
GROUP BY id
;
Want that if each State ID is NULL? The CASE expression above returns NULL in this situation.
-
Merge two column in single column value
Team,
I have a requirement where in I need to merge 2 column values in a single column.
e.g. I Percent_complete column in my table. and my table has only one record.
I need to ask questions that I need to store the values of percent_complete and (100-percent_complete) in a single column.
ex
Percentage complete is set to 30.
I need to select the 30 and 70 (100-30) both in a single column.
Thank you
If you mean like this?
SQL > ed
A written file afiedt.buf1 with t (select 30 as double percent_complete)
2 --
3 end of test data
4 --
5. Select decode(rownum,1,percent_complete,100-percent_complete) as percent_complete
6 t
7 * connect by rownum<=>=>
SQL > /.PERCENT_COMPLETE
----------------
30
70
Maybe you are looking for
-
I'm not being updated to Yosemite or El captain, but my iPhoto has randomly stopped working. It will allow me to select the photos in my photo gallery and to import, but the application closes the right eventually. When I open it again my pictures
-
I have windows 7 and mozilla firefox. When I try to delete a particular file of office it says that it cannot be removed because it is open in the mozilla firefox program. I restarted the computer, but again, he won't. How can I close mozilla and reo
-
Tecra 8100 - no sound except in mic!
I have a Tecra 8100 Windows XP. I can't get sound on the speakers or the headphones emitted by the computer, such as beeps, CD, etc. But if I have to reactivate the microphone, I can hear through the headset, ensure that the microphone picks up (ther
-
Hello. I just installed victory victory 8, 8.1, in my vaio, a svs13a12fxs. I've noticed a few problems with the touchpad synaptics, as the multigestore function did not work properly, so I uninstalled it a I tried to reinstall with the sony page driv
-
NI PCI-6250 connection equivalent laptop USB or PCI-6250
Hi all I want to connect a 6250 PCI card to the laptop. Is there a way I can do? Are there any equivalent USB for this? Thanks in advance,