Token Comma Expected - powerquery

I am trying to add a parameter (Period) to change part of the SQL statement but I am getting the "Token Comma Expected" error:
let
Period = Excel.CurrentWorkbook(){[Name="Period"]}[Content]{0}[Period],
Source = Sql.Database("FVC-HO-SQL-02", "FVCHLD", [Query="SELECT * FROM OPENQUERY ([NAMIBIA], 'SELECT * FROM PAS19NFPM23.LedgerTransactions where GDC = ''D'' and PPeriod = "Period"')#(lf)union all#(lf)SELECT * FROM OPENQUERY ([NAMIBIA], 'SELECT * FROM PAS19FREWB23.LedgerTransactions where GDC = ''D'' and PPeriod = Period')"])
Details above, unsure how to proceed.

Wherever it used to say period=xxx use period="&Period&"

Related

ODP.NET, Managed reading LONG column results in ORA-01009

I'm trying to get the source of a view in my .net app.
To do this, I query DBA_VIEWS: it has a column TEXT with exactly what I need. The type is LONG.
If I do it using the Unmanaged driver, everything works as expected.
The same code with Managed driver results in ORA-01009: missing mandatory parameter.
Adding a transaction around the command and using breakpoint and "slow" steps sometimes results in the same code working.
ODP.NET version is 19, Oracle DB is 18c Express Edition. Strangely enough, the same code works just fine with Oracle Database 12c regardless of driver type.
Is there maybe some setting I need to change on the database or in code? I'm completely lost here.
Code I'm using for testing:
Imports System.Data.Common
Imports Oracle.ManagedDataAccess
'Imports Oracle.DataAccess
Module Views
Function CreateCommand(Connection As DbConnection) As System.Data.Common.DbCommand
Dim cmd As Data.Common.DbCommand = Connection.CreateCommand()
With CType(cmd, Client.OracleCommand)
.BindByName = True
.FetchSize = &H100000 '1 Mb
.InitialLONGFetchSize = -1 'the entire LONG or LONG RAW data is prefetched and stored in the fetch array.
.InitialLOBFetchSize = -1 'the entire LOB data is prefetched and stored in the fetch array.
End With
Return cmd
End Function
Sub query()
Try
Using DBConnection = New Client.OracleConnection("User ID=TESTUSER;Password=TESTPWD;Data Source=TESTDB;Pooling=True")
DBConnection.Open()
Using DBConnection.BeginTransaction()
Using cmdSQL = CType(CreateCommand(DBConnection), Client.OracleCommand)
cmdSQL.CommandText = "select TEXT from DBA_VIEWS where VIEW_NAME = :0"
Dim p = cmdSQL.CreateParameter()
p.ParameterName = "0"
p.Value = "TEST_VIEW"
cmdSQL.Parameters.Add(p)
Dim sw = Stopwatch.StartNew
Using rdr = cmdSQL.ExecuteReader
rdr.FetchSize = 2 ^ 20
While rdr.Read
Dim row(rdr.FieldCount - 1) As Object
rdr.GetProviderSpecificValues(row)
Dim x = row(0)
Console.WriteLine($"{x.ToString.Length} bytes")
End While
End Using
Console.WriteLine($"{sw.ElapsedMilliseconds} ms")
End Using
End Using
End Using
Catch ex As Exception
Console.WriteLine(ex.ToString)
End Try
End Sub
End Module
You can use an anonymous block with output parameter and a call to ExecuteNonQuery. Your command text will be
"begin select TEXT into :0 from DBA_VIEWS where VIEW_NAME = :1; end;"
Add 2 parameters. Make sure that
' Parameter #1 has
p.Direction = ParameterDirection.Output
p.OracleDbType = OracleDbType.Long
p.Size = 1000000
And use command cmd.ExecuteNonQuery(). Then, when parameter is retrieved, just use its value
Dim txt As String = cmd.Parametersp[0].Value.ToString()
It's a pity, Oracle deprecated LONG data type for ages but LONG data is still used many times for internal data.
You could write a function and then get the data by calling the function:
create or replace function GetViewText(v in varchar2) return clob is
ret CLOB;
BEGIN
FOR aRow IN (SELECT TEXT FROM DBA_VIEWS WHERE VIEW_NAME = v) LOOP
ret := aRow.TEXT;
-- or ret := TO_CLOB(aRow.TEXT);
END LOOP;
RETURN ret;
END;
Yet another way from this answer is to (ab)use dbms_xmlgen.getxml.
We can either use it to query a single view's code (as in my original question)
with input as (
select
:0 as VIEW_NAME
from dual
)
SELECT
substr(
text_xml,
instr(text_xml, '<LONGCOL>') + length('<LONGCOL>'),
instr(text_xml, '</LONGCOL>', -1) - (instr(text_xml, '<LONGCOL>') + length('<LONGCOL>'))
) as TEXT
from
(
-- getxml can return malformed xml (which is good in this case)
-- while getxmltype can not.
select dbms_xmlgen.getxml(q'{
SELECT TEXT as LONGCOL
FROM SYS.DBA_VIEWS
WHERE VIEW_NAME = '}' || input.VIEW_NAME || q'{'
}') as text_xml
from input
)
or create our own DBA_VIEWS version.
create or replace view APP_SCHEMA.DBA_VIEWS
as
select
OWNER, VIEW_NAME, TEXT_LENGTH,
case
when (TEXT_VC is not null and TEXT_LENGTH <= 4000)
then to_clob(TEXT_VC)
when TEXT is NULL
then NULL
else (
SELECT
substr(
text_xml,
instr(text_xml, '<LONGCOL>') + length('<LONGCOL>'),
--instr(text_xml, '</LONGCOL>', -1) - (instr(text_xml, '<LONGCOL>') + length('<LONGCOL>'))
TEXT_LENGTH
) as TEXT
from
(
-- getxml can return malformed xml (which is good in this case)
-- while getxmltype can not.
select dbms_xmlgen.getxml(q'{
SELECT TEXT as LONGCOL
FROM SYS.DBA_VIEWS
WHERE OWNER = '}' || OWNER || q'{'
and VIEW_NAME = '}' || VIEW_NAME || q'{'
}') as text_xml
from dual
)
)
end as TEXT,
TEXT_VC, TYPE_TEXT_LENGTH, TYPE_TEXT, OID_TEXT_LENGTH, OID_TEXT, VIEW_TYPE_OWNER, VIEW_TYPE, SUPERVIEW_NAME, EDITIONING_VIEW, READ_ONLY, CONTAINER_DATA, BEQUEATH, ORIGIN_CON_ID, DEFAULT_COLLATION, CONTAINERS_DEFAULT, CONTAINER_MAP, EXTENDED_DATA_LINK, EXTENDED_DATA_LINK_MAP, HAS_SENSITIVE_COLUMN
from sys.dba_views
;

COPY TO excel Sheet in foxpro

Is their any command in Foxpro that convert the DBF into a particular excel sheet.
I have three DBF(dbf_1, dbf_2, dbf_3). My current program convert the file using copy to "filename.xls" type fox2x and then I will manually copy the consolidate all the sheet into one excel. For me, this method I using is alright but what if their are 20 or more dbf that I will consolidate. Is their any command in foxpro that convert the dbf's into one excel file. I already use the foxpro Automation but it is to slow.
No there isn't.
Also "copy to ... type fox2x". although better than many other type selections (such as csv and xls) should not be chosen when there are better ways.
You are saying automation is slow, but don't know if you are really finding automation slow, or if you have tried it in the ways that you shouldn't use to transfer data to Excel. The sample below, use one of the variations of my "vfp2excel" function and automation. It transfers sample Customer, Employee, Orders, OrdItems and Products data in 2.5 seconds on my machine. If you really meant it as slow then no dice, otherwise here is the sample:
* These represent complex SQL as a sample
Select emp_id,First_Name,Last_Name,;
Title,Notes ;
from (_samples+'\data\employee') ;
into Cursor crsEmployee ;
readwrite
Replace All Notes With Chrtran(Notes,Chr(13)+Chr(10),Chr(10))
Select cust_id,company,contact,Title,country,postalcode ;
from (_samples+'\data\customer') ;
into Cursor crsCustomer ;
nofilter
Select * ;
from (_samples+'\data\orders') ;
into Cursor crsOrders ;
nofilter
Select * ;
from (_samples+'\data\orditems') ;
into Cursor crsOrderDetail ;
nofilter
Select * ;
from (_samples+'\data\products') ;
into Cursor crsProducts ;
nofilter
* Now we want to get these on 3 sheets
* Sheet1: Employees only
* Sheet2: Customers only
* Sheet3: Orders, ordItems, Products layed out horizontally
Local oExcel
oExcel = Createobject("Excel.Application")
With oExcel
.DisplayAlerts = .F.
.Workbooks.Add
.Visible = .T.
With .ActiveWorkBook
For ix = 1 To 3 && We want 3 Sheets
If .sheets.Count < m.ix
.sheets.Add(,.sheets(.sheets.Count)) && Add new sheets
Endif
Endfor
* Name the sheets
.WorkSheets(1).Name = "Employees"
.WorkSheets(2).Name = "Customers"
.WorkSheets(3).Name = "Order, OrderDetail, Products" && max sheetname is 31 chars
* Start sending data
* First one has headers specified
VFP2Excel('crsEmployee', .WorkSheets(1).Range("A1"), ;
"Id,First Name,Last Name,Employee Title,Comments about employee" ) && To sheet1, start at A1
VFP2Excel('crsCustomer', .WorkSheets(2).Range("A1") ) && To sheet2, start at A1
VFP2Excel('crsOrders', .WorkSheets(3).Range("A1") ) && To sheet3, start at A1
* Need to know where to put next
* Leave 2 columns empty - something like 'G1'
lcRange = _GetChar(.WorkSheets(3).UsedRange.Columns.Count + 3) + '1'
* To sheet3, start at next to previous
VFP2Excel('crsOrderDetail', .WorkSheets(3).Range(m.lcRange) )
lcRange = _GetChar(.WorkSheets(3).UsedRange.Columns.Count + 3) + '1'
* To sheet3, start at next to previous
VFP2Excel('crsProducts', .WorkSheets(3).Range(m.lcRange) )
#Define xlJustify -4130
#Define xlTop -4160
* I just happen to know notes in at column 5 from SQL
* No need to query from excel to keep code simple
* Lets format that column specially instead of leaving
* at the mercy of Excel's autofitting
.WorkSheets(1).UsedRange.VerticalAlignment = xlTop && set all to top
With .WorkSheets(1).Columns(5)
.ColumnWidth = 80 && 80 chars width
.WrapText = .T.
* .HorizontalAlignment = xlJustify && doesn't work good always
Endwith
* Finally some cosmetic stuff
For ix=1 To 3
With .WorkSheets(m.ix)
.Columns.AutoFit
.Rows.AutoFit
Endwith
Endfor
.WorkSheets(1).Activate
Endwith
Endwith
* Author: Cetin Basoz
* This is based on earlier VFP2Excel function codes
* that has been published on the internet, at various sites
* since 2001. Not to be messed with others' code who named the same but has
* nothing to do with the approaches taken here (unless copy & pasted and claimed
* to be their own work, < s > that happens).
Procedure VFP2Excel(tcCursorName, toRange, tcHeaders, tnPrefferredWidthForMemo)
* tcCursorName
* toRange
* tcHeaders: Optional. Defaults to field headers
* tnPrefferredWidthForMemo: Optional. Default 80
* Function VFP2Excel
tcCursorName = Evl(m.tcCursorName,Alias())
tnPrefferredWidthForMemo = Evl(m.tnPrefferredWidthForMemo,80)
Local loConn As AdoDB.Connection, loRS As AdoDB.Recordset,;
lcTemp,lcTempDb, oExcel,ix, lcFieldName, lcHeaders
lnSelect = Select()
lcTemp = Forcepath(Sys(2015)+'.dbf',Sys(2023))
lcTempDb = Forcepath(Sys(2015)+'.dbc',Sys(2023))
Create Database (m.lcTempDb)
Select * From (m.tcCursorName) Into Table (m.lcTemp) Database (m.lcTempDb)
Local Array aMemo[1]
Local nMemoCount
nMemoCount = 0
lcHeaders = ''
For ix = 1 To Fcount()
lcFieldName = Field(m.ix)
If Type(Field(m.ix))='M'
nMemoCount = m.nMemoCount + 1
Dimension aMemo[m.nMemoCount]
aMemo[m.nMemoCount] = m.ix
Replace All &lcFieldName With Chrtran(&lcFieldName,Chr(13)+Chr(10),Chr(10))
Endif
lcHeaders = m.lcHeaders + Iif(Empty(m.lcHeaders),'',',')+Proper(m.lcFieldName)
Endfor
tcHeaders = Evl(m.tcHeaders,m.lcHeaders)
Use In (Juststem(m.lcTemp))
Close Databases
Set Database To
loStream = Createobject('AdoDb.Stream')
loConn = Createobject('ADODB.Connection')
loRS = Createobject("ADODB.Recordset")
loConn.ConnectionString = "Provider=VFPOLEDB;Data Source="+m.lcTempDb
loConn.Open()
loRS = loConn.Execute("select * from "+m.lcTemp)
loRS.Save( loStream )
loRS.Close
loConn.Close
Erase (m.lcTemp)
* Use first row for headers
Local Array aHeader[1]
loRS.Open( loStream )
toRange.Offset(1,0).CopyFromRecordSet( loRS ) && Copy data starting from headerrow + 1
Set Safety Off
Delete Database (m.lcTempDb) Deletetables
Select (m.lnSelect)
For ix=1 To Iif( !Empty(m.tcHeaders), ;
ALINES(aHeader, m.tcHeaders,1,','), ;
loRS.Fields.Count )
toRange.Offset(0,m.ix-1).Value = ;
Iif( !Empty(m.tcHeaders), ;
aHeader[m.ix], ;
Proper(loRS.Fields(m.ix-1).Name) )
toRange.Offset(0,m.ix-1).Font.Bold = .T.
Endfor
#Define xlJustify -4130
#Define xlTop -4160
* This part is cosmetic
toRange.WorkSheet.Activate
With toRange.WorkSheet.UsedRange
.VerticalAlignment = xlTop && set all to top
For ix=1 To m.nMemoCount
With .Columns(aMemo[m.ix])
.ColumnWidth = m.tnPrefferredWidthForMemo && 80 chars width
.WrapText = .T.
Endwith
Endfor
.Columns.AutoFit
.Rows.AutoFit
Endwith
Endproc
* Return A, AA, BC etc noation for nth column
Function _GetChar
Lparameters tnColumn && Convert tnvalue to Excel alpha notation
If m.tnColumn = 0
Return ""
Endif
If m.tnColumn <= 26
Return Chr(Asc("A")-1+m.tnColumn)
Else
Return _GetChar(Int(Iif(m.tnColumn % 26 = 0,m.tnColumn - 1, m.tnColumn) / 26)) + ;
_GetChar((m.tnColumn-1)%26+1)
Endif
Endfunc
This is what I was looking for :-) I was trying with my knowledge of Excel Automation programming in Visual FoxPro but always got errors. My task was to create "n" Sheets from one big cursors which I want to parse regarding customer selection of attribute name from cursor to get also "n" Sheets. This sample is for 3 cursors and 3 Sheets and it is generic. But I need this for "n" cursors and one attribute which customer select to distinct and get "n" Sheets in one Excel file. So now I have dynamic procedure. I customized this code and solve my problem which I am trying to end for about 4 days. So again thank you for this code and off course I will not modify VFP2Excel procedure and wrote somewhere else my name. Thanks for help !
There is no native VFP function to do this, BUT, there is an awesome open source project which has a class that will make this very easy:
VFPx Workbook Xlsx - See it here on Github: XLSX Workbook for FoxPro
It has 3 magical functions that will do exactly what you asked for:
CreateWorkbook()
AddSheet()
SaveTableToWorkbook()
(Repeat commands 2 and 3 above for each DBF/Sheet you want to create)
It is well documented with a 54-page PDF and code sample that explains everything you'll need to know.

"Not all variables are bound" Error when passing parameters

I'm using PL/SQL and I get the "Not all variables are bound" when I execute the sql expression. I'm selecting data by passing values into 3 parameters. Therefore "host variables" do not help me in here.
SELECT SomeApi1_Api.Get_Part_No(t.or_no, t.l_no, t.rel_no, t.item_no),
t.description,
c.serial_no,
c.lot_batch_no,
t.order_no,
t.line_no,
t.release_no,
SomeApi1_Api.Get_State(t.or_no, t.l_no, t.rel_no, t.item_no)
FROM TableView1 c,
TableView2 t
WHERE c.or_no = t.or_no
AND c.l_no = t.l_no
AND c.rel_no = t.rel_no
AND c.item_no = t.item_no
AND deliv_no IN (SELECT deliv_no
FROM TableView3 a
WHERE a.del_no IN (SELECT DISTINCT dele_no
FROM TableView3 cod,
TableView4 cdi
WHERE cod.deliv_no = cdi.deliv_no
AND cdi.i_id = t.i_id
AND cdi.item_id = t.item_id
AND cdi.co = t.co
AND a.or_no = t.or_no
AND a.l_no = l_no
AND a.rel_no = rel_no
AND a.item_no = item_no))
AND t.i_id = '&A'
AND t.item_id = '&B'
AND t.co = '&C'

Bad Request error when calling HTTP_POST?

I have a question about the SAP Function Module "http_post".
I just want to post a short message (msg) out of the SAP to a Push Notification Server (pushd-Github-Projekt) I installed before. Now I'm not sure how to pass the message.
I tested the FM with the test-symbol:
CALL FUNCTION 'HTTP_POST'
exporting
ABSOLUTE_URI = uri " Uniform Resource Identifier (RFC 1945)
* REQUEST_ENTITY_BODY_LENGTH = 14 "request_entity_body_length
* RFC_DESTINATION = " RFC Destination
* PROXY = " HTTP Proxy Rechner
* PROXY_USER = " Benutzername auf dem Proxy Rechner
* PROXY_PASSWORD = " Passwort auf dem Proxy Rechner
* USER = " Benutzername auf dem HTTP Server
* PASSWORD = " Passwort auf dem HTTP Server
* BLANKSTOCRLF = " Blanks in CRLF konvertieren im Entity Body
* importing
* STATUS_CODE = " Statuscode ( 2xx = OK )
* STATUS_TEXT = " Text zum Statuscode
* RESPONSE_ENTITY_BODY_LENGTH = " Länge vom Response-Entity-Body
tables
REQUEST_ENTITY_BODY = '{"msg":"test"}' "request_entity_body
RESPONSE_ENTITY_BODY = '' " Response-Entity-Body Daten
RESPONSE_HEADERS = '' " Header Zeilen vom Response
REQUEST_HEADERS = 'Content-Type: application/json' "request_headers
* exceptions
* CONNECT_FAILED = 1
* TIMEOUT = 2
* INTERNAL_ERROR = 3
* TCPIP_ERROR = 4
* SYSTEM_FAILURE = 5
* COMMUNICATION_FAILURE = 6
* OTHERS = 7
.
I know my values are no tables, but I tested it with the test-symbol, where you can write the values directly in a table.
When I start the FM, I get an Bad Request error in the SAP
and this error at the push notification server:
SyntaxError: Unexpected token
at Object.parse (native)
at IncomingMessage.<anonymous> ...Path from the pushd..
express\node_modules\connect\lib\middleware\json.js:76:27
at incomingMessage.EventEmitter.emit events.js:92:17
at _stream:readable.js:919:16
at process._tickCallback <node.js:419:13>
Can anyone help me how to pass the request to the FM HTTP-Post? It has to be sth. with msg, because otherwise the Push-Notification-Server can't handle it.
In SAP_BASIS release 731 or higher, I would strongly recommend to use the class CL_HTTP_CLIENTfor doing HTTP requests. See here an example report on how to do it. Replace the dummy string http:1.2.3.4:80/testjon/by your URL in question.
report z_test_http_post.
start-of-selection.
perform start.
* ---
form start.
data: lv_status type i,
lv_error_occurred type flag,
lv_error_msg type string,
lv_response_body type string.
perform send_json using
'http://1.2.3.4:80/testjson/' " Use your URL here
'{"hello":"world"}' " Use your JSON here
changing lv_status lv_response_body
lv_error_occurred
lv_error_msg.
* Show result
format color col_heading.
write: / 'Response status:', lv_status.
if lv_error_occurred = 'X'.
format color col_negative.
write: / 'Error occurred:', lv_error_msg.
endif.
format color col_normal.
write: / 'Response:', lv_response_body.
endform. "start
form send_json using iv_url type string
iv_json_data type string
changing cv_status type i
cv_response_body type string
cv_error_occurred type flag
cv_error_msg type string.
data: lo_client type ref to if_http_client.
clear: cv_error_msg,
cv_status,
cv_error_occurred,
cv_error_msg.
if iv_url is initial.
* No URL passed
message e349(sbds) into cv_error_msg.
cv_error_occurred = 'X'.
return.
endif.
call method cl_http_client=>create_by_url
exporting
url = iv_url
importing
client = lo_client
exceptions
argument_not_found = 1
plugin_not_active = 2
internal_error = 3
others = 4.
if sy-subrc ne 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
into cv_error_msg.
cv_error_occurred = 'X'.
return.
endif.
lo_client->request->set_cdata( iv_json_data ).
lo_client->request->set_content_type( 'application/json' ).
lo_client->request->set_method( 'POST' ).
call method lo_client->send
exceptions
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3
others = 4.
if sy-subrc ne 0.
lo_client->get_last_error( importing message = cv_error_msg ).
cv_error_occurred = 'X'.
return.
endif.
lo_client->receive( exceptions others = 1 ).
if sy-subrc ne 0.
lo_client->get_last_error( importing message = cv_error_msg ).
cv_error_occurred = 'X'.
return.
endif.
cv_response_body = lo_client->response->get_cdata( ).
lo_client->response->get_status( importing code = cv_status ).
endform.

1 result set from 3 queries?

I'm at my wits end attempting to make this happen. Currently I have 3 separate queries. For automation purposes I need to get the results of these three queries in one output, I cannot seem to join them properly to get the expected results.
QUERY 1:
SELECT OH.EXTN_HOST_ORDER_REF,
OL.EXTN_HOST_ORDER_LINE_REF,
OL.ORIGINAL_ORDERED_QTY,
OL.EXTN_TENDER_QUANTITY,
OL.EXTN_CUM_PICK_QTY,
OL.SHIPPED_QUANTITY,
OL.EXTN_REFUND_QTY
FROM YFS_ORDER_HEADER OH,
YFS_ORDER_LINE OL
WHERE OH.ORDER_HEADER_KEY = OL.ORDER_HEADER_KEY
AND OH.DOCUMENT_TYPE = '0001'
AND OH.EXTN_HOST_ORDER_REF = 'xxxxxxxxxxx'
ORDER BY PL.EXTN_HOST_ORDER_LINE_REF ASC;
QUERY 2:
SELECT RS.STATUS_QUANTITY AS RETURNED_QTY
FROM YFS_ORDER_HEADER OH,
YFS_ORDER_LINE OL,
YFS_ORDER_RELEASE_STATUS RS
WHERE OH.ORDER_HEADER_KEY = OL.ORDER_HEADER_KEY
AND OL.ORDER_LINE_KEY = RS.ORDER_LINE_KEY
AND RS.STATUS = '3700.02'
AND OH.EXTN_HOST_ORDER_REF = 'xxxxxxxxxxx';
QUERY 3
SELECT RS.STATUS_QUANTITY AS CANCELLED_QTY
FROM YFS_ORDER_HEADER OH,
YFS_ORDER_LINE OL,
YFS_ORDER_RELEASE_STATUS RS
WHERE OH.ORDER_HEADER_KEY = OL.ORDER_HEADER_KEY
AND OL.ORDER_LINE_KEY = RS.ORDER_LINE_KEY
AND RS.STATUS = '9000'
AND OH.EXTN_HOST_ORDER_REF = 'xxxxxxxxxxx';
The query should show NULL values where no data exists from query 2 & 3.
Thanks in advance for your help and advice!
If you are allowed to show both returned and cancelled quantities, the following simple edit should work. Hope this helps.
SELECT oh.extn_host_order_ref,
ol.extn_host_order_line_ref,
ol.original_ordered_qty,
ol.extn_tender_quantity,
ol.extn_cum_pick_qty,
ol.shipped_quantity,
ol.extn_refund_qty,
DECODE (rs.status, '3700.02', rs.status_quantity) AS returned_qty,
DECODE (rs.status, '9000', rs.status_quantity) AS cancelled_qty
FROM yfs_order_header oh
INNER JOIN yfs_order_line ol
ON oh.order_header_key = ol.order_header_key
LEFT OUTER JOIN yfs_order_release_status rs
ON ol.order_line_key = rs.order_line_key
WHERE oh.document_type = '0001' AND oh.extn_host_order_ref = 'xxxxxxxxxxx'
ORDER BY pl.extn_host_order_line_ref ASC;

Resources