use a SQL query in a backing bean
HelloI would like to know how to run an SQL query in a method of bean to support, what is the code I tried, its purpose is to fill in the field "cin" with data from my database, here is the Code:
public String cb2_action() {}
BindingContainer links = getBindings();
OperationBinding operationBinding = bindings.getOperationBinding ("CreateInsert");
Object result = operationBinding.execute ();
If (! operationBinding.getErrors () .isEmpty ()) {}
Returns a null value.
}
DCIteratorBinding dciter = (DCIteratorBinding) bindings.get ("PersonneView1Iterator");
Line row = dciter.getCurrentRow ();
Statement stmt = this.getDBTransaction () .createStatement (1);
try {}
ResultSet rs = stmt.executeQuery ("select max (cin) person");
While {(rs.next ())}
row.setAttribute ("cin", rs.getInt (1) + 1);
}
} catch (SQLException ex) {}
ex.printStackTrace ();
}
return 'go. '
}
at runtime, it gives an error on this line: statement stmt = this.getDBTransaction () .createStatement (1);
Please check and correct me
Thanks in advance
Hello
Initially, I want to say that this should not be used if you try to get a PrimaryKey that would create serious concurrency problems.
For example, lets say you want when you create a new employee to define its equal to the max Department DepartmentId.
We could create a readOnly VO (lets call it MaxDepartmentId) with a query that returns the departmentId max:
select max(Department_Id) as maxDep from Departments
After that, he must add the VO of MaxDepartmentId as a ViewAccessor in our Vo employees,
Override the create() method in the EmployeesRowImpl and add the code like this:
public class EmployeesRowImpl extends ViewRowImpl {
@Override
protected void create(AttributeList attributeList) {
Row r=getMaxDepartmentId().first();
if(r!=null){
Number max=(Number)r.getAttribute("Maxdep");
attributeList.setAttribute("DepartmentId", max);
}
super.create(attributeList);
}
}
That's all.
If you run this, you'll see that when you create a new employee, it has a default value.
Gabriel.
Tags: Java
Similar Questions
-
How to select only the part by using the sql query
Hello
I have the task to retrieve only the integral of the input text by using the sql query.
The entry is as follows
Entry for the price setting
$12.5 (FYI without space)
$ 12.5 (FYI single space)
$ 12.5 (double space FYI)
$12.5 (FYI multiple space)
$12.5 (FYI multiple space)
Output expected of 12.5
The price is the type varchar2 column in the store_price table.
Please let me know how to achieve this.
Thanks in advance.
If this is always the case that you get a $ followed by a number of places, you can use something like:
Select to_number (ltrim ('$ 12.5',' $')) DOUBLE
or
SELECT ltrim ('$ 12.5',' $') OF double
but take care of your nls_numeric_character settings if they are defined so that, for example, a comma is the decimal separator, you will have a problem.
HTH
-
How to know the status of the process flow using a SQL query
Hello
I want to know the final status of a process flow after execution by using a sql query?
The available entries are:
-Item_Key
-Process_Flow_Package_Name
-Process_Flow_Name
I ran the process flow using a WF_Engine.LaunchProcess ()procedure, but I was not able to know the status of the process flow.
Is it possible to know the status of the process flow?
using a procedure or an sql query?
Thanks in advance,
SriGP.Once the process is completed, or not, you can see the status by calling:
UAS (your_OWF_shema) .wf_engine. ItemStatus()
-
Dependencies of object database by using the SQL query?
Hi guys,.
I just see the nice feature to discover the database object dependencies in the APEX (generator application-> app 123-> utilities-> database object dependencies).
Is there a way to get this dependencies just with a SQL query? Also should I calculate a process in order to get the current dependencies? In APEX, you press a calculate button before you can see the dependencies.
Thanks in advance and greetings from the Germany
Steven
After you import the app Builder application APEX 4500, I saw that the Start button the following process:
wwv_flow_theme_manager.find_object_dependencies (p_flow_id =>: fb_flow_id, p_page_id-online null);
In my example I can't use it, only the APEX_050000 user has privileges to use, and you must grant the privileges of your schema, so if you want to use it inside your application. My application must be independent of the schema and the specific database.
Also it is not recommended to use this procedure because it is one of the procedures not supported that are only used by oracle.
-
How to achieve this using the sql query?
Hello gurus,
I have a table like this
now my result should be like thisid name 1 a 2 b 3 c 4 d 5 e 6 f 7 g 8 h 9 i 10 j 11 k 12 l 13 m
How to achieve by sql query?id name id name id name 1 a 6 f 11 k 2 b 7 g 12 l 3 c 8 h 13 m 4 d 9 i 5 e 10 j
Thank you and best regards,
friend
Edited by: most wanted! February 22, 2012 05:55Hello
Did you mean this:
with a as (select 1 id ,'a' name from dual union all select 2 id ,'b' name from dual union all select 3 id ,'c' name from dual union all select 4 id ,'d' name from dual union all select 5 id ,'e' name from dual union all select 6 id ,'f' name from dual union all select 7 id ,'g' name from dual union all select 8 id ,'h' name from dual union all select 9 id ,'i' name from dual union all select 10 id ,'j' name from dual union all select 11 id ,'k' name from dual union all select 12 id ,'l' name from dual union all select 13 id ,'m' name from dual ) select id_1 ,name_1 ,id_2 ,name_2 ,id_3 ,name_3 from ( select id id_1 ,name name_1 ,lead(id,5) over (order by id) id_2 ,lead(name,5) over (order by id) name_2 ,lead(id,10) over (order by id) id_3 ,lead(name,10) over (order by id) name_3 ,rownum r from a ) where r <=5 D_1 NAME_1 ID_2 NAME_2 ID_3 NAME_3 ---------------------- ------ ---------------------- ------ ---------------------- ------ 1 a 6 f 11 k 2 b 7 g 12 l 3 c 8 h 13 m 4 d 9 i 5 e 10 j
Kind regards
Peter
-
Column of the row on a table (using the SQL query)
Data in my table looks like this.
Data in the table
===============
COL_1, COL_2
---------- ----------
1 ABCD
2 ABC
3 ABCDE
4 AB
5 ABCDEFGH
Now, he must, for the entire line, length COL_2 text exceeds 3, display the text remaining in the new line. For example, the first row (COL_1 = 1), COL_2 length is 4, so in SQL output two lines will be displayed as shown below. Also, the last row (COL_1 = 5), the length is 8, then, in SQL, output 3 lines will be displayed as below. And for the COL_1 = 2 & 4, only 1 rank will be displayed as the text COL_2 length is less than or equal to 3.
OUTPUT
===============
COL_1, COL_2
---------- ----------
1 ABC
1 D
2 ABC
ABC 3
3 DE
4 AB
5 ABC
5 DEF
5 GH
We need to implement using SQL only.
Hello
the solution of etbin uses recursive subquery factoring available on Oracle 11 g 2.
Since you have not mentioned your version I write here 2 alternatives using CONNECT BY and Xquery:
with mydata as
(
Select 1 c1, c2 'ABCD' Union double all the
Select 2, 'ABC' from dual union all
Select 3, 'ABCDE' from dual union all
Select option 4, "AB" dual union all
Select 5, "ABCDEFGH" of the double
)
Select c1, substr (c2, level * 3-2, 3) C2
of mydata
connect by substr (c2, level * 3-2, 3) is not null
and c1 = c1 prior
and prior dbms_random.random is not null;
C1 C2
---------- ---
1 ABC
0%
2 ABC
ABC 3
3
4 AB
5 ABC
5 DEF
5 GH
9 selected lines.
with mydata as
(
Select 1 c1, c2 'ABCD' Union double all the
Select 2, 'ABC' from dual union all
Select 3, 'ABCDE' from dual union all
Select option 4, "AB" dual union all
Select 5, "ABCDEFGH" of the double
)
Select a.c1, x.c2
of mydata one
, xmltable ("ora: tokenize($c2,",")")
passing regexp_replace (a.c2, '(.{1, 3}) \1 ',',') as "c2".
path of columns c2 varchar2 (30) '.'
) x
where x.c2 is not null;
C1 C2
---------- ------------------------------
1 ABC
0%
2 ABC
ABC 3
3
4 AB
5 ABC
5 DEF
5 GH
9 selected lines.
Edit: corrected the Xquery solution using a simplified regexp_replace.
Kind regards.
Alberto
-
generations of months using the sql query
Hello
Based on the input of date parameter, I need display every month in the current year and last year.
For example, suppose that my setting date is December 5, 14 ', I need the output below.
JANUARY
FEBRUARY
MARCH
APRIL
MAY
JUNE
JULY
AUGUST
SEPTEMBER
OCTOBER
NOVEMBER
DECEMBER
JANUARY
FEBRUARY
MARCH
APRIL
PEUT
Until the month of May and the month last year. I came with the request. Please find the following query.
Select to_char (add_months (trunc(sysdate,'year'), level-1), 'MONTH') mth
of the double
connect by level < = 12
Union of all the
Select to_char (to_date (ddate, 'MM'), 'MONTH') month
(select 1 + rownum - 1 ddate
from user_objects
where (1 + rownum - 1) < = to_number (to_char (to_date ('12-05-14', ' dd-mm-yy'), 'mm')));
But I don't want to use the data user_objects dictionary. Can you please guide how to achieve this output, or can u give me some other request too if possible.
Thank you
Siva
Try the below
SELECT TO_CHAR (ADD_MONTHS (ADD_MONTHS (TRUNC (TO_DATE(:date1,'DD-MM-YY'), 'MM'),
((- MONTHS_BETWEEN (trunc (to_date(:date1,'DD-mm-YY'), 'MM'), trunc (to_date(:date1,'DD-mm-YY'), 'YY')) + 12)).
(LEVEL-1))
, 'MONTHS '.
'NLS_DATE_LANGUAGE = ENGLISH') FROM dual months_between
CONNECT BY LEVEL<=>=>
-
Change the font color in a report by using the SQL query
Hello
I'm changing the font color based using a BOX the query in the form below:
I can get this working by selecting the Standard report column in the type of the column header . However this to say that I can't use the LOV LOV options involve removing the HTML characters.select "ORDER_ID", "ORDER_REFERENCE", "ORDER_DATE", "ORDER_SOURCE", "TOTAL_DISCOUNT", "DELIVERY_TYPE", "PICKUP_DATE", case when order_status = 1 then '<font color="red">'|| order_status||'</font>' else '<font color="blue">'||order_status||'</font>' end order_staus, "DELIVERY_STATUS", "USER_ID", "CUSTOMER_ID", "SITE_ID" from "ORDERS"
Is there a way I can conditionally change the font with the above query and use LOV as well? Thank you.
Environment
Apex 4.1.1 to apex.oracle.com
Theme 13
Published by: taepodong on June 3, 2012 07:28I'm sure that not looking the application form first before posting this question.
Your solution would be:
Please edit your report column under > report attributes > and select the property view as as a Standard report column -
How to get the reconciliation AD event data using the SQL query.
Hi all
I was trying to get all the recon data to target AD Recon of IOM db, but it seems that at the OIM 11 g we have recon not given in the tables: UCR, CRE, etc.. Use tables "RECON_"... ', my question is all no bady has example query to extract data from recon tables?
The best
MPIt should be a matter of linking your reconciliation table of user AD (early RA_) with the RECON_EVENTS of RE_KEY table.
In my case, I have user OID reconciliation (so my RA_ table will be different to yours) and can use something like:
SELECT RECON_EVENTS. RE_STATUS, RECON_EVENTS RA_OIDUSER5.*, RA_OIDUSER5 WHERE RECON_EVENTS. RE_KEY = RA_OIDUSER5. RE_KEY;
Of course, then depends on what information you want to filter and recover.
-
Given multiple options to get filled by using the SQL query
I have the following data in the table.
I want to fill the column custid with a few conditions.
(1) If a client is on a loan account as custid must get filled. (for example: 124)
(2) if the multiples are on a single loan account then
(a) if one of the clients has rolename = "w1" then it must be filled. (for example: 125)
(b) If several customers a rolename = "w1" then custid minimum should get populated(eg:123)
(c) If none of the clients has rolename = "w1" then custid minimum should get populated(eg:126)
LOANNO ROLENAME CUSTID
123 X 1
123 2 W1
123 3 W1
124 Y 4
5 125
125 6 W1
7 126
8 126
9 126
And my output looks like
LOANNO ROLENAME CUSTID
123 2 W1
124 Y 4
125 6 W1
7 126
I tried the departure from
SELECT ACCNO, ROLENAME, MIN (CUSTID)
FROM TABLENAME
ACCNO GROUP, ROLENAME
HAVING ROLENAME = "W1".
How to all conditions.
Could you please help in this?
I tried again on that.
Thanks in advance.
Concerning
KVBHello
I see now: you do not want the Group BY accno both rolename; that would produce a line of output for each combination separate accno / rolename. You want only one line of output for each separate accno.
One way to do that is a Query of Top - N , like this:WITH got_r_num AS ( SELECT accno, rolename, custid , ROW_NUMBER () OVER ( PARTITION BY accno ORDER BY CASE WHEN rolename = 'W1' THEN 1 ELSE 2 END ) AS r_num FROM table1 ) SELECT accno, rolename, custid FROM got_r_num WHERE r_num = 1 ;
You could do it with GROUP BY, but it's messy:
SELECT accno , MIN (rolename) KEEP ( DENSE_RANK FIRST ORDER BY CASE WHEN rolename = 'W1' THEN 1 ELSE 2 END , custid ) AS display_rolename , MIN (custid) KEEP ( DENSE_RANK FIRST ORDER BY CASE WHEN rolename = 'W1' THEN 1 ELSE 2 END ) AS display_custid FROM table1 GROUP BY accno ;
-
APEX: Use the SQL query in the APEX_MAIL package
Hi all
I'm creating an application in which I want to extract records from table and send it to the user. Please help me on this.
Thank you
MartinHello I am,.
You can see the code below.
DECLARE
l_body_html CLOB.
l_body CLOB.
BEGIN
l_body: = 'Hello Daniel. "l_body_html: = '
'; ';Name of the law Law on ESCR Measures Act Name of the server Restart Date C1 in (select distinct (act_name), act_desc, act_steps, reboot_date servername HWC_CHK_SCHEDUELE where chk_name =: P2_SELECT_CHECKLIST and reboot_date =: P2_REBOOT_DATE)
loopl_body_html: = l_body_html | '
' || C1.act_name | ' ' || '' || C1.act_desc | ' ' || '' || C1.act_steps | ' ' || '' || C1. SERVER_NAME. ' ' || '' || C1.reboot_date | ' ';end loop;
l_body_html: = l_body_html | '
l_body_html: = l_body_html | '
' || "Thanks & Regards | '
';
l_body_html: = l_body_html | "Patel Dr.Jiten";() apex_mail. Send
p_to =>: P2_EMAIL,
P_FROM-online "[email protected]."
p_body-online l_body,
p_body_html-online l_body_html,
p_subj => "You must work on ABC named Checklist");
END; -
SQl query to find out time between the different lines of transactions
(See both images from an attachment to get the clear picture of the data and understand the question correctly.)
I have a set of data like this in one of my paintings. (This is a simple representation of the original data.)
Reference table1.jpg
Id | Type | Value | Start_date | End_date
----------------------------------------------------------------------------------------------------------------------
ZTR0098 | ALLOW | 0 | 1 JUN | 2 JUN |
ZTR0098 | ADTAX | 0 | 1 JUN | 2 JUN |
ZTR0098 | MXTAX | 0 | 1 JUN | 9 JUN |
ZTR0098 | ALLOW | 4. 3 JUN | 15 JUN |
ZTR0098 | ADTAX | 44.00 | 3 JUN | 17-JUNE |
ZTR0098 | MXTAX | 2. 10 JUN | 17-JUNE |
ZTR0098 | ALLOW | 5. 16-JUNE | 20 JUN |
ZTR0098 | ADTAX | 55,34 | 18 JUN | 22 JUN |
ZTR0098 | MXTAX | 1. 18 JUN | 25 JUN |
ZTR0098 | MXTAX | 6. 26 JUN | 31 AUG |
ZTR0098 | ADTAX | 20.09. 23 JUN | 23 JUL |
ZTR0098 | ALLOW | 8. 21 JUN | 31 AUG |
ZTR0098 | ADTAX | 45. 24 JUL | 31 AUG |
each line has a type and a rasthaus id to it. ID belongs to other parent tables. the value of each type is given, and the validity of each value is followed by a field start_date and end_date.
All values start from 1 - JUN and expires on 31 - AUG. Now my requirement is to obtain a report that gives three columns for three different types (ALLOW, ADTAX and MXTAX) with combination of unique values in the effective time interval. Let me put the result below.
Reference table2.jpg
Id | ALLOW | ADTAX | MXTAX | Start_date | End_date
--------------------------------------------------------------------------------------------------------------------------------------------------
ZTR0098 | 0 | 0 | 0 | 1 JUN | 2 JUN |
ZTR0098 | 4. 44.00 | 0 | 3 JUN | 9 JUN |
ZTR0098 | 4. 44.00 | 2. 10 JUN | 15 JUN |
ZTR0098 | 5. 44.00 | 2. 16-JUNE | 17-JUNE |
ZTR0098 | 5. 55,34 | 1. 18 JUN | 20 JUN |
ZTR0098 | 8. 55,34 | 1. 21 JUN | 22 JUN |
ZTR0098 | 8. 20.09. 1. 23 JUN | 25 JUN |
ZTR0098 | 8. 20.09. 6. 26 JUN | 23 JUL |
ZTR0098 | 8. 45. 6. 23 JUL | 31 AUG |
As you can see there are no duplicate rows for a combination of (ALLOW, ADTAX and MXTAX) with their respective dates in force. resulting in the above table. the first step is to convert lines to the column which is pretty obvious to do that by grouping on start_date and end_date colum, but the real deal is the time interval during which the combination of the values (ALLOW, ADTAX, and MXTAX) has remained constant.
I wrote under query using Group by.
Select
ID,
NVL (max (decode (type, "ALLOW", value)), 0) as ALLOW
NVL (max (decode (type, 'ADTAX', value)), 0) as ADTAX
NVL (max (decode (type, 'MXTAX', value)), 0) as MXTAX
Start_date,
End_date
from my_table
Group of start_date, end_date, id
start_date, end_date
the results it gives are like this:
Reference table3.jpg
Id | ALLOW | ADTAX | MXTAX | Start_date | End_date
------------------------------------------------------------------------------------------------------------------------------------------------
ZTR0098 | 0 | 0 | 0 | 1 JUN | 2 JUN |
ZTR0098 | 0 | 0 | 2. 1 JUN | 9 JUN |
ZTR0098 | 4. 0 | 0 | 3 JUN | 15 JUN |
ZTR0098 | 0 | 44.00 | 0 | 3 JUN | 17-JUNE |
ZTR0098 | 0 | 0 | 2. 10 JUN | 17-JUNE |
ZTR0098 | 5. 0 | 0 | 16-JUNE | 20 JUN |
ZTR0098 | 0 | 55,34 | 0 | 18 JUN | 22 JUN |
. .
. .
like wise
but I'm not able to determine the time intervals by using the SQL query.
with
Table1 as
(select the id 'ZTR0098', 'ALLOW' type, 0 val, to_date('1-JUN','dd-MON') start_date, end_date Union to_date('2-JUN','dd-MON') double all the)
Select 'ZTR0098', 'ADTAX', 0, to_date('1-JUN','dd-MON'), to_date('2-JUN','dd-MON') of all the double union
Select 'ZTR0098', 'MXTAX', 0, to_date('1-JUN','dd-MON'), to_date('9-JUN','dd-MON') of all the double union
Select 'ZTR0098', 'ALLOW', 4, to_date('3-JUN','dd-MON'), to_date('15-JUN','dd-MON') of all the double union
Select 'ZTR0098', 'ADTAX', 44.00, to_date('3-JUN','dd-MON'), to_date('17-JUN','dd-MON') of all the double union
Select 'ZTR0098', 'MXTAX', 2, to_date('10-JUN','dd-MON'), to_date('17-JUN','dd-MON') of all the double union
Select 'ZTR0098', 'ALLOW', 5, to_date('16-JUN','dd-MON'), to_date('20-JUN','dd-MON') of all the double union
Select 'ZTR0098', 'ADTAX', 55.34, to_date('18-JUN','dd-MON'), to_date('22-JUN','dd-MON') of all the double union
Select 'ZTR0098', 'MXTAX', 1, to_date('18-JUN','dd-MON'), to_date('25-JUN','dd-MON') of all the double union
Select 'ZTR0098', 'MXTAX', 6, to_date('26-JUN','dd-MON'), to_date('31-AUG','dd-MON') of all the double union
Select 'ZTR0098', 'ADTAX', 20.09, to_date('23-JUN','dd-MON'), to_date('23-JUL','dd-MON') of all the double union
Select 'ZTR0098', 'ALLOW', 8, to_date('21-JUN','dd-MON'), to_date('31-AUG','dd-MON') of all the double union
Select 'ZTR0098', 'ADTAX', 45, to_date('24-JUL','dd-MON'), to_date('31-AUG','dd-MON') of the double
),
days like
(select level - 1 dte + to_date('1-JUN','dd-MON')
of the double
connect by level<= to_date('31-aug','dd-mon')="" -="" to_date('1-jun','dd-mon')="" +="">=>
)
Select id, allow, adtax, mxtax, min (dte) start_date, max (dte) end_date
(select ID, dte, max (allow) allow, max (adtax) adtax, max (mxtax) mxtax,
ROW_NUMBER() over (order by dte) row_number() - courses (partition by order max (allow), max (adtax), max (mxtax) by dte) gr
go (select id, dte,
-case when type = 'ALLOW' and dte between start_date and end_date then end val 0 otherwise allow.
-case when type = "ADTAX" and dte between start_date and end_date then val 0 otherwise end adtax.
-case when type = "MXTAX" and dte between start_date and end_date then val 0 otherwise end mxtax
Table 1 t,
days d
where d.dte between t.start_date and t.end_date
)
Group by id, dte
)
Group by id, gr, allow, adtax, mxtax
order by id, gr
ID ALLOW ADTAX MXTAX START_DATE END_DATE ZTR0098 0 0 0 01/06/2015 02/06/2015 ZTR0098 4 44 0 03/06/2015 09/06/2015 ZTR0098 4 44 2 10/06/2015 15/06/2015 ZTR0098 5 44 2 16/06/2015 17/06/2015 ZTR0098 5 55,34 1 18/06/2015 20/06/2015 ZTR0098 8 55,34 1 21/06/2015 22/06/2015 ZTR0098 8 20.09 1 23/06/2015 25/06/2015 ZTR0098 8 20.09 6 26/06/2015 23/07/2015 ZTR0098 8 45 6 24/07/2015 31/08/2015 Concerning
Etbin
-
How to set the value of the point of application using pl/sql in the application process
Hi guys,.
I want a global variable (application point) whose value will be set to start when a user logs on to the application. The value will be retrieved from the database by using a sql query. I don't exactly know the syntax to set the value of the point of application in the application process. Also, I want to know what type of enforcement process should I use to set the value of the point of application, when a user starts a session. The value of the point of application varies from one user to the user.
Help, please.
I use apex 4.2
Kind regards
Waqas
You can use the application element as a link with his name. That is to say. your point of application is named G_MY_APPLICATION_ITEM, then you can / set of access using: G_MY_APPLICATION_ITEM.
For example
BEGIN
-assign as a variable
: G_MY_APPLICATION_ITEM: = 'LARRY ';
--
-use in a SQL statement
SELECT WHATEVER_COLUMN
IN: G_MY_APPLICATION_ITEM
FROM MY_TABLE
WHERE USERNAME =: APP_USER
;
END;
Peter
-
Hello
Here's my data in the table for itm_id = 1000
ITM_ID ADD_ATR DEL_ATR 1000 a: b:c:d 1000 d 1000 d 1000 e:f:g 1000 e:f:g My required return is (a: b:c:d) d = a: b: c + d = a: = a +(e:f:g) b:c:d: b:c:d:e:f:g-(e:f:g) = a: b: c; d
Output ITM_ID
1000A: b:c:d
can we get the output using the sql query above?
I had tried with union but could not able to get the required result.
Please let me know if there is no possible solution
Thank you
David
I have the impression that you are looking to treat each character in 'RTA' as an individual item and then add or delete depending on whether they are an ADD_ATR or DEL_ATR.
So something like...
SQL > ed
A written file afiedt.buf1 with t as (select 1000 as itm_id, ' a: b/c: some like add_atr, null as del_atr of all the double union)
2 select 1000, null, would be "union double all the"
3 select 1000, 'd', null of union double all the
4 select 1000, 'e:f:g', null of union double all the
5 select 1000, null, "e:f:g" of all the double union
6 select 1234, null, "x: y: z" of all the double union
7 select 1234, 'u: v: w', null of union double all the
8 select 1234, null, 'u' of all the double union
9 select 1234, "x: y", null of union double all the
10. Select 1234, "x: z", null of union double all the
11. Select 1234, 'p', the double null
12 )
13-
14. end of test data
15-
16. Select itm_id
17, cast (listagg(atr,':') within the Group (order by atr) as varchar2 (40)) output
18 of)
19 select itm_id
20, atr
21, sum (add_del)
22 of)
23 select itm_id
24, coalesce(add_atr,del_atr) as full_atr
25, decode (add_atr, null,-1, 1) as add_del
26, regexp_substr (coalesce(add_atr,del_atr),'[^:] +', 1, level) RTA
27, flat surface that l
28 t
29 to connect by level<= (length(coalesce(add_atr,del_atr)="">=>
30 and itm_id = prior itm_id
31 and coalesce(add_atr,del_atr) = prior coalesce(add_atr,del_atr)
sys_guid() 32 and prior is not null
33 )
34 group by itm_id, atr
35 having sum (add_del) > 0
36 )
37 * group by itm_id
SQL > /.ITM_ID OUTPUT
---------- ----------------------------------------
1000A: b:c:d
1234 p:v:w:xthat just shows how stupidly data is as it should be divided every thing in the different elements so that you can then group to determine how many of each, you have (and whether to add or subtract) and then re - combine results again in a combined string.
-
How to get an accurate sql query in oracle?
Hi all
Hope it's right,
Mr President, I was using a SQL query that can be found here:
Declare @nshiftmax datetime
Set @nshiftmax = convert (time, DATEADD(N,1439,0))
impression @nshiftmax
When extracting the result is 23:59 01/01/1900
and a single request more is there
Declare @nshiftmax datetime
Set @nshiftmax = convert (time, DATEADD (N, 0, 0))
impression @nshiftmax
When extracting the result is 01/01/1900 12:00 a.m..
How the same oracle query result.
Thanks in advance.Like this...
SQL> select to_char(date '1900-01-01' + 1439/(24*60),'DD/MM/YYYY HH:MI AM') from dual; TO_CHAR(DATE'1900-0 ------------------- 01/01/1900 11:59 PM SQL> select to_char(date '1900-01-01' + 0/(24*60),'DD/MM/YYYY HH:MI AM') from dual; TO_CHAR(DATE'1900-0 ------------------- 01/01/1900 12:00 AM
Maybe you are looking for
-
I have a new idea called (active safety) and would be happy if I can have apple as my sponsor because the idea is new and I have a great expectations most apple applications will be part of my idea. So who can help? who should I contact at apple?
-
How to keep tabs when restarting Firefox (like Chrome)
I can't find any customization of the lets me put Firefox to reload the tabs that were present when I closed the browser.
-
Re: Message from Usb hub root
Hello I'm doing some research for my friend who has a laptop, model No.Toshiba Satellite A200 system UniModel PSAF0A-02L0K number He recently bought an internet wireless USB When it connect through USB ports, he receives a message from USB root hub a
-
How to raise events from within an event to an another event-structure
Hello I have two events-structures (struct1 struct2) that are running on the same parallel of time in a loop. Currently there is a keydown event in struct1, so when I press a button, then the corresponding event runs in struct1. STRUCT2 is used to ex
-
Windows recovering from unexpected shutdown
Hello My computer will crash at random times sometimes sitting idle. When reboot it comes up with: Windows is recovering from an unexpected shutdown Signature of the problem:Problem event name: BlueScreenThe system version: 6.0.6002.2.2.0.768.3Locale