Using NVL in the query in the query resulting in error
I always use CF8 and Oracle 11 G back.
When I use NVL in the query in the query, I got error... I can't use NVL to check the value null? Help, please
Here are my codes:
< name cfquery = "GetC2" datasource = "#Trim (application." OracDSN) #">" |
SELECT CamID2, rel2_2, p_ln2, p_fn2, ins, l_year
OF prt_temp
WHERE Ins = 'CC '.
AND l_year = '1481'
AND NVL (Child_LN2,' ') <>' ' | |
AND NVL (Child_FN2,' ') <>' ' |
< / cfquery >
< cfif GetC2.Recordcount NEQ 0 > | |
< cfquery name = "CheckRel2C2", dbtype = "QUERY" > | |
SELECT CamID2, rel2_2 | |
OF GetC2 | |
WHERE NVL (Rel2_2,' ') <>' ' | |
AND NVL (p_ln2,' ') = ' ' | |
AND NVL (p_fn2,' ') = ' ' | |
AND Ins = 'CC '. | |
AND l_year = '1481' | |
< / cfquery > |
< / cfif > |
The error:
Run database query error.
Query of queries syntax error.
Met «NVL (Rel2_2.» Incorrect conditional expression, waiting for an a [as | null | between | in | comparison] condition,.
NVL is an Oracle function and it is not available in ColdFusion query of query. If you try to check the values null, use IS NULL or IS NOT NULL. Then
WHERE NVL (Rel2_2,' ') <> ' '
AND NVL (p_ln2,' ') = ' '
AND NVL (p_fn2,' ') = ' '
becomes
WHERE Rel2_2 IS NOT NULL
AND p_ln2 IS NULL
AND p_fn2 IS NULL
-Carl V.
Tags: ColdFusion
Similar Questions
-
First of all, here is my version info:
BANNER
--------------------------------------------------------------------------------
Oracle Database 11 g Enterprise Edition Release 11.1.0.7.0 - 64 bit Production
PL/SQL Release 11.1.0.7.0 - Production
CORE Production 11.1.0.7.0
AMT for HP - UX: 11.1.0.7.0 - Production Version
NLSRTL Version 11.1.0.7.0 - Production
I just re-read the documentation of the subquery factoring clause of select again and I saw no restriction that applies.
Can someone help me understand why I get different results? I would like to be able to use the statement that creates spades3, but for some reason it does not work. However, when I break up and store the last subquery TMP in a table (MAT1), I am able to get the expected results in MAT2.
Sorry if the example seems a bit esoteric. I tried to put something together to help illustrate another problem, so it was more convenient to use the same instructions to illustrate this problem.
drop table mat1; create table mat1 as with skus as ( select level as sku_id from dual connect by level <= 1000 ), tran_dates as ( select to_date('20130731', 'yyyymmdd') + level as tran_date from dual connect by level <= 31 ), sku_dates as ( select s.sku_id, t.tran_date, case when dbms_random.value * 5 < 4 then 0 else 1 end as has_changes, round(dbms_random.value * 10000, 2) as unit_cost from skus s inner join tran_dates t on 1 = 1 ) select d.sku_id, d.tran_date, d.unit_cost from sku_dates d where d.has_changes = 1 ; drop table mat2; create table mat2 as select m.sku_id, m.tran_date, m.unit_cost, min(m.tran_date) over (partition by m.sku_id order by m.tran_date rows between 1 following and 1 following) as next_tran_date from mat1 m ; drop table mat3; create table mat3 as with skus as ( select level as sku_id from dual connect by level <= 1000 ), tran_dates as ( select to_date('20130731', 'yyyymmdd') + level as tran_date from dual connect by level <= 31 ), sku_dates as ( select s.sku_id, t.tran_date, case when dbms_random.value * 5 < 4 then 0 else 1 end as has_changes, round(dbms_random.value * 10000, 2) as unit_cost from skus s inner join tran_dates t on 1 = 1 ), tmp as ( select d.sku_id, d.tran_date, d.unit_cost from sku_dates d where d.has_changes = 1 ) select m.sku_id, m.tran_date, m.unit_cost, min(m.tran_date) over (partition by m.sku_id order by m.tran_date rows between 1 following and 1 following) as next_tran_date from tmp m ; select count(*) from mat2; select count(*) from mat3; from tmp m ;
select count(*) from mat2; select count(*) from mat3;
Select count (*) from mat2;
COUNT (*)
----------
31000
Executed in 0,046 seconds
Select count (*) in spades3;
COUNT (*)
----------
0
Executed by 0,031 seconds
Hello
Khaled says:
The problem is with
-case when dbms_random.value * 5<>
You can change this
dbms_random. Value (1,100) * 5<>
and test
I don't know that I agree 100% with your police department, work there.
dbms_random. Value, no arguments, returns a random number between 0 (inclusive) and 1 (exclusive), so
dbms_random. Value * 5< 4 ="" will="" be="" true="" about="" 80%="" of="" the="">
dbms_randon. Value (1, 100) returns a random number between 1 (included) and 100 (exclusive), so
dbms_random. Value (1, 100) * 5< 4="" will="" be="" true="" exactly="" 0%="" of="" the="" time,="" which="" is="" not="" what="" op="" wants="" at="">
The problem here apparently revolves around the optimizer not really call dbms_random over and over again in sku_dates of the subquery. Add ROWNUM in the subquery seems to force Oracle to assess dbms_random.value immediately. I don't really understand myself, but adding 1 element in the SELECT of the sku_dates subquery clause could solve the problem:
create table spades3 as
with references like)
Select the level as sku_id
of the double
connect by level<=>=>
),
tran_dates like)
Select the level + to_date ('20130731', 'YYYYMMDD') as tran_date
of the double
connect by level<=>=>
),
sku_dates like)
Select s.sku_id,
t.tran_date,
-case when dbms_random.value * 5<>
then 0
1 other
end as has_changes,
Round (dbms_random.value * 10000, 2) as unit_cost
ROWNUM AS r-<=== new="" column="" added="" here="" new="" column="" added="">===>
s SKUs
inner join tran_dates t
1 = 1
),
tmp as)
Select d.sku_id,
d.tran_date,
d.unit_cost
of sku_dates d
where d.has_changes = 1
)
Select m.sku_id,
m.tran_date,
m.unit_cost,
min (m.tran_date) over (partition by order of m.sku_id by m.tran_date rows between 1 next and 1 suite) as next_tran_date
of tmp m
;
You do not have to refer to this column anywhere; just having him in the subquery is enough.
If someone can't understand why, I know it.
-
Hello
I have 3 tables (cars, colors and Cars_Colors). Cars_Colors is a junction table to list all of the possible combinations of cars and their colors. Using joins, produce the following results to my query:
CAR_NUM, COLOR_NUM
CAR1, Color1
CAR1, Color2
Car2, Color1
Car3, Color1
RAC4, Color1
RAC4, Color2
RAC4, couleur3
Car5, couleur3
Query works fine, my problem is to get results to display how I want that they. I want to display the results in a single < table >, with separate for each separate car, where the < tr > shows the car in the first < td > and all the colors associated with this car in a second < td > < b >. Colors must be separated by commas. For example:
CAR1 | Color1, Color2
Car2. Color2
Car3 | Color1
RAC4 | Color1, Color2, couleur3
Car5 | Couleur3
Now, I could make it work by questioning first for separate cars in the Cars_Colors table, and then loop through each result of the car and make a second request on colors associated with the current car. But is probably not the most effective method.
I would like to use a query to produce the result set, I have listed at the top... with all combinations of colors/car, then use Coldfusion to display output... without having to run another query each time through the loop. I tried to use valuelist(), but couldn't make it work properly. I also tried < cfoutput group queries > and < cfloop >. I have the closer to the time, just can't get the commas work properly. I don't know how to avoid that the comma at the end of the colors, for example:
CAR1 | Color1, Color2
Someone at - there a better way? I appreciate all help. Thank you!
SELECT in... where... ORDER BY car_num, color_num
query = "myQuery" group = "car_num">
#car #-#ListChangeDelims (tempColors, ",") #.
HTH,
CR -
Increase the search results to be more than 500
We have a requirement of use to increace the search results for any type of technique to over 500 (now the set limit). Is it possible none in the system?
This limit is in place for performance reasons and cannot be rid of basic research. However, usually when users want more than 500 results is because they are tasks considered compared to standard search/navigation tasks. For tasks in report, we published reports ready. Ready reports offers the same features that the search you can adjust the limit of 500 and run saved contextual criteria. Alternatively, you can calm the concern for the performance by implementing enforcement reports, ready to use a reporting database if necessary.
Reports of loan is extremely simple to install. You can learn more on this topic by watching the video of presentation on the collaboration site. You can also read the guide that is located in the pack of extensibility.
-
Hi all!
I successfully ran a VMmark full test and is seeking more information about the results and how to improve them.
The numbers generated are very vague and the doc that I have does not say much about how the numbers are calculated. I'm looking for some kind of computation that VMmark uses to get the final result. I guess that's something like Ops ARE/s/total transactions... etc...
I have a quad core server CPU with 16 GB of Ram. I am using a back-end SAN and I try to really test the back-end SAN vs the other components of this.
If anyone has any advice they would be appreciated!
Thank you in advance!
ESX4 using esxcfg-module
-
How to get the sql query result?
Hello
Currently I use LV2012 to connect to an Oracle database server. After the Oracle Express and Oracle ODBC driver facilities/settings made.
I managed to use the SQL command to query the data through my command prompt window.
Now the problem is, how to do the same task in Labview using database connectivity tools?
I have build a VI to query as being attached, but I have no idea of what range to use to get the result of the query.
Please help me ~ ~
Here is a piece of code that I use to test the SQL commands, you can use the part that retrieves the results of sql.
It is also possible to get the rear column headers, but it's for the next lesson!
;-)
-
Hi Experts,
I have a DB table has columns of more than 50.
I question this table, it should only return one line at any time. as sqldeveloper below image.
here, I need to build block pl/sql-query, Discover the column in the table as a key and query result as values.
Eg: Key - Value
TASK_EVENT_ID - 1765
EVENT_TYPE - ASR_UPDATE
... etc until all of the columns in my table.
Experts please comment on that point, appreciate your help on this.
Thank you
-Vincent.
Here is an approach using DBMS_SQL to iterate over the columns of key / value to assign... (Little code snipped for brevity)
create or replace procedure (task_expired)
v_store_id in full,
v_task_action_id in full,
v_job_id in full
)
as
-[SNIP code...]
v_sql VARCHAR2 (4000): = ' select * from my_table where PK = 123'; -Your SQL here!
v_v_val VARCHAR2 (4000);
v_n_val NUMBER;
v_d_val DATE;
v_ret NUMBER;
c NUMBER;
d NUMBER;
col_cnt INTEGER.
f BOOLEAN;
rec_tab DBMS_SQL. DESC_TAB;
col_num NUMBER;
vAsString VARCHAR2 (4000);
BEGIN
-[SNIP code...]
Message_properties. CORRELATION: = "EDF_EVENT";
MSG: = SYS. AQ$ _JMS_BYTES_MESSAGE. Construct();
Msg.set_string_property ('queueName', ' shipping/csi_cth');
Msg.set_string_property ('MODE', 'CR8');
c: = DBMS_SQL. OPEN_CURSOR;
DBMS_SQL. PARSE (c, v_sql, DBMS_SQL. NATIVE);
d: = DBMS_SQL. Execute (c);
DBMS_SQL. DESCRIBE_COLUMNS (c, col_cnt, rec_tab);
1.col_cnt J
LOOP
CASE rec_tab (j) .col_type
WHEN 2 THEN
DBMS_SQL. DEFINE_COLUMN (c, j, v_n_val); -Number
WHEN 12 CAN
DBMS_SQL. DEFINE_COLUMN (c, j, v_d_val); -Date
ON THE OTHER
DBMS_SQL. DEFINE_COLUMN (c, j, v_v_val, 2000); -Else treat as varchar2
END CASE;
END LOOP;
LOOP
v_ret: = DBMS_SQL. FETCH_ROWS (c);
WHEN OUTPUT v_ret = 0;
1.col_cnt J
LOOP
-Fetch each column to the correct data type based on coltype
CASE rec_tab (j) .col_type
WHEN 2 THEN
DBMS_SQL. COLUMN_VALUE (c, j, v_n_val);
vAsString: = to_char (v_n_val);
WHEN 12 CAN
DBMS_SQL. COLUMN_VALUE (c, j, v_d_val);
vAsString: = to_char (v_d_val, ' DD/MM/YYYY HH24:MI:SS');
ON THE OTHER
DBMS_SQL. COLUMN_VALUE (c, j, v_v_val);
vAsString: = v_v_val;
END CASE;
Msg.set_string_property (rec_tab (j) .col_name, vAsString);
END LOOP;
END LOOP;
DBMS_SQL. CLOSE_CURSOR (c);
DBMS_AQ. ENQUEUE (queue_name-online 'cbus.aqjms_common',
Enqueue_options => Enqueue_options,
Message_properties => Message_properties,
Payload-online msg,
Msgid => Message_handle);
dbms_output.put_line ('00 Msgid =' |) Message_handle);
dbms_output.put_line('===Done=');
-[SNIP code...]
END;
/
-
How to get SQL Developer 4.1 to display the query result?
SQL DEV 4.0.3.16.84 execution of a SELECT statement is stored in a .sql file causes the window of the query result of pop-up indicating the result of a SELECT statement. SQL DEV 4.1 is not to do so.
Oops on my part; my SQL formatting has been the root cause. I got used to insert split without any character of comment lines in front of them. For example:
==================================================
Select funny business;
The foregoing indicates the behavior described.
--==================================================
Select funny business;
With the dash double comment shows, the SQL works very well.
This is different than previous versions of SQL Developer, but is probably better functionality. I'll try to mark it as answered, but anyone with the admin should certainly do so if I can't.
-
Need help to understand the query result
Hi gurus
I was reading one of the question here in this forum and its link is below:
I had some confusion related to this code and don't understand the logic of the out put, see query below:
Query
with sub_services as
(
Select su_seq 12323, 'HLR1' so_id, 1 seq Union double all the
Select su_seq 12323, "HLR2' so_id, seq 2 Union double all the
Select su_seq 12323, "A09" so_id, seq 3 of all the double union
Select su_seq 12333, "MO1" so_id, seq 4 Union double all the
Select su_seq 12333, "MO2' so_id, seq 5 Union double all the
Select su_seq 12333, "A09" so_id, 6 seq in union double all the
Select su_seq 12333, 'M0CR' so_id, seq 7 Union double all the
Select su_seq 12999, "LOL1' so_id, seq 8 Union double all the
Select su_seq 12999, "LOL2' so_id, seq 9 double
)
Select *.
of sub_services b
where exists (select 1 from sub_services
where su_seq = b.su_seq
and so_id = 'A09.
)
order by 2;
The query result
12323 A09 3
12333 6 A09
12323 HLR1 1
12323 HLR2 2
12333 M0CR 7
12333 4 MO1
12333 5 MO2
According to my understanding, the above query should return records in red only because of her is below command
It exists (select 1 from sub_services
where su_seq = b.su_seq
and so_id = 'A09.
but don't know why he's back 7 files, can someone help me understand the result...
It is query is functionally identical to the PL/SQL block, but much more effective.
declare
number of l_res;
Start
for line (select *)
sub_services) loop
Start
Select 1 from l_res
of sub_services
where su_seq = row.su_seq and
so_id = "A09" and
rownum = 1;
Essentially every row in the outer query are tested against him exists query. Given the correlation between two requests is based only on su_seq each line with a su_seq value returned by him is returned in the output.
Another way to think he uses instead a join condition. This query is equivalent to the query to exist
Select the main
of main sub_services
Join select (separate su_seq
of sub_services
where so_id = "A09") cond
We main.su_seq = cond.su_seq;
John
-
Ask help - please help me get the expected defined in a query result
Dear all,
Help with your suggestions and advice. Please see the bottom of the screenshots for the planned result sets.
create table shift_dt (name varchar2(20), shift_start date, shift_end date); insert into shift_dt values ('Brian',to_date('01-01-2015 09:10:00','dd-mm-yyyy hh24:mi:ss'), to_date('01-01-2015 22:10:00','dd-mm-yyyy hh24:mi:ss')); insert into shift_dt values ('Brian',to_date('02-01-2015 09:10:00','dd-mm-yyyy hh24:mi:ss'), to_date('04-01-2015 00:00:00','dd-mm-yyyy hh24:mi:ss')); insert into shift_dt values ('Brian',to_date('04-01-2015 00:00:00','dd-mm-yyyy hh24:mi:ss'), to_date('05-01-2015 15:20:00','dd-mm-yyyy hh24:mi:ss')); insert into shift_dt values ('Brian',to_date('06-01-2015 10:00:00','dd-mm-yyyy hh24:mi:ss'), to_date('06-01-2015 23:20:00','dd-mm-yyyy hh24:mi:ss')); insert into shift_dt values ('Brian',to_date('07-01-2015 11:00:00','dd-mm-yyyy hh24:mi:ss'), to_date('09-01-2015 00:00:00','dd-mm-yyyy hh24:mi:ss')); insert into shift_dt values ('Brian',to_date('09-01-2015 00:00:00','dd-mm-yyyy hh24:mi:ss'), to_date('10-01-2015 22:00:00','dd-mm-yyyy hh24:mi:ss')); select * from shift_dt;
Select * from shift_dt;
Expected result set: -.
I compare date of shift_end with the next date of shift_start of the day. If the dates made 12 am (IE 00:00:00), then I ignore and display the next shift end date available as displayed in the screen game result. Please see the screen set outcome turned for more details.
Please help get the results you want in the SQL query
Kind regards
Souls
Hello
Here's one way:
WITH got_new_grp AS
(
SELECT name, shift_start, shift_end
CASE
WHEN shift_start = TRUNC (shift_start)
AND shift_start = LAG (shift_end) OVER (ORDER BY shift_start)
THEN 0
1. OTHER
END AS new_grp
OF shift_dt
)
got_grp AS
(
SELECT name, shift_start, shift_end
SUM (new_grp) OVER (ORDER BY shift_start) AS grp
OF got_new_grp
)
SELECT MIN (name) DUNGEON (DENSE_RANK FIRST ORDER BY shift_start)
As a name
MIN (shift_start) AS shift_start
MAX (shift_end) AS shift_end
OF got_grp
GROUP BY grp
ORDER BY shift_start
;
Output (from the full sample data):
NAME SHIFT_START SHIFT_END
-------------------- ---------------- ----------------
01/01/2015 Brian 09:10 01/01/2015 22:10
Brian 02/01/2015 09:10 01/05/2015 15:20
Brian 06/01/2015 10:00 01/06/2015 23:20
Brian 07/01/2015 11:00 10/01/2015 22:00
Brian 01/02/2015 15:00 02/02/2015 00:00
Brian 02/02/2015 11:00 02/02/2015 17:00
Brian 03/02/2015 00:00 03/02/2015 08:00
Brian 02/05/2015 15:30 06/02/2015 07:30
Brian 07/02/2015 23:30 10/02/2015 00:30
I guess that shift_start is unique.
It's finally a GROUP BY problem: we want to show the first shift_start and the last shfit_end of a group of 1 or more lines. The tricky part is to identify the groups. If I understand the problem, line X is grouped with the previous line X-1 if shift_start on the X line is midnight and is equal to shift_end on line X-1. The above query uses the LAG analytic to see if each line begins a new group or not and the analytic function SUM to see how many groups have already begun (and therefore, which group each line entry belongs.)
I still don't understand why you 'Corrected name of Anne in Brian' and not vice versa. I guess the name to display in each group is the name of the first row in the Group (i.e. the line with the shift_start earlier).
-
Hello!
I have a simple object type and a proecdure in which I am trying to use it to insert into another table
-object
CREATE ORREPLACETYPEmt_mtg ASOBJECT
(
ACOL NUMBER ,
BCOL NVARCHAR2 (100)
);
CREATE ORREPLACETYPEREF_MTG ASTABLEOFMt_MTG ;
-same structure as the use of sampletbl target table in the cursor query
create table tbl_MT_MTG
(
ACOL NUMBER ,
BCOL NVARCHAR2 (100)
);
-procedure
CREATE ORREPLACEINTERIORTEST_PROCEDURE1
AS
ref_cur sys_refcursor ;
REFR ref_mtg ;
BEGIN
OPEN ref_cur FOR
Select acol,
BCOL
DE sampletbl où rownum<10;
Fetch ref_cur in bulk collectintorefr;
Insert intotbl_MT_MTG(acol,bcol)selectacol,bcol fromtable(refr);
commit;
CLOSE Ref_cur;
END;
/
When I run this procedure fails with
ORA-06504: PL/SQL: return variables of the game results or the query types do not match
ORA-06512: at "TEST_PROCEDURE1", line 10
ORA-06512: at line 2
Any help on this please...
Thanks to an OLD POST below
so perfect helped me! Thank you
Tubby
After 5 years of more :-)
How to store refcursor in collection How to store refcursor in collection
-
Query results pane should display the entire XML following the execution of the query
Hi, I'm trying to get the xml output results returned in sqldeveloper returned in full.
they are truncated to.
I tried the trick / * xml * / but that is implemented in the form xml cdata codes and other structures of nickname.
Select xmlserialize (DOCUMENT
XMLELEMENT ("root",
XMLAttributes ('http://www.millicom.com' as 'xmlns'),
XMLAGG)
XMLELEMENT ("line",
XMLFOREST (U.username,
U.user_id,
U.PASSWORD,
U.ACCOUNT_STATUS,
U.LOCK_DATE,
U.EXPIRY_DATE,
U.DEFAULT_TABLESPACE,
U.TEMPORARY_TABLESPACE,
U.CREATED,
U.PROFILE,
U.INITIAL_RSRC_CONSUMER_GROUP,
U.EXTERNAL_NAME,
U.PASSWORD_VERSIONS,
U.EDITIONS_ENABLED,
U.AUTHENTICATION_TYPE)))
AS CLOB DASH)
from dba_users U
CROSS JOIN (select 1 of the double connect by level < = 10);
Thanks for any help you can offer.
JM
Hi jm,
In the line of query results, did scroll all the way to the right, then click twice on the «...» "at the end of the line to open the cell editor?
So again, who does not show all the XML, it may be a problem with the version of the ojdb6.jar in use (11.2.0.3 client or later is required), or whether or not the JDBC OCI/thickness is used. Read the following discussion: retrieve XMLTYPE based on very slow saved schema
Kind regards
Gary
SQL development team
-
new to 4.02, no grid or column names in the query results
It is a bit strange, I have SQL Developer 4.02 just installed, and I don't see grid or column names in the query results. Don't see anything useful in tools > Preferences, what don't get me?
The worksheet gives you a couple of different ways to run a query...
1. instruction execute sheet icon toolbar (large green arrow, or Ctrl + Enter).
This produces a results tab of the query with the data displayed in a grid.
2. worksheet icon toolbar Execute the Script (the small tip of the green arrow on lined paper, or F5).
This produces a tab out of the Script with the data displayed on the printer.
If execution of the statement to Execute the Script, using some SQL * most orders will remove the column headers:
1. set the position
2. set the pagesize 0 (or 1 or 2).
Pagesize and linesize default is - 1. By default, the spreadsheet is free for formatting output script as he wishes. If you have not changed these settings in the spreadsheet, then see if you point to a startup script in Tools > Preferences > Database > name of the connection startup script file
Kind regards
Gary
SQL DeveloperTeam
-
Help on the game of query results
Hi gurus,
Have this survey for my requirement of dataset sql.
Sample, it's that I have to pick up the nonfunctional currency transactions.
Lets say for a given month, data that are present are for CurrencyA and CurrencyB for a particular account.
Account1 has a transaction does not work CurrencyA and CurrenyB then Account2 has only transaction to CurrencyB.
My current query result is that the 3 first lines, what I need is the 4th should also appear and be included.
CurrencyA - amount - account1
CurrencyB - amount - account1
CurrencyB - amount - Account2
CurrencyA - < '0' / or null >-Account2
I think that my request is based on the currency < x > I have, so it should be for each account, he has all the lines for each currency.
If please notify and let me know your thoughts.
Kind regards
Hello
It looks like you want an outer join partitioned.
I hope that answers your question.
If not, post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and the results desired from these data.
Explain, using specific examples, how you get these results from these data.
Always say what version of Oracle you are using (for example, 11.2.0.2.0).See the FAQ forum: https://forums.oracle.com/message/9362002
-
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.
Maybe you are looking for
-
Error SDK - 12 in version of Distribution Kit
Distribution of generation Kit fails with the SDK - 12 error when I try to build a distribution that needs no cached files (see attachments). The build succeeds if it is cropped up where there isn't any files to a CD or DVD. Operating system is Vista
-
Update Windows using the two direct connection to proxy nd
Use the two nd direct net connection by proxy, more time via proxy, is there a way I can configure update without changing the settings? am on windows 7 Home premium Please correct me if wrong, using "netsh winhttp import proxy IE" it says you can up
-
POUVEZ FOGLIGHT CONTROL OF EXTERNAL SMTP CONNECTIONS?
Hello - I have recently been approaching with an interesting use case as we see if Foglight can monitor SMTP (port 25) connections out to the 3rd party that use e-mail as a way to send and receive information for a particular customer. Is this possi
-
Hi, I plan to develop air (AS3) on BB10. My question is: 1. What's the difference / limitation in the BB10 AIR and AIR Office? Any obvious restriction of BB10 AIR? 2 is the library as flash.text.TextFieldcan be used? Thank you! Hope someone could hel
-
BlackBerry Smartphones Software fails during synchronization with Outlook
When I am syncing via USB my Storm with Outlook 2007 docking station, it fails when it reaches the timetable of the process part. I use sync 2 channels on all of the components (tasks, contacts, calendar, etc.) and be successful, except when I accep