Oracle case when usage

Source: Internet
Author: User

When using adoquery of Delphi to connect to the Oracle database, NOTE: When SQL contains multiple case when, you must add an arc. Otherwise, an exception or CPU debugging will be reported directly.
The problem is very strange. If the same SQL statement is placed in PL/SQL, it can be executed without an arc. It seems that the adoquery that can be executed in PL can also be used.

SQL example

Select. marc_rec_no, (Case marc_use_flag when '1' order 'when' 2' then' to be edited 'when' 3' then' edited 'when' 4' then' 'end) as marc_use_flag, marc_type, cata_oper, cata_date, lang_code, doc_type_code, m_call_no, m_title, m_author, m_publisher, m_pub_year, m_isbn, B. asord_no, get_mode_code, carrier_code, publ_freq, kind_no, (Case peri_type when '0' then' normal publication 'when' 1 'then' renamed publication 'when' 2 'then' discontinued publication 'when' 3 'then' stopped publication 'end) as peri_type, peri_ord_qty, peri_price, peri_total_price, remark, (Case ord_flag when '0' then' unordered 'when' 1 'then' ordered 'end') as ord_flag from Marc, peri_ord_detl B where. marc_rec_no = B. marc_rec_no and B. peri_ord_cata_id = '4be9f5ba819749c984ce13d922e22c87'

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.