Oracle's Magical Chemistry (row to column + Get table field)

Source: Internet
Author: User

Orange + soda = orange soda, ∑ (? д?ノ) Dentetsu good boring!!!

Turkey + Grill = roast turkey,? (´?`?) Not bad.

Wm_concat () + table field query = (?ω?) What would it be?

The Wm_concat () function, which separates the column values by the "," number, and displays them as a line. Examples are as follows:

I have a super big food table China_foods, which contains food throughout the country, from the pot chicken, lamb dish sausage to pork, stinky tofu ...

Today's overtime to write a blog, wrote here when I feel the fatty intestine of the hungry, want to order a takeaway, so I want to find a delicious food table to order:

In order to save time to write a blog, I decided to put the order and the burden of payment to my little girlfriend to carry out.

For the trust that my life entrusted to her, my little girlfriend was flattered and firmly rejected me, because she felt that she could not copy directly to the search box when she was late for lazy cancer.

However, there is room for a turn, she said, if I change the form of a string, I can accept the request for my order.

"Give me a second!" "I reply to her like this.

A second later, I wrote down the following SQL

Select  from China_foods;

Send decisively

What's the situation, thinking about memories ... Find bug ... Dozen n times the phone repeatedly admitted that should not be sent wrong ... Re-add a friend and send a menu of type string.

This is going to be a thing! In order to eat, I endure, say how she still understand the full-angle half-width of such things?

After a second, I wrote down the following SQL

-- Select Wm_concat (food_name) from China_foods; Select Replace (Wm_concat (food_name),',',', ' from China_foods;

Copy results, sending

The next progress is very smooth, small embarrassed me a bit, the little girl friend gave me to go to the next single, she really still Love Me (*^▽^*)

While taking advantage of the delivery, I a+v from the angle of a small study of Wm_concat (), sure enough to unlock a new posture

--What fields are queried for table aSELECTcolumn_name fromAll_tab_columns TWHERET.owner='Cms_uat'  andT.table_name='Company_trf_lns_f';--The fields owned by Table A are assembled into strings instead of the traditional select * from Tbl_a;SELECTWm_concat (column_name) fromAll_tab_columns TWHERET.owner='Cms_uat'  andT.table_name='Company_trf_lns_f';

In this case, it is convenient to write an INSERT statement or a multi-field query statement.

So, did I get the takeout?

Daughter friend: that ... Order the wrong address, take out the whole send me here, or I wait for you to eat together ... "

Having written so much, I would like to ask the lesson of a little girlfriend in what position?

Oracle's Magical Chemistry (row to column + Get table field)

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.