我的类型定义为:
CREATE TYPE typ_1 AS
(result integer,
pp1 integer,
pp2 integer);
我有一个函数func1
,它返回typ_1
当我这样做时:select func1()
我在一列中获得3个值,例如:(1,2,3)
或(1,,)
如何修改查询以仅获取第一个值?
我试过了unnest
,但它不适合这种类型。
答案 0 :(得分:1)
如果我没记错,请使用<input name="invoice_number" placeholder="Invoice Number" class="form-control ng-model="invoice_name" type="text">
<input name="customer_name" placeholder="Customer Name" class="form-control" ng-model="customer_name" type="text">
<tr class="gradeU" ng-repeat="x in invoice| filter:{invoice_number : invoice_name} | filter:{customer_name : customer_name}">
<td>{{ x.invoice_number}}</td>
<td>{{ x.customer_name}}</td>
<td >{{ x.company_name}}</td>
<td style="text-align: right;">{{ x.total_invoice | currency : $}}</td>
<td style="text-align: center;">{{ x.created | datetime }}</td>
<td style="text-align: center;">
<a href="preview-invoice/{{x.unique_id}}" target="_blank"><button class="btn btn-success btn-xs" uib-tooltip="Preview Invoices" tooltip-placement="top"><i class="fa fa-file-pdf-o"></i></button></a>
<a href="download-invoice/{{x.invoice_number}}.pdf" ><button class="btn btn-warning btn-xs" uib-tooltip="Download Invoices" tooltip-placement="top"><i class="fa fa-download"></i></button></a>
</td>
</tr>
()
是。在我的情况下
SELECT (func1()).result, (func1()).pp1, (func1()).pp2