oracle first_rows怎么用,请问:标准中的/*+FIRST_ROWS */ 有什么用处?

本文介绍了Oracle中的查询优化提示/*+FIRST_ROWS */的作用,它用于优化查询以获取前几行数据。通过示例展示了在查询中如何使用此提示,以及在处理大量数据时如何提高查询效率。内容包括对查询语句的解析,涉及表格ar_open_trx_v的筛选条件和排序逻辑。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Select /*+FIRST_ROWS */

ot.trx_number,

ot.customer_id,

ot.customer_number,

ot.class,

substrb(ot.class_meaning, 1, 30) class_meaning,

ot.trx_type,

ot.cust_trx_type_id,

ot.trx_due_date trx_due_date,

/* substrb(decode(sign(ot.payment_schedule_id),

-1,

:app_main.currency_code,

ot.invoice_currency_code),

1,

15) invoice_currency_code,*/

ot.balance_due_curr,

decode(sign(ot.payment_schedule_id),

-1,

to_number(Null),

ot.balance_due_functional) balance_due_functional,

ot.customer_name,

ot.location,

decode(sign(ot.payment_schedule_id),

-1,

to_number(Null),

ot.trx_exchange_rate) trx_exchange_rate,

ot.trx_date trx_date,

decode(sign(ot.payment_schedule_id), -1, to_date(Null), ot.trx_gl_date) trx_gl_date,

ot.calc_discount_on_lines_flag,

ot.partial_discount_flag,

ot.allow_overapplication_flag,

ot.natural_application_only_flag,

ot.creation_sign,

ot.payment_schedule_id,

ot.terms_sequence_number,

ot.customer_trx_id,

/*greatest(to_date(:app_main.cr_gl_date),

ot.trx_gl_date,

decode(fnd_profile.value('AR_APPLICATION_GL_DATE_DEFAULT'),

'INV_REC_SYS_DT',

Sysdate,

'INV_REC_DT',

ot.trx_gl_date,

ot.trx_gl_date)) gl_date,*/

decode(ot.default_reference,

'1',

ot.interface_header_attribute1,

'2',

ot.interface_header_attribute2,

'3',

ot.interface_header_attribute3,

'4',

ot.interface_header_attribute4,

'5',

ot.interface_header_attribute5,

'6',

ot.interface_header_attribute6,

'7',

ot.interface_header_attribute7,

'8',

ot.interface_header_attribute8,

'9',

ot.interface_header_attribute9,

'10',

ot.interface_header_attribute10,

'11',

ot.interface_header_attribute11,

'12',

ot.interface_header_attribute12,

'13',

ot.interface_header_attribute13,

'14',

ot.interface_header_attribute14,

'15',

ot.interface_header_attribute15,

Null) reference,

ot.term_id,

decode(sign(ot.payment_schedule_id),

-1,

to_number(Null),

ot.amount_due_original) amount_due_original,

ot.amount_line_items_original,

ot.balance_due_curr_unformatted,

ot.discount_taken_earned,

ot.discount_taken_unearned,

ot.trx_batch_source_name trx_batch_source_name,

ot.amount_adjusted amount_adjusted,

ot.amount_adjusted_pending amount_adjusted_pending,

ot.amount_line_items_remaining amount_line_items_remaining,

ot.freight_original freight_original,

ot.freight_remaining freight_remaining,

ot.receivables_charges_remaining receivables_charges_remaining,

ot.tax_original tax_original,

ot.tax_remaining tax_remaining,

ot.selected_for_receipt_batch_id selected_for_receipt_batch_id,

ot.trx_billing_number trx_billing_number,

ot.purchase_order purchase_order,

ot.bill_to_site_use_id bill_to_site_use_id,

ot.open_receipt_status_meaning,

ot.customer_reference,

ot.reason,

ot.receivable_application_id,

ot.account_description

From ar_open_trx_v ot

Where ot.status ='OP'

--decode(:rwapp_control.show_closed_invoices, 'TRUE', ot.status, 'OP')

--And nvl(ot.terms_sequence_number, 99) =

-- nvl(:app_folder.installment, nvl(ot.terms_sequence_number, 99)) /* for considering the defaulted installment number : bug 415478 */

Order By decode(sign(ot.payment_schedule_id), -1, 0, 4),

ot.trx_number,

ot.customer_name,

ot.terms_sequence_number,

ot.payment_schedule_id

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值