Oracle 11g row-and-column conversion to unregister

Source: Internet
Author: User

Oracle 11g provides new row and column conversion operations: Convert (row to column) and unconvert column to row. This document describes the unregister function.

The existing table src_table is as follows:

Product_Id (product ID) Product_color (color) Porduct_type (model) Is_intelligent (smart or not)
1111 Red T1 Yes
1112 Blue T2 No
1113 Green T3 Yes

The target table dest_table is as follows:

Product_Id Param_name (parameter name) Param_value (parameter value)
1111 Product_color Red
1112 Product _Color Blue
1113 Product _Color Green
1111 Product _Type T1
1112 Product _Type T2
1113 Product_tYpe T3
1111 Is_intelligent Yes
1112 Is_intelligent No
1113 Is_intelligent Yes

Unregister is implemented as follows:

SELECT *
FROM src_table
Unordered (param_value FOR param_name IN (product_color AS 'product _ color', product_type AS 'product _ type', is_intelligent AS 'is _ intelligent ');

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.