Distinct values in each column
Hi
I have a table with three columns and I would like to display distinct values in each column. Could any one please help me to get the output.
col1 col2 col3
==== ==== ====
a 1 x
a 2 y
a 3 z
a 4 u
b 5 v
b 6 x
b 7 x
b 9 x
b 10 y
b 11 y
b 12 y
b 13 y
b 14 x
b 15 y
b 16 z
b 17 u
b 18 v
b 19 x
b 20 x
c 21 x
c 22 y
c 23 y
c 24 y
c 25 y
c 26 x
c 27 y
c 28 z
Output needed
===========
col1 col2 col3
==== ==== ====
a 1 x
b 2 y
c 3 z
4 u
5 v
6
7
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Thanks
Vasanth
but the only drawback - you need to know the column, comprising the biggest amount of distinct values beforehand.No. There is no any difference in which column will be chosen as "based".
For demo purposes I've added extra row number column to show full generality and symmetry of the approach:
exec dbms_random.seed(0)
with t as ( select chr(ascii('a') + dbms_random.value(0, 3)) as c1,
trunc(dbms_random.value(1, 20)) as c2,
chr(ascii('u') + dbms_random.value(0, 6)) as c3
from dual connect by level <= 20
tt1 as ( select lag( null, 1, c1) over (partition by c1 order by null) as c1,
lag(to_number(null), 1, c2) over (partition by c2 order by null) as c2,
lag( null, 1, c3) over (partition by c3 order by null) as c3
from t
tt2 as ( select tt1.*,
row_number() over (order by c1) as rn1,
row_number() over (order by c2) as rn2,
row_number() over (order by c3) as rn3,
rownum rn
from tt1
tt3 as ( select case when rn1 > rn
then last_value(c1) over (order by rn1 range between abs(rn1 - rn) preceding
and abs(rn1 - rn) preceding)
else last_value(c1) over (order by rn1 range between abs(rn - rn1) following
and abs(rn - rn1) following)
end as c1,
case when rn2 > rn
then last_value(c2) over (order by rn2 range between abs(rn2 - rn) preceding
and abs(rn2 - rn) preceding)
else last_value(c2) over (order by rn2 range between abs(rn - rn2) following
and abs(rn - rn2) following)
end as c2,
case when rn3 > rn
then last_value(c3) over (order by rn3 range between abs(rn3 - rn) preceding
and abs(rn3 - rn) preceding)
else last_value(c3) over (order by rn3 range between abs(rn - rn3) following
and abs(rn - rn3) following)
end as c3
from tt2
select c1, c2, c3 from tt3
where c1 || c2 || c3 is not null
order by c1, c2, c3
C1 C2 C3
a 1 u
b 3 v
c 4 w
5 x
7 y
8 z
9
11
13
15
16
17
19
13 rows selected.P.S. Thanks to [url http://www.sql.ru/forum/actualthread.aspx?bid=3&tid=482506&hl=over+range#4785373]Vladimir Sitnikov for the demo of the approach.
Similar Messages
-
How find out the duplicate value from each columns.
I have below four columns,
How can i find out the duplicate value from each columns.
with All_files as (
select '1000' as INVOICE,'2000' AS DELIVERYNOTE,'3000' CANDELINVOICE,'4000' CANDELIVERYNOTE from dual union all
select '5000','6000','7000','8000' from dual union all
select '9000','1000','1100','1200' from dual union all
select '1200','3400','6700','8790' from dual union all
select '1000','2000','3000','9000' from dual union all
select '1230','2340','3450','4560' from dual
SELECT * FROM All_files
Output should be as per below.
1000 2000 3000 4000
9000 1000 1100 1200
1200 3400 6700 8790
1000 2000 3000 9000
Required to check uniqueness in cross columns.
Thanks.Try this (sorry about the formatting)...
WITH all_files AS (SELECT '1000' AS INVOICE,
'2000' AS DELIVERYNOTE,
'3000' CANDELINVOICE,
'4000' CANDELIVERYNOTE
FROM DUAL
UNION ALL
SELECT '5000',
'6000',
'7000',
'8000'
FROM DUAL
UNION ALL
SELECT '9000',
'1000',
'1100',
'1200'
FROM DUAL
UNION ALL
SELECT '1200',
'3400',
'6700',
'8790'
FROM DUAL
UNION ALL
SELECT '1000',
'2000',
'3000',
'9000'
FROM DUAL
UNION ALL
SELECT '1230',
'2340',
'3450',
'4560'
FROM DUAL),
t_base
AS (SELECT invoice
|| ','
|| deliverynote
|| ','
|| candelinvoice
|| ','
|| candeliverynote
str
FROM all_files),
t_str
AS (SELECT str || ',' AS str,
(LENGTH (str) - LENGTH (REPLACE (str, ','))) + 1
AS no_of_elements
FROM t_base),
t_n_rows
AS ( SELECT LEVEL AS i
FROM DUAL
CONNECT BY LEVEL <=
( SELECT SUM (no_of_elements) FROM t_str)),
t_build AS (SELECT t_str.str,
nt.i AS element_no,
INSTR (t_str.str,
DECODE (nt.i, 1, 0, 1),
DECODE (nt.i, 1, 1, nt.i - 1))
+ 1
AS start_pos,
INSTR (t_str.str,
1,
DECODE (nt.i, 1, 1, nt.i))
AS next_pos
FROM t_str
JOIN
t_n_rows nt
ON nt.i <= t_str.no_of_elements),
t_build2
AS (SELECT RTRIM (str, ',') AS original_string,
SUBSTR (str, start_pos, (next_pos - start_pos))
AS single_element,
element_no
FROM t_build),
t_build3
AS (SELECT single_element,
COUNT( * )
OVER (PARTITION BY single_element
ORDER BY single_element)
ele_count
FROM t_build2)
SELECT DISTINCT INVOICE,
DELIVERYNOTE,
CANDELINVOICE,
CANDELIVERYNOTE
FROM all_files, t_build3
WHERE ele_count > 1
AND ( INVOICE = single_element
OR DELIVERYNOTE = single_element
OR CANDELINVOICE = single_element
OR CANDELIVERYNOTE = single_element)I think this will be faster than the previous solution?
Cheers
Ben
Edited by: Munky on Feb 17, 2011 2:11 PM - "I think this will be faster than the previous solution?", nope - it's not :( -
"How to get distinct values of sharepoint column using SSRS"
Hi,
I have integrated sharepoint list data to SQL Server reporting services. I am using the below to query sharepoint list data using sql reporting services.
<Query>
<SoapAction>http://schemas.microsoft.com/sharepoint/soap/GetListItems</SoapAction>
<Method Namespace="http://schemas.microsoft.com/sharepoint/soap/" Name="GetListItems">
<Parameters>
<Parameter Name="listName">
<DefaultValue>{GUID of list}</DefaultValue>
</Parameter>
<Parameter Name="viewName">
<DefaultValue>{GUID of listview}</DefaultValue>
</Parameter>
<Parameter Name="rowLimit">
<DefaultValue>9999</DefaultValue>
</Parameter>
</Parameters>
</Method>
<ElementPath IgnoreNamespaces="True">*</ElementPath>
</Query>
By using this query, I am getting a dataset which includes all the columns of sharepoint list. Among these columns, I wanted to display only 2 columns (i.e Region and Sales type) using chart. I have created a Region parameter but when I click preview, the drop down box is giving me all the repeatative values of region like RG1,RG1,RG1,RG2,RG2,RG2,RG2,RG3.......... I wanted to display only distinct values of Region parameter so that whenever end user select region from the parameter drop down, it will display the respective value of Sales type column.
Also when I select only RG1 parameter, it is giving me a chart including the sales type of all the Regions. (it should display me only the sales type of RG1) How can I link these 2 columns so that they will display the values respectively.
I would really appreciate if anyone can help me out with this.
Thanks,
Sam.Hi Sam,
By code, the CAML language doesn’t have any reserved word (or tag) to set this particular filter to remove duplicate results.
In this case, we could use the custom code to get distinct records.
Here are the detailed steps:
1. Create a hidden parameter that gets all the records in one field.
Note: Please create another dataset that is same of the main dataset. This dataset is used for the parameter.
2. Create a function that used to remove the duplicate records.
Here is the code:
Public Shared Function RemoveDups(ByVal items As String) As String
Dim noDups As New System.Collections.ArrayList()
Dim SpStr
SpStr = Split(items ,",")
For i As Integer=0 To Ubound(Spstr)
If Not noDups.Contains(SpStr(i).Trim()) Then
noDups.Add(SpStr(i).Trim())
End If
Next
Dim uniqueItems As String() = New String(noDups.Count-1){}
noDups.CopyTo(uniqueItems)
Return String.Join(",", uniqueItems)
End Function
3. Create another parameter that will be used for filtering the maindata.
Please set the available value to be =Split(Code.RemoveDups(JOIN(Parameters!ISSUE_STATUS_TEMP.Value, ",")), ",")
And the default value to be the value you what such as the first value:
=Split(Code.RemoveDups(JOIN(Parameters!ISSUE_STATUS_TEMP.Value, ",")), ",").(0)
4. Go to the main dataset. Open the property window of this dataset.
5. In the “Filters” tab, set the filter to be:
Expression: <The field to be filter>
Operator: =
Value: =Parameters!Region.Value
The parameter “Region” should be the parameter we created in the step3.
Now, we should get distinct values of SharePoint columns.
If there is anything unclear, please feel free to ask.
Thanks,
Jin
Jin Chen - MSFT -
Count number of distinct values for a column for all tables that contains that column
Imagine I have one Column called cdperson. With the query below I know which Tables have column cdperson
select
t.[name]fromsys.schemassinnerjoin
sys.tables
tons.schema_id=t.schema_idinnerjoin
sys.columnscont.object_id=c.object_idinnerjoin
sys.types
donc.user_type_id=d.user_type_idwherec.name ='cdperson'
now I want to know for each table, how many distinct values of cdperson I have and I want the result ordered by the table that has more distinct values (descending)
Table1
cdperson select distinct(cdperson) = 10
cdadress
quant
Table2 with
cdaddress (no column cdperson in this table)
quant
Table3
cdperson select distinct(cdperson) = 100
value
Table 4
cdperson select distinct(cdperson) = 18
sum
I want this result ordered by number of distinct cdperson
table3 100
table4 18
table 10
Thks for your answersI had to add schema name to the above script to make it work in AdventureWorks:
CREATE TABLE #temp(TableName sysname , CNT BIGINT)
DECLARE @QRY NVARCHAR(MAX);
SET @qry=(SELECT
N'INSERT INTO #TEMP SELECT '''+schema_name(t.schema_id)+'.'+T.[name] +''' AS TableName, COUNT (DISTINCT ProductID) DistCount FROM '+
schema_name(t.schema_id)+'.'+t.[name] +';'
FROM sys.schemas s INNER JOIN sys.tables t ON s.schema_id=t.SCHEMA_ID
INNER JOIN sys.columns c ON t.object_id=c.object_id INNER JOIN sys.types d ON c.user_type_id=d.user_type_id
WHERE c.name ='ProductID'
FOR XML PATH(''))
EXEC(@QRY)
SELECT * FROM #temp ORDER BY TableName
DROP TABLE #temp
Production.Product 504
Production.ProductCostHistory 293
Production.ProductDocument 31
Production.ProductInventory 432
Production.ProductListPriceHistory 293
Production.ProductProductPhoto 504
Production.ProductReview 3
Production.TransactionHistory 441
Production.TransactionHistoryArchive 497
Production.WorkOrder 238
Production.WorkOrderRouting 149
Purchasing.ProductVendor 211
Purchasing.PurchaseOrderDetail 211
Sales.SalesOrderDetail 266
Sales.ShoppingCartItem 3
Sales.SpecialOfferProduct 295
Kalman Toth Database & OLAP Architect
SQL Server 2014 Database Design
New Book / Kindle: Beginner Database Design & SQL Programming Using Microsoft SQL Server 2014 -
How to merge values in a row, based on distinct values in another column
I have a table like
updatedby updateddate text
John 01-May-2009 Approval record 1 added
John 01-May-2009 Approval record 2 added
David 02-May-2009 Approval record 1 removed
I need the values of text column to be concatenated and displayed for unique records of (updatedby updateddate). The output is something like
updatedby updateddate text
John 01-May-2009 Approval record 1 added, Approval record 2 added
David 02-May-2009 Approval record 1 removed
I had planned to do it using PLSQL. Is there a way to get this done by SQl?.. Kindly suggestPrior to 10g:
with t as (
select 'John' updatedby,to_date('01-May-2009','dd-mon-yyyy') updateddate,'Approval record 1 added' text from dual union all
select 'John',to_date('01-May-2009','dd-mon-yyyy'),'Approval record 2 added' from dual union all
select 'David',to_date('02-May-2009','dd-mon-yyyy'),'Approval record 1 removed' from dual
select updatedby,
updateddate,
ltrim(sys_connect_by_path(text,','),',') text
from (
select t.*,
row_number() over(partition by updatedby,updateddate order by text) rn,
count(*) over(partition by updatedby,updateddate) cnt
from t
where rn = cnt
start with rn = 1
connect by updatedby = prior updatedby
and updateddate = prior updateddate
and rn = prior rn + 1
order by updateddate,
updatedby
UPDAT UPDATEDDA TEXT
John 01-MAY-09 Approval record 1 added,Approval record 2 added
David 02-MAY-09 Approval record 1 removed
SQL> 10g and up:
with t as (
select 'John' updatedby,to_date('01-May-2009','dd-mon-yyyy') updateddate,'Approval record 1 added' text from dual union all
select 'John',to_date('01-May-2009','dd-mon-yyyy'),'Approval record 2 added' from dual union all
select 'David',to_date('02-May-2009','dd-mon-yyyy'),'Approval record 1 removed' from dual
select updatedby,
updateddate,
ltrim(sys_connect_by_path(text,','),',') text
from (
select t.*,
row_number() over(partition by updatedby,updateddate order by text) rn
from t
where connect_by_isleaf = 1
start with rn = 1
connect by updatedby = prior updatedby
and updateddate = prior updateddate
and rn = prior rn + 1
order by updatedby,
updateddate
with t as (
select 'John' updatedby,to_date('01-May-2009','dd-mon-yyyy') updateddate,'Approval record 1 added' text from dual union all
select 'John',to_date('01-May-2009','dd-mon-yyyy'),'Approval record 2 added' from dual union all
select 'David',to_date('02-May-2009','dd-mon-yyyy'),'Approval record 1 removed' from dual
select updatedby,
updateddate,
ltrim(sys_connect_by_path(text,','),',') text
from (
select t.*,
row_number() over(partition by updatedby,updateddate order by text) rn
from t
where connect_by_isleaf = 1
start with rn = 1
connect by updatedby = prior updatedby
and updateddate = prior updateddate
and rn = prior rn + 1
order by updateddate,
updatedby
UPDAT UPDATEDDA TEXT
John 01-MAY-09 Approval record 1 added,Approval record 2 added
David 02-MAY-09 Approval record 1 removed
SQL> SY. -
How to display the value of a column in a chart at the top of each column
How to display the value of each column in a chart at the top of each column?
Like this?
Done using chart Inspector.
For details, see Chapter 7, Creating Charts from Numerical Data in the Numbers '09 User Guide. The guide may be downloaded via the Help menu in Numbers.
Regards,
Barry -
Select records based on first n distinct values of column
I need to write a query in plsql to select records for first 3 distinct values of a single column (below example, ID )and all the rows for next 3 distinct values of the column and so on till the end of count of distinct values of a column.
eg:
ID name age
1 abc 10
1 def 20
2 ghi 10
2 jkl 20
2 mno 60
3 pqr 10
4 rst 10
4 tuv 10
5 vwx 10
6 xyz 10
6 hij 10
7 lmn 10
so on... (till some count)
Result should be
Query 1 should result --->
ID name age
1 abc 10
1 def 20
2 ghi 10
2 jkl 20
2 mno 60
3 pqr 10
query 2 should result -->
4 rst 10
4 tuv 10
5 vwx 10
6 xyz 10
6 hij 10
query 3 should result -->
7 lmn 10
9 .. ..
so on..
How to write a query for this inside a loop.Hi,
So, one group will consist of the lowest id value, the 2nd lowest and the 3rd lowest, reggardless of how many rows are involved. The next group will consist of the 4th lowest id, the 5th lowest and the 6th lowest. To do that, you need to assign numbers 1, 2, 3, 4, 5, 6, ... to the rows in order by id, with all rows having the same id getting the same number, and without skipping any numbers.
That sounds like a job for the analytic DENSE_RANK function:
WITH got_grp_id AS
SELECT id, name, age
, CEIL ( DENSE_RANK () OVER (ORDER BY id)
/ 3
) AS grp_id
FROM table_x
SELECT id, name, age
FROM got_grp_id
WHERE id = 1 -- or whatever number you want
;If you'd care to post CREATE TABLE and INSERT statements for your sample data, then I could test it.
See the forum FAQ {message:id=9360002} -
Find the average of each 500 values in a column [text file]
please help, i hv a text file with three columns of integer values. I need to take 500 values in each column and replace them with their average.
Solved!
Go to Solution.
Attachments:
11.txt 715 KBA lof if this could probably be simplified. Here are some ideas.... Many thing could be improved even more.
LabVIEW Champion . Do more with less code and in less time .
Attachments:
averageMOD.vi 16 KB -
How can I get the number of distinct records that each field of a DB table has?
Hi everyone,
I would like to know how to get he number of distinct records that each field of a DB table has. When tracing a SQL statement either in ST12 or ST05, in the plan execution, if the sentence made useage of an index, then I can click in the index name and see this kind of information (no. of distinct values for each field of that index).
Can I do something like this but with the whole fields of a table?
What I have found until now is in Tx ST10; I search for whatever kind of table statistics and then use the function of "Analyze table" (which takes me to Tx DB05). In here, I can enter a table and up to 5 fields in order to get the information that I want.
Is there any other way to do this?
Regards,
David RezaHi David,
You can export the same to excel and sort as per requirement.
Sorry is that what you are looking for ?
Regards,
Deepanshu Sharma -
Hide row values for certain column in GRR2
Hi Experts,
Looking for some help in report painter. I need to hide row values for certain columns in report painter. The requirement is I have 5 columns in the report, the 5 th column is the sum of col 1 to 4 and in my row i have a formula setup to sum of values for each column, what i would like to do is for column 1 thru 4 i didnt want to display the total values in row total but i wanted to dispaly value for column 5 in row total. I have been trying my best with putting formula, but couldnt succeed.
Could somebody let me know is there an way to get this addressed.
Thanks in advance
Best Regards,
gjHow was it achieved ? Did you use sections for the columns for which rows needed to be hidden?
I have a smiliar issue of hiding certain rows for few columns. -
Query to find out two counts on each column
Hi
can you help for the below query.
I wanted to find out two count values on each column, ie above or equal 5 count and below 5 count.
Table:
Q1 Q2 Q3 (Q1, Q2, Q3 are columns in a table.)
1 3 5
6 7 4
8 5 1
2 8 5
Query should display, like below.
Expected Result:
colname >=5 count <5 count
Q1 2 2
Q1 3 1
Q3 2 2
Thanks in advance.The query itself can be simplified as follows:
SQL> with t as (
2 select level lvl from dual
3 connect by level < 4)
4 select colname
5 , sum(case when val >= 5 then 1 else 0 end) "count >= 5"
6 , sum(case when val < 5 then 1 else 0 end) "count < 5"
7 from (
8 select decode (lvl, 1, 'Q1', 2, 'Q2', 'Q3') colname
9 , decode (lvl, 1, q1, 2, q2, q3) val
10 , lvl
11 from (select q1, q2, q3
12 from q),
13 t)
14 group by colname, lvl
15 order by lvl;Lines 8-10 is what pivots the cartesian join (CJ) of q & t. It helps to explain it by breaking down each part.
The CJ produces (I added the lvl into the output below for explanation purposes):
SQL> with t as (
2 select level lvl from dual
3 connect by level < 4)
4 select q1, q2, q3, lvl
5 from q,
6 t;
Q1 Q2 Q3 LVL
1 3 5 1 <-- line a1
6 7 4 1 <-- line a2
8 5 1 1
2 8 5 1
1 3 5 2 <-- line a5
6 7 4 2
8 5 1 2
2 8 5 2
1 3 5 3
6 7 4 3
8 5 1 3
2 8 5 3
12 rows selected.and the CJ from above now allows us to pivot the results using the LVL column as the "decoding" key.
SQL> with t as (
2 select level lvl from dual
3 connect by level < 4)
4 select decode (lvl, 1, 'Q1', 2, 'Q2', 'Q3') colname
5 , decode (lvl, 1, q1, 2, q2, q3) val
6 , lvl
7 from (select q1, q2, q3
8 from q),
9 t;
COLNAME VAL LVL
Q1 1 1 <-- line b1
Q1 6 1 <-- line b2
Q1 8 1
Q1 2 1
Q2 3 2 <-- line b5
Q2 7 2
Q2 5 2
Q2 8 2
Q3 5 3
Q3 4 3
Q3 1 3
Q3 5 3
12 rows selected.Line b1:
The decodes hit line a1 of the CJ and since lvl = 1, we get colname=Q1 and the corresponding Q1 row value (val=1) of line a1 and finally the value of 1 for lvl.
Line b2:
For decode of line a2 of the CJ, lvl = 1 again and we get colname=Q1 and the corresponding Q1 row value (val=6) of line a2 and finally the value of 1 for lvl.
Line b5:
For decode of line a5 of the CJ, lvl = 2 and we get colname=Q2 and the corresponding Q2 row value (val=3) of line a5 and finally the value of 2 for lvl.
The other rows of the pivoted result set above are obtained similarly and from this result we can now perform the aggregation for the final result.
The WITH query is a called subquery factoring. It allows you to reference the subquery multiple places in the query.
HTH -
How to calculate the sum of the values of some columns of a table
hi
i want to get in the column averages just the average of the values of some columns not all the columns of the table.what i have to change exactly in this block diagram.even if the size of the table is 25,i want the division to be the number of values in each column(= number of rows)
just like that:
Solved!
Go to Solution.
Attachments:
operations on some columns.vi 10 KBi did exactely what u told me, i think i missed something because i don't get the average value of the rows i want
Attachments:
average.vi 11 KB -
K-Bits (1) : Interchange the values of two columns
Hi Everyone
I wanted to get started a mechanism of knowledge sharing in the way of a series of threads called “K-Bits” (Knowledge Bits).
In our day to day work, we learn some new things which can be useful for others. However we hardly get a chance to share it with others.
Here is the opportunity to share your knowledge in the form of “K-Bits”.
Here we start with the First Tip of this series.
You might face a situation where you need to interchange the values of 2 columns in an Oracle database table.
E.g. there is a table employee having columns EMPID, FIRST_NAME, LAST_NAME and SALARY. By mistake the values of FIRST_NAME and LAST_NAME have been interchanged. Now you need to bring the data in correct state.
You can think about following few options:
Option-1_
1. Alter table employee and add a new column TEMP_NAME to it.
2. Update the values of LAST_NAME to TEMP_NAME.
3. Update the LAST_NAME with the values of FIRST_NAME.
4. Update the FIRST_NAME with the values of TEMP_NAME.
5. Drop the column TEMP_NAME.
Option-2 (For Oracle version 9i or higher)_
1. Alter table employee and rename LAST_NAME column to TEMP_NAME.
2. Alter table employee and rename column FIRST_NAME to LAST_NAME.
3. Alter table employee and rename column TEMP_NAME to FIRST_NAME.
Probably you can go ahead with any other solution as well. However there is one very simple solution.
Option-3_
Let do it by example:
DROP TABLE EMPLOYEE;
CREATE TBALE EMPLOYEE
EMPID NUMBER
,FIRST_NAME VARCHAR2(30)
,LAST_NAME VARCHAR2(30)
,SALARY NUMBER
INSERT INTO EMPLOYEE VALUES (1,'Tendulkar','Sachin', 10000);
INSERT INTO EMPLOYEE VALUES (1,'Ganguli','Saurabh', 10000);
INSERT INTO EMPLOYEE VALUES (1,'Pathan','Irfan', 10000);
INSERT INTO EMPLOYEE VALUES (1,'Khan','Jaheer', 10000);
INSERT INTO EMPLOYEE VALUES (1,'Agarkar','Ajit', 10000);
INSERT INTO EMPLOYEE VALUES (1,'Dravid','Rahul', 10000);
SELECT *
FROM EMPLOYEE;
UPDATE EMPLOYEE
SET FIRST_NAME = LAST_NAME
,LAST_NAME = FIRST_NAME;
SELECT *
FROM EMPLOYEE; The update statement above solves the purpose. Is not it simple? But how does it work??
For any DML (Insert, Update or Delete) oracle internally fires the row level triggers. You can read more about triggers at
http://download-east.oracle.com/docs/cd/B10501_01/server.920/a96524/c18trigs.htm
and
http://download-east.oracle.com/docs/cd/B10501_01/appdev.920/a96590/adg13trg.htm#431
As you know in row level triggers the values of each column is stored in :OLD and :NEW parameters. For the above UPDATE statement oracle stores the old values of FIRAT_NAME and LAST_NAME in :OLD.FIRST_NAME and :OLD.LAST_NAME parameters respectively and then update FIRST_NAME with :OLD.LAST_NAME and LAST_NAME with :OLD.FIRST_NAME.
Regards
Arun Kumar GuptaFor any DML (Insert, Update or Delete) oracle internally fires the row level triggers.Any pointer to the documentation supporting this ?
Edited by: Saubhik on Dec 7, 2010 5:58 PM -
Select distinct values for ssrs sharepoint parameter
hi,
I need distinct selected values for parameter dropdown in shaepoint ssrs. Everrything will work fine if i select value and label field same field like(Location_Code). But i need value field to be different field (LocationID). like (dropdown id in value field
and text as lable field)
Because i am using value field in record filtering.
Any suggestions?
Thanks Manohara RHi Manohar,
Pls check the lin
http://social.msdn.microsoft.com/Forums/sqlserver/en-US/6495db18-a1c1-480b-8c92-89c74ee47cf5/how-to-get-distinct-values-of-sharepoint-column-using-ssrs?forum=sqlreportingservices
Please remember to click 'Mark as Answer' on the answer if it helps you -
CE function to get distinct values from Column table
Hi All,
Could you please let me know the appropriate CE function to get the distinct values from column table.
IT_WORK = SELECT DISTINCT AUFNR FROM :IT_WO_DETAILS;
Thank you.Hi,
If you have 10g, you can use Model( with model performance is better than connect by )
Solution
========================================================================
WITH t AS
(SELECT '0989.726332, 1234.567432, 3453.736379, 3453.736379, 0989.726332, 3453.736379, 1234.567432, 1234.567432, 0989.726332'
txt
FROM DUAL)
SELECT DISTINCT TRIM(CHAINE)
FROM T
MODEL
RETURN UPDATED ROWS
DIMENSION BY (0 POSITION)
MEASURES (CAST( ' ' AS VARCHAR2(50)) AS CHAINE ,txt ,LENGTH(REGEXP_REPLACE(txt,'[^,]+',''))+1 NB_MOT)
RULES
(CHAINE[FOR POSITION FROM 1 TO NVL(NB_MOT[0],1) INCREMENT 1] =
CASE WHEN NB_MOT[0] IS NULL THEN TXT[0] ELSE REGEXP_SUBSTR(txt[0],'[^,]+',1,CV(POSITION)) END );
=========================================================================
Demo
=======================================================================
SQL> WITH t AS
2 (SELECT '0989.726332, 1234.567432, 3453.736379, 3453.736379, 0989.726332, 3453.736379, 123
4.567432, 1234.567432, 0989.726332'
3 txt
4 FROM DUAL)
5 SELECT DISTINCT TRIM(CHAINE)
6 FROM T
7 MODEL
8 RETURN UPDATED ROWS
9 DIMENSION BY (0 POSITION)
10 MEASURES (CAST( ' ' AS VARCHAR2(50)) AS CHAINE ,txt ,LENGTH(REGEXP_REPLACE(txt,'[^,]+',''))+1 NB_MOT)
11 RULES
12 (CHAINE[FOR POSITION FROM 1 TO NVL(NB_MOT[0],1) INCREMENT 1] =
13 CASE WHEN NB_MOT[0] IS NULL THEN TXT[0] ELSE REGEXP_SUBSTR(txt[0],'[^,]+',1,CV(POSITION)) END );
TRIM(CHAINE)
3453.736379
1234.567432
0989.726332
SQL>
========================================================================
Maybe you are looking for
-
don't have iphoto on my macbook pro. version 10.6.8.... i want to buy it.
-
ITunes has Stopped Working in Vista
Browsing this forum, I see quite a few people are having trouble with the newest version of iTunes. Ever since I upgraded to iTunes 7.5 a few weeks ago on my 32-bit Vista Ultimate, the program will no longer run. When I try to start iTunes, I get a m
-
Does anyone know of a way to get my PODCAST and Email applications to use multiple WLAN connections? I spend most of my day in one of two places, each with a different WLAN, and I'd the phone to have the sense to change WLAN connection as they become
-
Rebuilding help- need tips for Capital One Accounts
Hi- Thank you all for all the wonderful information, you make rebuilding seem so easy and attainable! I never realized all the different versions of scoring, how to do debt validation, get errors removed from my report and where to focus my attention
-
Passing data row-wise from one VO to another.
Hi, I am a ADF newbie so I have a slight issue which I am not able to resolve. I need to pass data from table t1 to table t2 which I am able to establish by creating viewlink between the two. But each time I press the 'CreateInsert' button for the VO