目的
LOBを読み取ります。
構文
tdr.LobRead(contextID, length)
- contextID
- パラメータ型: integer
tdr.LobOpen_CL関数によって返されるコンテキストID。
- length
- パラメータ型: numeric
読み取るバイト数。
戻り値
LOB内容を含むRAWベクトル。
関数でエラーが発生した場合、NULLが返されます。
使用上の注意
この関数を呼び出す前に、tdr.LobOpen_CL関数を呼び出して、コンテキストIDを取得します。次に、このコンテキストIDをこの関数の引数として渡します。
この関数は、テーブル演算子から呼び出された場合にのみ有効です。
関数がコントラクト関数から呼び出された場合は、エラーが発生します。
例: LOBの読み取り
5 つの属性(int、int、int、int、clob)を持つ入力テーブルを想定します。この例では、次のように現在行の最後の属性を読み取る方法を示します。
- LOBロケータを取得する
- LOBを開く
- LOBを読み取る
- LOBを閉じる
# Open the input stream
inHandle <- tdr.Open("R", 0, 0);
# Get the 5th attribute in the current row (LOB locator)
att5 <- tdr.GetAttributeByNdx(inHandle, 4, NULL);
# Open the LOB for reading
inlob <- tdr.LobOpen_CL(att5,0,0);
# Read the LOB, convert it to character, and print it
string <- tdr.LobRead(inlob$contextID, inlob$LOBlen);
print(rawToChar(string$buffer));
# Close the LOB
tdr.LobClose(inlob$contextID);