Friday, November 25, 2011

Displaying multiple records in one row

I have a table with values as follows:

SQL> SELECT deptno, ename FROM emp ORDER BY deptno, ename;

DEPTNO ENAME

------ ----------

10 CLARK

10 KING

10 MILLER

20 ADAMS

20 FORD

20 JONES

20 SCOTT

20 SMITH

30 ALLEN

30 BLAKE

30 JAMES

30 MARTIN

30 TURNER

30 WARD

14 rows selected.

but I need them in the following less convenient format:

DEPTNO ENAME

------ -----------------------------------------

10 CLARK, KING, MILLER

20 ADAMS, FORD, JONES, SCOTT, SMITH

30 ALLEN, BLAKE, JAMES, MARTIN, TURNER, WARD

The following example illustrates the technique using the SCOTT demo table "emp":2

SELECT deptno

, LTRIM(SYS_CONNECT_BY_PATH(ename,','))

FROM ( SELECT deptno, ename

, ROW_NUMBER() OVER (PARTITION BY deptno ORDER BY ename) -1 AS seq

FROM emp )

WHERE connect_by_isleaf = 1

CONNECT BY seq = PRIOR seq +1 AND deptno = PRIOR deptno

START WITH seq = 1;

DEPTNO CONCATENATED

---------- --------------------------------------------------

10 CLARK,KING,MILLER

20 ADAMS,FORD,JONES,SCOTT,SMITH

30 ALLEN,BLAKE,JAMES,MARTIN,TURNER,WARD

3 rows selected.

Another approach involves harnessing the dark power of XML:3

SELECT deptno

, RTRIM

( xmlagg (xmlelement (c, ename || ',') order by ename).extract ('//text()')

, ',' ) AS concatenated

FROM emp

GROUP BY deptno;

DEPTNO CONCATENATED

---------- ---------------------------------------------------------------

10 CLARK,KING,MILLER

20 ADAMS,FORD,JONES,SCOTT,SMITH

30 ALLEN,BLAKE,JAMES,MARTIN,TURNER,WARD

3 rows selected.

Friday, November 11, 2011

Differnce between .NET FrameWork

.NET FrameWork 2. 0 Features:
Generics
Anonymous methods
Partial class
Nullable type
The new API gives a fine grain control on the behavior of the runtime with regards to multithreading, memory allocation, assembly loading and more
Full 64-bit support for both the x64 and the IA64 hardware platforms
New personalization features for ASP.NET, such as support for themes, skins and webparts.
.NET Micro Framework
Data Tables

.NET Framework 3.0 Features:

Also called WinFX,includes a new set of managed code APIs that are an integral part of Windows Vista and Windows Server 2008 operating systems and provides
Windows Communication Foundation (WCF) – formerly called Indigo; a service-oriented messaging system which allows programs to interoperate locally or remotely similar to web services
Windows Presentation Foundation (WPF) - formerly called Avalon; a new user interface subsystem and API based on XML and vector graphics, which uses 3D computer graphics hardware and Direct3D technologies.
Windows Workflow Foundation (WF) allows for building of task automation and integrated transactions using workflows.
Windows CardSpace, formerly called InfoCard; a software component which securely stores a person’s digital identities and provides a unified interface for choosing the identity for a particular transaction, such as logging in to a website

.NET Framework 3.5 Features:

Language Integrated Query (LINQ) for SQL, XML, Dataset, Object
Addin system
p2p base class
Active directory
ASP.NET Ajax
Anonymous types with static type inference
Paging support for ADO.NET
ADO.NET synchronization API to synchronize local caches and server side data stores
Asynchronous network I/O API
Support for HTTP pipelining and syndication feeds.
New System.CodeDom namespace

.NET Framework 4.0 Features:

Common Language Runtime (CLR) – The following sections describe new features in security, parallel computing, performance and diagnostics, dynamic language runtime, and other CLR-related technologies
Base Class Libraries
Networking – Enhancements have been made that affect how integrated Windows authentication is handled by the HttpWebRequest, HttpListener, SmtpClient, SslStream, NegotiateStream, and related classes in the System.Net and related namespaces
Web – The following sections describe new features in ASP.NET core services, Web Forms, Dynamic Data, and Visual Web Developer.
Client – The following sections describe new features in Windows Presentation Foundation (WPF) and Managed Extensibility Framework (MEF).
Data
Communications – Windows Communication Foundation (WCF) provides the new features and enhancements described in the following sections.
Workflow – Windows Workflow Foundation (WF) in .NET Framework 4.0 changes several development paradigms from earlier versions. Workflows are now easier to create, execute, and maintain.