Nocopy and Webutil_c_api

Hi,
First of all, sorry for my bad english.
I would like to know how to use 'nocopy' with webutil_c_api
Because, I have a function in a dll like this:
function_name( var1 by reference )
The problems is the 'var 1'.
How can i solve this problem ?

up

Similar Messages

  • PASSING A VARRAY as parameter in a procedure and returning the same VARRAY

    Hi,
    I am passing a varray as IN parameter to a procedure. I want to retreive the same VARRAY from the procedure.
    DECLARE
       TYPE str_array IS VARRAY (4) OF VARCHAR2 (50);
       v_array           str_array;  
       PROCEDURE process_array (
          v_str_array             str_array
       AS
       BEGIN
          FOR i IN v_str_array.FIRST .. v_str_array.LAST
          LOOP
             DBMS_OUTPUT.put_line ('Hello ' || v_str_array (i));
          END LOOP;
       END;
    BEGIN
       v_array    := str_array ('John', 'Paul', 'Ringo', 'George');
       process_array (v_array);
       -- can also pass unbound Str_Array
       --process_array (str_array ('John', 'Paul', 'Ringo', 'George'));
    --   DBMS_OUTPUT.put_line ('Hello ' || v_str_out_array (i));
    END;I want to change this procedure so that i will retreive the same as VARRAY out from the procedure.
    Can anyone help me on the same

       PROCEDURE process_array (
          v_str_array             IN OUT str_array
       )If your varray is large then you can try:
       PROCEDURE process_array (
          v_str_array             IN OUT NOCOPY str_array
       )but you should learn about possible side-effects if there is an error while executing the procedure. In short words: if you don't use NOCOPY and an error occurs during execution of process_array procedure then your varray is not changed - all chages to the value of your varray are 'rolled back'. If you use NOCOPY then it depends...

  • Label printing (repeat X times for certain label depends on the input file)

    I want to print the label.. and source file is something like..
    Item Name No.of Copies to be printed
    Item 1 5
    Item 2 3
    Item 3 2
    when it convert to the dat file.. i think maybe is something like
    ^field ItemName
    Item 1
    ^field NoCopy
    5
    ^field ItemName
    Item 2
    ^field NoCopy
    3
    ^field ItemName
    Item 3
    ^field NoCopy
    2
    Is there anyway for me to detect the NoCopy and then print the label according to the NoCopy??
    In this example, i want to print 5 sheets for Item 1, 3 sheets for Item 2, and 2 sheets for Item 3.
    Hope to hear from you guys asap!!
    Thank you!
    Thank you!!

    On the subject of printing labels I would have to admit that I never really had much luck with my label printer. I spent all my time messing around with the printer and it still never printed any decent looking labels. In the end I decided to give up on the whole DIY approach and I found a british labels company to do my
    label printing for me, they saved me so much hassle.

  • WebUtil_c_api and Windows

    Is it possible to show a window in the client machine using webutil_c_api? I need to show a window with a list of certificates and I´m not sure if it is possible.

    It's possible to do pretty much anything, but the chances are you'll have to write some C code for the client to use to display the window you need.

  • Can give me examples and explantions on Using COPY and NOCOPY in pl-sql

    Can give me examples and explantions on Using COPY and NOCOPY in pl-sql

    If you use COPY then parameter is copied into procedure/function internal
    spae, so You can't modify parameter.
    If you use NOCOPY then parameter is not copied into procedure/function
    internal spae, so You can modify parameter.NOCOPY modifier serves the same purpose as "copy by value" and "copy by reference" concept (like in C++).
    Then you NOCOPY parameter you pass it's pointer in memory but not pass it's value into the stack.
    You can modify the value of this parameter in both cases. The essential difference is for NOCOPY not only the pointer copies much faster then the object itself but the semantic of exception processing is voilated because when the exception raises Oracle can't restore the initial state of parameter (because all changes where made using the memory pointer but not usual stack copie of parameter):
    SQL> create or replace package my_pkg
      2  is
      3   type t is table of number index by binary_integer;
      4   t1 t;
      5   procedure no_copy (a in out nocopy t);
      6   procedure with_copy(a in out t);
      7  end;
      8  /
    Package created.
    SQL> create or replace package body my_pkg
      2  is
      3 
      4   my_exc exception;
      5 
      6   procedure no_copy (a in out nocopy t)
      7   is
      8   begin
      9    for j in 1..10 loop
    10     a(j) := 1;
    11    end loop;
    12    raise my_exc;
    13   end;
    14 
    15   procedure with_copy (a in out t)
    16   is
    17   begin
    18    for j in 1..10 loop
    19     a(j) := 1;
    20    end loop;
    21    raise my_exc;
    22   end;
    23  
    24  end;
    25  /
    Package body created.
    SQL> declare
      2    t1 my_pkg.t;
      3  begin
      4    dbms_output.put_line('Count before ' || t1.count);
      5    begin
      6      my_pkg.no_copy(t1);
      7    exception
      8      when others then
      9        null;
    10    end;
    11    dbms_output.put_line('Count after ' || t1.count);
    12  end;
    13  /
    Count before 0
    Count after 10
    PL/SQL procedure successfully completed.
    SQL> declare
      2    t1 my_pkg.t;
      3  begin
      4    dbms_output.put_line('Count before ' || t1.count);
      5    begin
      6      my_pkg.with_copy(t1);
      7    exception
      8      when others then
      9        null;
    10    end;
    11    dbms_output.put_line('Count after ' || t1.count);
    12  end;
    13  /
    Count before 0
    Count after 0
    PL/SQL procedure successfully completed.Rgds.

  • WebUtil_c_Api problem

    I´m trying to execute the following C function:
    extern "C" __declspec( dllexport ) int add(int* value1, int* value2);
    So I have make the folling package:
    PACKAGE BODY calculator IS
         add_func webutil_c_api.FunctionHandle;
         add_func_parameters webutil_c_api.ParameterList;
         add_param1 webutil_c_api.ParameterHandle;
         add_param2 webutil_c_api.ParameterHandle;
         add_return PLS_INTEGER;     
         FUNCTION i_dll_add(add_func IN webutil_c_api.FunctionHandle, value1 IN OUT NOCOPY PLS_INTEGER,
                   value2 IN OUT NOCOPY PLS_INTEGER)
                   RETURN PLS_INTEGER;
         PRAGMA INTERFACE (c, i_dll_add, 11265);
         FUNCTION dll_add (value1 IN OUT NOCOPY PLS_INTEGER, value2 IN OUT NOCOPY PLS_INTEGER)
              RETURN PLS_INTEGER IS
              BEGIN
                   RETURN i_dll_add(add_func, value1, value2);
    END dll_add;
              add_func := webutil_c_api.register_function('Calculator_ws.dll', 'add');
              add_func_parameters := webutil_c_api.create_parameter_list;           
              add_param1 := webutil_c_api.add_parameter(add_func_parameters, webutil_c_api.C_INT_PTR, webutil_c_api.PARAM_INOUT, 0);
              add_param2 := webutil_c_api.add_parameter(add_func_parameters, webutil_c_api.C_INT_PTR, webutil_c_api.PARAM_INOUT, 1);
              add_return := webutil_c_api.Invoke_Int('Calculator_ws.dll', 'add', add_func_parameters);           
              webutil_c_api.Destroy_Parameter_List(add_func_parameters);
              webutil_c_api.Deregister_Function(add_func);           
    END calculator;
    But when I execute the FUNCTION it doesn't work. Does anyone which could be the problem?
    Thank you.

    Look again at your code - It seems to me this has been converted from some ORA_FFI code am I correct??
    If you are calling the dll_add function then this is in turn calling i_dll_add, and that is calling to a DLL loaded on the server side (that's the pragma interface bit) and not touching WebUtil or the client side at all.
    So rip out the i_dll_add spec and body and move all the webutil code calls into dll_add where they will actually be called.

  • Convert ORA_FFI to WEBUTIL_C_API to print locally

    I am trying to figure out how to convert this package to WEBUTIL_C_API to be able to print to a users local printer (EPSON slip printer)... ANY help would be appreciated...
    PACKAGE EPSON_SLIP_PRINTER_INTERFACE IS
    * This package provides functions to interact with the EPSON
    * TM-U295 slip printers.
    * The OPEN_PRINTER function must be called to obtain a printer ID.
    * This printer ID can then be used when calling other functions
    * that require a printer to be specified.
    * NOTE that the printer ID is only valid within the same thread
    * that called the OPEN_PRINTER function.
    * Brendan Rickey 2004-JAN-09
    -- AVAILABLE PRINTERS
    CHEQUE_PRINTER     VARCHAR2(50) := 'Generic / Text Only droite';
    INVOICE_PRINTER     VARCHAR2(50) := 'Generic / Text Only left';
    -- ERROR CODES
    -- Some of the provided functions return a NUMBER value that may hold
    -- an error code (negative number).
    -- These are the possible error codes:
    SUCCESS                    NUMBER := 0;     --no error
    ERR_TYPE               NUMBER := -10;     --parameter type error
    ERR_OPENED               NUMBER := -20; --printer already opened
    ERR_NO_PRINTER     NUMBER := -30;     --the printer driver does not exist
    ERR_NO_TARGET          NUMBER := -40;     --no printer found (could of off, faulty, unsupported)
    ERR_NO_MEMORY          NUMBER := -50;     --insufficient memory
    ERR_HANDLE               NUMBER := -60;     --invalid printer ID
    ERR_TIMEOUT               NUMBER := -70;     --time out error
    ERR_ACCESS               NUMBER := -80;     --cannot read/write to printer (printing in progress)
    ERR_PARAM               NUMBER := -90;     --parameter error
    ERR_OFFLINE               NUMBER := -110;     --printer was opened in offline state.  Status must be changed to online.
    ERR_NOT_EPSON          NUMBER := -120;     --printer is not an EPSON printer
    * INITIALIZE
    * Initializes the interface between Forms and the EPSON library (call before any other function in the package).
    * Returns:
    * TRUE if the library is registered successfully,
    * FALSE otherwise (library not found etc...)
    function INITIALIZE return BOOLEAN;
    * OPEN_PRINTER
    * Obtains a handle on the specified EPSON slip printer (either CHEQUE_PRINTER or INVOICE_PRINTER).
    * Returns:
    *           a printer ID for the specified printer (greater than 0)
    *           an error code on failure (less than 0):
    * ERR_TYPE, ERR_OPENED, ERR_NO_PRINTER, ERR_NO_TARGET, ERR_NO_MEMORY, ERR_PARAM
    function OPEN_PRINTER (p_printer_name IN VARCHAR2) return NUMBER;
    * CLOSE_PRINTER
    * Releases the handle on the specified printer.
    * Returns:
    *           0 on success
    *           ERR_HANDLE on failure
    function CLOSE_PRINTER (p_printer_id IN NUMBER) return NUMBER;
    * IS_PAPER_OUT
    * Tests if there is no paper in the printer.
    * Returns:
    *           1 if there is no paper in the printer, 0 if paper is in the printer
    *           ERR_HANDLE or ERR_PARAM on failure.
    function IS_PAPER_OUT (p_printer_id IN NUMBER) return NUMBER;
    * PRINT_TEXT
    * Prints the specified text to the specified printer.
    * Returns:
    *           0 on success
    *           ERR_HANDLE, ERR_ACCESS, ERR_OFFLINE, ERR_NOT_EPSON, or ERR_PARAM on failure.
    function PRINT_TEXT (p_printer_id IN NUMBER, p_text IN VARCHAR2) return NUMBER;
    * RELEASE_PAPER
    * Performs the Release function on the specified printer.
    * Returns:
    *           0 on success
    *           ERR_HANDLE, ERR_ACCESS, ERR_OFFLINE, ERR_NOT_EPSON, or ERR_PARAM on failure.
    function RELEASE_PAPER (p_printer_id IN NUMBER) return NUMBER;
    /* PRIVATE FUNCTIONS
    function BiOpenMonPrinter(arg0 in PLS_INTEGER,
    arg1 in out VARCHAR2)
    return PLS_INTEGER;
    function BiCloseMonPrinter(arg0 in PLS_INTEGER)
    return PLS_INTEGER;
    function BiGetStatus(arg0 in PLS_INTEGER,
    arg1 in out PLS_INTEGER)
    return PLS_INTEGER;
    function BiDirectIO(arg0 in PLS_INTEGER,
    arg1 in PLS_INTEGER,
    arg2 in out VARCHAR2,
    arg3 in out PLS_INTEGER,
    arg4 in out VARCHAR2,
    arg5 in PLS_INTEGER,
    arg6 in PLS_INTEGER)
    return PLS_INTEGER;
    function BiDirectIOEx(arg0 in PLS_INTEGER,
    arg1 in PLS_INTEGER,
    arg2 in out VARCHAR2,
    arg3 in out PLS_INTEGER,
    arg4 in out VARCHAR2,
    arg5 in PLS_INTEGER,
    arg6 in PLS_INTEGER,
    arg7 in PLS_INTEGER)
    return PLS_INTEGER;
    END;
    PACKAGE BODY EPSON_SLIP_PRINTER_INTERFACE IS
    v_msg_b VARCHAR2(20);
    v_EPSON_LIBRARY_OK BOOLEAN:= FALSE;
    --ORA_FFI function handles and library handle
    lh_EpsStmApi ora_ffi.libHandleType;                    --DLL library handle
    fh_BiOpenMonPrinter ora_ffi.funcHandleType;          --DLL function handle
    fh_BiCloseMonPrinter ora_ffi.funcHandleType;     --DLL function handle
    fh_BiGetStatus ora_ffi.funcHandleType;               --DLL function handle
    fh_BiDirectIO ora_ffi.funcHandleType;               --DLL function handle
    fh_BiDirectIOEx ora_ffi.funcHandleType;               --DLL function handle
    --constant
    ASB_SLIP_BOF     PLS_INTEGER := 4*power(16,5);     --BOF printer status flag 0x00400000
    c_release_code      CHAR(2) := CHR(27)||CHR(113);     --ESC+q, to release the paper
    -------PRIVATE FUNCTIONS--------
    * Brendan Rickey 2004-JAN-09
    * The following are functions that are required to interface with the
    * EPSON StatusAPI DLL (C library) though ORA_FFI.
    * The following describes the DLL functions that are made available
    * through this ORA_FFI implementation:
    Function Purpose
    BiOpenMonPrinter Get a handle on a printer.
    Parameters
    p_Type --int: 1 if p_Name is a port, 2 if a printer name.
    ,p_Name --varchar2: the port of printer name to open.
    Return printer identifier number (>0) on success, < 0 on failure.
    BiCloseMonPrinter Close the monitor on the printer.
    Parameters
    p_Handle --int: The numerical printer handle returned from BiOpenMonPrinter.
    Return 0 on success, < 0 on failure.
    BiGetStatus Returns the status of the printer.
    Parameters     
    p_Handle --int: The numerical printer handle returned from BiOpenMonPrinter.
    ,p_Status OUT --long: The status of the printer (use AND bitwise operator to test for statuses).
    Return 0 on success, < 0 on failure.
    BiDirectIO Sends data to and Reads data from the printer. Use BiDirectIOEx if more that 255 chars are to be written/read.
    Parameters
    p_Handle --int: The numerical printer handle returned from BiOpenMonPrinter.
    ,p_WriteLen --short: The length of the command/data being sent to the printer (max 255).
    ,p_WriteCmd --varchar2: The command/data to send to the printer.
    ,p_ReadLen --short: The length of the data to be read from the printer (max 255)
    (Use 0 if no data is to be read).
    ,p_ReadBuff OUT --varchar2: The buffer where the the data read from the printer is stored.
    ,p_Timeout --long: write/read time out in msecs.
    ,p_NullTerminate --short: 0 => reading of data from printer is performed until time out or length of p_ReadLen is reached.
    1 => reading is finished at thepoint when a NULL is received from the printer. ReadLen must have a value.
    Return 0 on success, < 0 on failure.
    BiDirectIOEx Sends data to and Reads data from the printer (handles larger quantities of write/read data).
    Parameters
    p_Handle --int: The numerical printer handle returned from BiOpenMonPrinter.
    ,p_WriteLen --long: The length of the command/data being sent to the printer.
    ,p_WriteCmd --varchar2: The command/data to send to the printer.
    ,p_ReadLen --long: The length of the data to be read from the printer (Use 0 if no data is to be read).
    ,p_ReadBuff OUT --varchar2: The buffer where the the data read from the printer is stored.
    ,p_Timeout --long: write/read time out in msecs.
    ,p_NullTerminate --short: 0 => reading of data from printer is performed until time out or length of p_ReadLen is reached.
    1 => reading is finished at thepoint when a NULL is received from the printer. ReadLen must have a value.
    ,p_Option --short: 0 => prevents Automatic Status Back (ASB) during execution of this function (as does BiDirectIO).
    1 => does not disable Automatic Status Back (ASB).
    Return 0 on success, < 0 on failure.
    function icd_BiOpenMonPrinter(funcHandle in ora_ffi.funcHandleType, arg0 in PLS_INTEGER,
    arg1 in out VARCHAR2)
    return PLS_INTEGER;
    pragma interface(c, icd_BiOpenMonPrinter, 11265);
    function BiOpenMonPrinter(arg0 in PLS_INTEGER,
    arg1 in out VARCHAR2)
    return PLS_INTEGER is
    begin
    return(icd_BiOpenMonPrinter(fh_BiOpenMonPrinter,
    arg0,
    arg1));
    end;
    function icd_BiCloseMonPrinter(funcHandle in ora_ffi.funcHandleType, arg0 in PLS_INTEGER)
    return PLS_INTEGER;
    pragma interface(c, icd_BiCloseMonPrinter, 11265);
    function BiCloseMonPrinter(arg0 in PLS_INTEGER)
    return PLS_INTEGER is
    begin
    return(icd_BiCloseMonPrinter(fh_BiCloseMonPrinter,
    arg0));
    end;
    function icd_BiGetStatus(funcHandle in ora_ffi.funcHandleType, arg0 in PLS_INTEGER,
    arg1 in out PLS_INTEGER)
    return PLS_INTEGER;
    pragma interface(c, icd_BiGetStatus, 11265);
    function BiGetStatus(arg0 in PLS_INTEGER,
    arg1 in out PLS_INTEGER)
    return PLS_INTEGER is
    begin
    return(icd_BiGetStatus(fh_BiGetStatus,
    arg0,
    arg1));
    end;
    function icd_BiDirectIO(funcHandle in ora_ffi.funcHandleType, arg0 in PLS_INTEGER,
    arg1 in PLS_INTEGER,
    arg2 in out VARCHAR2,
    arg3 in out PLS_INTEGER,
    arg4 in out VARCHAR2,
    arg5 in PLS_INTEGER,
    arg6 in PLS_INTEGER)
    return PLS_INTEGER;
    pragma interface(c, icd_BiDirectIO, 11265);
    function BiDirectIO(arg0 in PLS_INTEGER,
    arg1 in PLS_INTEGER,
    arg2 in out VARCHAR2,
    arg3 in out PLS_INTEGER,
    arg4 in out VARCHAR2,
    arg5 in PLS_INTEGER,
    arg6 in PLS_INTEGER)
    return PLS_INTEGER is
    begin
    return(icd_BiDirectIO(fh_BiDirectIO,
    arg0,
    arg1,
    arg2,
    arg3,
    arg4,
    arg5,
    arg6));
    end;
    function icd_BiDirectIOEx(funcHandle in ora_ffi.funcHandleType, arg0 in PLS_INTEGER,
    arg1 in PLS_INTEGER,
    arg2 in out VARCHAR2,
    arg3 in out PLS_INTEGER,
    arg4 in out VARCHAR2,
    arg5 in PLS_INTEGER,
    arg6 in PLS_INTEGER,
    arg7 in PLS_INTEGER)
    return PLS_INTEGER;
    pragma interface(c, icd_BiDirectIOEx, 11265);
    function BiDirectIOEx(arg0 in PLS_INTEGER,
    arg1 in PLS_INTEGER,
    arg2 in out VARCHAR2,
    arg3 in out PLS_INTEGER,
    arg4 in out VARCHAR2,
    arg5 in PLS_INTEGER,
    arg6 in PLS_INTEGER,
    arg7 in PLS_INTEGER)
    return PLS_INTEGER is
    begin
    return(icd_BiDirectIOEx(fh_BiDirectIOEx,
    arg0,
    arg1,
    arg2,
    arg3,
    arg4,
    arg5,
    arg6,
    arg7));
    end;
    --------PUBLIC FUNCTIONS--------
    function INITIALIZE return BOOLEAN IS
    BEGIN
    --When this is the first package function called, code in the package's
    --body is executed and sets v_EPSON_LIBRARY_OK.
    RETURN v_EPSON_LIBRARY_OK;
    END;
    function OPEN_PRINTER (p_printer_name IN VARCHAR2) return NUMBER IS
         v_printer                    PLS_INTEGER;
         v_printer_name     VARCHAR2(50) := p_printer_name;
         v_name_type           PLS_INTEGER := 2; --use printer Name to specify printer     
    BEGIN
         /* Open a monitor for the printer */
         v_printer := BiOpenMonPrinter(v_name_type,v_printer_name);
         RETURN v_printer;
    END;
    function CLOSE_PRINTER (p_printer_id IN NUMBER) return NUMBER IS
    v_return PLS_INTEGER;
    BEGIN
    /* CLOSE the printer monitor */
         v_return := BiCloseMonPrinter(p_printer_id);
         RETURN v_return;
    END;
    function IS_PAPER_OUT (p_printer_id IN NUMBER) return NUMBER IS
         v_return          PLS_INTEGER;
         v_status          PLS_INTEGER := -123456;
    BEGIN
         /* Test if paper is in the printer by first getting the status (a binary integer) */
         v_return := BiGetStatus(p_printer_id,v_status);
         IF v_return <> 0 THEN
              RETURN v_return;
         ELSE
         --Test for BOF status flag
         IF WIN_API_BITOP.BITWISE_AND(v_status,ASB_SLIP_BOF) = ASB_SLIP_BOF THEN
              RETURN 1; --paper out
         ELSE
              RETURN 0; --paper in
         END IF;
         END IF;
    END;
    function PRINT_TEXT (p_printer_id IN NUMBER, p_text IN VARCHAR2) return NUMBER IS
    v_return          PLS_INTEGER;
    v_text               VARCHAR2(2000) := p_text;
    v_text_len          PLS_INTEGER;                    --number of characters to be printed
    v_read_len      PLS_INTEGER := 0;               --number of characters to be read from the printer
    v_read_buff      VARCHAR2(255) := NULL;          --not used: holds characters read from the printer
    v_timeout      PLS_INTEGER := 1000;          --not used: amount of time to wait for response (msecs)
         v_nullTerm          PLS_INTEGER := 0;               --not used: 0 means read until reached v_read_len or v_timeout
         -- 1 means read until NULL received from printer
         v_option          PLS_INTEGER := 0;           --0 means do not answer other requests while printing
                                                                --1 means do not stop answering other requests while printing
    BEGIN
         --Get the number of chars to be printed and then print.
         v_text_len := length(p_text);
         v_return := BiDirectIOEx(p_printer_id,
         v_text_len,
         v_text,
         v_read_len,
         v_read_buff,
         v_timeout,
         v_nullTerm,
         v_option);
         --Ignore timeout(-70) errors, otherwise return error
         IF v_return = -70 THEN
              v_return := 0;     
         END IF;
         RETURN v_return;
    END;
    function RELEASE_PAPER (p_printer_id IN NUMBER) return NUMBER IS
    BEGIN
    /* Release the paper by sending the release escape code to the printer */
         RETURN PRINT_TEXT(p_printer_id, c_release_code);
    END;
    -----END OF FUNCTION IMPLEMENTATIONS-----
    BEGIN
    * Load the EPSON printer driver's StatusAPI library.
    * Create an ORA_FFI interface to the library by doing the following for each desired function:
    *          1- Create a handle on the function,
    *          2- Register the return value,
    *          3- Register the arguments/parameters in the correct order.
    lh_EpsStmApi := ora_ffi.load_library('', 'EpsStmApi.DLL');
    IF Ora_Ffi.Is_Null_Ptr(lh_EpsStmApi) THEN
         AFC_MESSAGES('I','MAIN-0020','E',v_msg_b);
         v_EPSON_LIBRARY_OK := FALSE;
    ELSE
    fh_BiOpenMonPrinter := ora_ffi.register_function(lh_EpsStmApi, 'BiOpenMonPrinter', ora_ffi.c_std);
    ora_ffi.register_return(fh_BiOpenMonPrinter, ora_ffi.c_int, ora_ffi.pls_pls_integer);
    ora_ffi.register_parameter(fh_BiOpenMonPrinter, ora_ffi.c_int, ora_ffi.pls_pls_integer);
    ora_ffi.register_parameter(fh_BiOpenMonPrinter, ora_ffi.c_char_ptr, ora_ffi.pls_varchar2);
    fh_BiCloseMonPrinter := ora_ffi.register_function(lh_EpsStmApi, 'BiCloseMonPrinter', ora_ffi.c_std);
    ora_ffi.register_return(fh_BiCloseMonPrinter, ora_ffi.c_int, ora_ffi.pls_pls_integer);
    ora_ffi.register_parameter(fh_BiCloseMonPrinter, ora_ffi.c_int, ora_ffi.pls_pls_integer);
    fh_BiGetStatus := ora_ffi.register_function(lh_EpsStmApi, 'BiGetStatus', ora_ffi.c_std);
    ora_ffi.register_return(fh_BiGetStatus, ora_ffi.c_int, ora_ffi.pls_pls_integer);
    ora_ffi.register_parameter(fh_BiGetStatus, ora_ffi.c_int, ora_ffi.pls_pls_integer);
    ora_ffi.register_parameter(fh_BiGetStatus, ora_ffi.c_long_ptr, ora_ffi.pls_pls_integer);
    fh_BiDirectIO := ora_ffi.register_function(lh_EpsStmApi, 'BiDirectIO', ora_ffi.c_std);
    ora_ffi.register_return(fh_BiDirectIO, ora_ffi.c_int, ora_ffi.pls_pls_integer);
    ora_ffi.register_parameter(fh_BiDirectIO, ora_ffi.c_int, ora_ffi.pls_pls_integer);
    ora_ffi.register_parameter(fh_BiDirectIO, ora_ffi.c_short, ora_ffi.pls_pls_integer);
    ora_ffi.register_parameter(fh_BiDirectIO, ora_ffi.c_char_ptr, ora_ffi.pls_varchar2);
    ora_ffi.register_parameter(fh_BiDirectIO, ora_ffi.c_short_ptr, ora_ffi.pls_pls_integer);
    ora_ffi.register_parameter(fh_BiDirectIO, ora_ffi.c_char_ptr, ora_ffi.pls_varchar2);
    ora_ffi.register_parameter(fh_BiDirectIO, ora_ffi.c_long, ora_ffi.pls_pls_integer);
    ora_ffi.register_parameter(fh_BiDirectIO, ora_ffi.c_short, ora_ffi.pls_pls_integer);
    fh_BiDirectIOEx := ora_ffi.register_function(lh_EpsStmApi, 'BiDirectIOEx', ora_ffi.c_std);
    ora_ffi.register_return(fh_BiDirectIOEx, ora_ffi.c_int, ora_ffi.pls_pls_integer);
    ora_ffi.register_parameter(fh_BiDirectIOEx, ora_ffi.c_int, ora_ffi.pls_pls_integer);
    ora_ffi.register_parameter(fh_BiDirectIOEx, ora_ffi.c_long, ora_ffi.pls_pls_integer);
    ora_ffi.register_parameter(fh_BiDirectIOEx, ora_ffi.c_char_ptr, ora_ffi.pls_varchar2);
    ora_ffi.register_parameter(fh_BiDirectIOEx, ora_ffi.c_long_ptr, ora_ffi.pls_pls_integer);
    ora_ffi.register_parameter(fh_BiDirectIOEx, ora_ffi.c_char_ptr, ora_ffi.pls_varchar2);
    ora_ffi.register_parameter(fh_BiDirectIOEx, ora_ffi.c_long, ora_ffi.pls_pls_integer);
    ora_ffi.register_parameter(fh_BiDirectIOEx, ora_ffi.c_short, ora_ffi.pls_pls_integer);
    ora_ffi.register_parameter(fh_BiDirectIOEx, ora_ffi.c_short, ora_ffi.pls_pls_integer);
    v_EPSON_LIBRARY_OK := TRUE;
    END IF;
    EXCEPTION
         WHEN OTHERS THEN
              AFC_MESSAGES('I','MAIN-0021','E',v_msg_b);
              v_EPSON_LIBRARY_OK := FALSE;
    END;

    Hi Duncan,
    Thanks for the response. Beyond the problem you pointed out I found that the "open server" command is requiring a window handle parameter, even though it isn't used by the program. I talked with Oracle Support and it turns out that even if the window handle isn't used, it's existence makes it not work with the current version of webutil.
    The program I am working with also has a COM interface, so I decided to back up and redo the interface using webutil OLE2. I've got it working now, just a little more polishing to do.
    Thanks again for the help.
    Mark

  • Coping iso file and monting problem

    Hi
    I am using Windows 8.1 Update Enterprise 64 bit and Windows ADK.
    I noticed that, if I select the "Environment of the deployment tools and creations images" and I click on the "Run as Administrator" item of his Pop-Up menu and I mount on a iso image of windows 8.1 Update, when I run the command
    robocopy <Drive_Letter>:\"<Windows_Files_Path>" /e
    to copy all its files in a directory and the command
    dism /Mount-Image /ImageFile:"<Windows_Files_Path>"\install.wim /Index:<Image_Index> /MountDir:"<Mount_Directory_Path>"
    to mount an image volume, this error appears:
    Error: 0xc1510111
    Not have permission to mount and modify this image.
    However, if I copy these files through the "file explorer" window, the mounting of this volume image is working properly. How come?
    Thanks
    Bye
    Balubeto

    Hi,
    Unlike normal copy commands, Robocopy is designed for reliable copy or mirroring while maintaining the permissions, attributes, owner information, timestamps and properties of the objects copied. In opinion, that's why you encounter this problem.
    To fix this problem, can try to add /nocopy parameter for test.
    Note:Copies no file information (useful with /purge).
    You can refer to the link below for more details with Robocopy:
    http://technet.microsoft.com/en-us/library/cc733145(WS.10).aspx
    Roger Lu
    TechNet Community Support

  • What's the best way to create and free temporaries for CLOB parameters?

    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production on Solaris
    I have a procedure calling another procedure with one of the parameters being an IN OUT NOCOPY CLOB.
    I create the temporary CLOB in proc_A, do the call to proc_B and then free the temporary again.
    In proc_B I create a REFCURSOR, and use that with dbms_xmlgen to create XML.
    So the code basically looks like
    CREATE OR REPLACE PROCEDURE client_xml( p_client_id IN            NUMBER
                                           ,p_clob      IN OUT NOCOPY CLOB   ) AS
       v_rc         SYS_REFCURSOR;
       v_queryCtx   dbms_xmlquery.ctxType;
    BEGIN
       OPEN c_rc FOR
          SELECT col1
                ,col2
                ,col3
            FROM clients
           WHERE client_id = p_client_id;
       v_queryCtx := dbms_xmlgen.newContext(v_rc);
       p_clob     := dbms_xmlgen.getXML(v_queryCtx, 0);
    END;
    CREATE OR REPLACE PROCEDURE my_proc AS
       v_clob       CLOB;
       v_client_id  NUMBER;
    BEGIN
       v_client_id := 123456;
       dbms_lob.createTemporary(v_clob, TRUE, dbms_lob.CALL);
       client_xml( p_client_id => v_client_id
                  ,p_clob      => v_clob);
       dbms_lob.freeTemporary(v_clob);
    END;However, I just learned the hard way that IN OUT NOCOPY is only a hint, and that Oracle sometimes creates a local variable for the CLOB anyway.
    A solution is to change the client_xml procedure above to
    CREATE OR REPLACE PROCEDURE client_xml( p_client_id IN            NUMBER
                                           ,p_clob      IN OUT NOCOPY CLOB   ) AS
       v_rc         SYS_REFCURSOR;
       v_queryCtx   dbms_xmlquery.ctxType;
    BEGIN
       IF NOT NVL(dbms_lob.istemporary(p_clob),0) = 1 THEN
          dbms_lob.createTemporary(p_clob, TRUE, dbms_lob.CALL);
       END IF;
       OPEN c_rc FOR
          SELECT col1
                ,col2
                ,col3
            FROM clients
           WHERE client_id = p_client_id;
       v_queryCtx := dbms_xmlgen.newContext(p_refcursor);
       p_clob     := dbms_xmlgen.getXML(v_queryCtx, 0);
    END;My concern is that in case Oracle does create a local variable, 2 temporaries will be created, but there will only be 1 freeTemporary.
    Could this lead to a memory leak?
    Or should I be safe with the solution above because I'm using dbms_lob.CALL?
    Thanks,
    Arnold
    Edited by: Arnold vK on Jan 24, 2012 11:52 AM

    Arnold vK wrote:
    However, I just learned the hard way that IN OUT NOCOPY is only a hint, and that Oracle sometimes creates a local variable for the CLOB anyway.A CLOB variable in called a locator. Just another term for a pointer.
    A CLOB does not exist in local stack space. The variable itself can be TBs in size (max CLOB size is 128TB depending on DB config) - and impossible to create and maintain in the stack. Thus it does not exist in the stack - and is why the PL/SQL CLOB variable is called a locator as it only contains the pointer/address of the CLOB.
    The CLOB itself exists in the database's temporary tablespace - and temporary LOB resource footprint in the database can be viewed via the v$temporary_lobs virtual performance view.
    Passing a CLOB pointer by reference (pointer to a pointer) does not make any sense (as would be the case if the NOCOPY clause was honoured by PL/SQL for a CLOB parameter). It is passed by value instead.
    So when you call a procedure and pass it a CLOB locator, that procedure will be dereferencing that pointer (via DBMS_LOB for example) in order to access its contents.
    Quote from Oracle® Database SecureFiles and Large Objects Developer's Guide
    >
    A LOB instance has a locator and a value. The LOB locator is a reference to where the LOB value is physically stored. The LOB value is the data stored in the LOB.
    When you use a LOB in an operation such as passing a LOB as a parameter, you are actually passing a LOB locator. For the most part, you can work with a LOB instance in your application without being concerned with the semantics of LOB locators. There is no requirement to dereference LOB locators, as is required with pointers in some programming languages.
    >
    The thing to guard against is not freeing CLOBs - the age old issue of not freeing pointers and releasing malloc'ed memory when done. In PL/SQL, there is fairly tight resource protection with the PL/SQL engine automatically releasing local resources when those go out of scope. But a CLOB (like a ref cursor) is not really a local resource. And as in most other programming language, the explicit release/freeing of such a resource is recommended.

  • Creating a single context index on a one-to-many and lookup table

    Hello,
    I've been successfully setting up text indexes on multiple columns on the same table (using MULTI_COLUMN_DATASTORE preferences), but now I have a situation with a one-to-many data collection table (with a FK to a lookup table), and I need to search columns across both of these tables. Sample code below, more of my chattering after the code block:
    CREATE TABLE SUBMISSION
    ( SUBMISSION_ID             NUMBER(10)          NOT NULL,
      SUBMISSION_NAME           VARCHAR2(100)       NOT NULL
    CREATE TABLE ADVISOR_TYPE
    ( ADVISOR_TYPE_ID           NUMBER(10)          NOT NULL,
      ADVISOR_TYPE_NAME         VARCHAR2(50)        NOT NULL
    CREATE TABLE SUBMISSION_ADVISORS
    ( SUBMISSION_ADVISORS_ID    NUMBER(10)          NOT NULL,
      SUBMISSION_ID             NUMBER(10)          NOT NULL,
      ADVISOR_TYPE_ID           NUMBER(10)          NOT NULL,
      FIRST_NAME                VARCHAR(50)         NULL,
      LAST_NAME                 VARCHAR(50)         NULL,
      SUFFIX                    VARCHAR(20)         NULL
    INSERT INTO SUBMISSION (SUBMISSION_ID, SUBMISSION_NAME) VALUES (1, 'Some Research Paper');
    INSERT INTO SUBMISSION (SUBMISSION_ID, SUBMISSION_NAME) VALUES (2, 'Thesis on 17th Century Weather Patterns');
    INSERT INTO SUBMISSION (SUBMISSION_ID, SUBMISSION_NAME) VALUES (3, 'Statistical Analysis on Sunny Days in March');
    INSERT INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME) VALUES (1, 'Department Chair');
    INSERT INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME) VALUES (2, 'Department Co-Chair');
    INSERT INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME) VALUES (3, 'Professor');
    INSERT INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME) VALUES (4, 'Associate Professor');
    INSERT INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME) VALUES (5, 'Scientist');
    INSERT INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX) VALUES (1,1,2,'John', 'Doe', 'PhD');
    INSERT INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX) VALUES (2,1,2,'Jane', 'Doe', 'PhD');
    INSERT INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX) VALUES (3,2,3,'Johan', 'Smith', NULL);
    INSERT INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX) VALUES (4,2,4,'Magnus', 'Jackson', 'MS');
    INSERT INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX) VALUES (5,3,5,'Williard', 'Forsberg', 'AMS');
    COMMIT;I want to be able to create a text index to lump these fields together:
    SUBMISSION_ADVISORS.FIRST_NAME
    SUBMISSION_ADVISORS.LAST_NAME
    SUBMISSION_ADVISORS.SUFFIX
    ADVISOR_TYPE.ADVISOR_TYPE_NAME
    I've looked at DETAIL_DATASTORE and USER_DATASTORE, but the examples in Oracle Docs for DETAIL_DATASTORE leave me a little bit perplexed. It seems like this should be pretty straightforward.
    Ideally, I'm trying to avoid creating new columns, and keeping the trigger adjustments to a minimum. But I'm open to any and all suggestions. Thanks for for your time and thoughts.
    -Jamie

    I would create a procedure that creates a virtual document with tags, which is what the multi_column_datatstore does behind the scenes. Then I would use that procedure in a user_datastore, so the result is the same for multiple tables as what a multi_column_datastore does for one table. I would also use either auto_section_group or some other type of section group, so that you can search using WITHIN as with the multi_column_datastore. Please see the demonstration below.
    SCOTT@orcl_11gR2> -- tables and data that you provided:
    SCOTT@orcl_11gR2> CREATE TABLE SUBMISSION
      2  ( SUBMISSION_ID           NUMBER(10)          NOT NULL,
      3    SUBMISSION_NAME           VARCHAR2(100)          NOT NULL
      4  )
      5  /
    Table created.
    SCOTT@orcl_11gR2> CREATE TABLE ADVISOR_TYPE
      2  ( ADVISOR_TYPE_ID           NUMBER(10)          NOT NULL,
      3    ADVISOR_TYPE_NAME      VARCHAR2(50)          NOT NULL
      4  )
      5  /
    Table created.
    SCOTT@orcl_11gR2> CREATE TABLE SUBMISSION_ADVISORS
      2  ( SUBMISSION_ADVISORS_ID      NUMBER(10)          NOT NULL,
      3    SUBMISSION_ID           NUMBER(10)          NOT NULL,
      4    ADVISOR_TYPE_ID           NUMBER(10)          NOT NULL,
      5    FIRST_NAME           VARCHAR(50)          NULL,
      6    LAST_NAME           VARCHAR(50)          NULL,
      7    SUFFIX                VARCHAR(20)          NULL
      8  )
      9  /
    Table created.
    SCOTT@orcl_11gR2> INSERT ALL
      2  INTO SUBMISSION (SUBMISSION_ID, SUBMISSION_NAME)
      3    VALUES (1, 'Some Research Paper')
      4  INTO SUBMISSION (SUBMISSION_ID, SUBMISSION_NAME)
      5    VALUES (2, 'Thesis on 17th Century Weather Patterns')
      6  INTO SUBMISSION (SUBMISSION_ID, SUBMISSION_NAME)
      7    VALUES (3, 'Statistical Analysis on Sunny Days in March')
      8  SELECT * FROM DUAL
      9  /
    3 rows created.
    SCOTT@orcl_11gR2> INSERT ALL
      2  INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME)
      3    VALUES (1, 'Department Chair')
      4  INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME)
      5    VALUES (2, 'Department Co-Chair')
      6  INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME)
      7    VALUES (3, 'Professor')
      8  INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME)
      9    VALUES (4, 'Associate Professor')
    10  INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME)
    11    VALUES (5, 'Scientist')
    12  SELECT * FROM DUAL
    13  /
    5 rows created.
    SCOTT@orcl_11gR2> INSERT ALL
      2  INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX)
      3    VALUES (1,1,2,'John', 'Doe', 'PhD')
      4  INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX)
      5    VALUES (2,1,2,'Jane', 'Doe', 'PhD')
      6  INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX)
      7    VALUES (3,2,3,'Johan', 'Smith', NULL)
      8  INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX)
      9    VALUES (4,2,4,'Magnus', 'Jackson', 'MS')
    10  INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX)
    11    VALUES (5,3,5,'Williard', 'Forsberg', 'AMS')
    12  SELECT * FROM DUAL
    13  /
    5 rows created.
    SCOTT@orcl_11gR2> -- constraints presumed based on your description:
    SCOTT@orcl_11gR2> ALTER TABLE submission ADD CONSTRAINT submission_id_pk
      2    PRIMARY KEY (submission_id)
      3  /
    Table altered.
    SCOTT@orcl_11gR2> ALTER TABLE advisor_type ADD CONSTRAINT advisor_type_id_pk
      2    PRIMARY KEY (advisor_type_id)
      3  /
    Table altered.
    SCOTT@orcl_11gR2> ALTER TABLE submission_advisors ADD CONSTRAINT submission_advisors_id_pk
      2    PRIMARY KEY (submission_advisors_id)
      3  /
    Table altered.
    SCOTT@orcl_11gR2> ALTER TABLE submission_advisors ADD CONSTRAINT submission_id_fk
      2    FOREIGN KEY (submission_id) REFERENCES submission (submission_id)
      3  /
    Table altered.
    SCOTT@orcl_11gR2> ALTER TABLE submission_advisors ADD CONSTRAINT advisor_type_id_fk
      2    FOREIGN KEY (advisor_type_id) REFERENCES advisor_type (advisor_type_id)
      3  /
    Table altered.
    SCOTT@orcl_11gR2> -- resulting data:
    SCOTT@orcl_11gR2> COLUMN submission_name FORMAT A45
    SCOTT@orcl_11gR2> COLUMN advisor      FORMAT A40
    SCOTT@orcl_11gR2> SELECT s.submission_name,
      2           a.advisor_type_name || ' ' ||
      3           sa.first_name || ' ' ||
      4           sa.last_name || ' ' ||
      5           sa.suffix AS advisor
      6  FROM   submission_advisors sa,
      7           submission s,
      8           advisor_type a
      9  WHERE  sa.advisor_type_id = a.advisor_type_id
    10  AND    sa.submission_id = s.submission_id
    11  /
    SUBMISSION_NAME                               ADVISOR
    Some Research Paper                           Department Co-Chair John Doe PhD
    Some Research Paper                           Department Co-Chair Jane Doe PhD
    Thesis on 17th Century Weather Patterns       Professor Johan Smith
    Thesis on 17th Century Weather Patterns       Associate Professor Magnus Jackson MS
    Statistical Analysis on Sunny Days in March   Scientist Williard Forsberg AMS
    5 rows selected.
    SCOTT@orcl_11gR2> -- procedure to create virtual documents:
    SCOTT@orcl_11gR2> CREATE OR REPLACE PROCEDURE submission_advisors_proc
      2    (p_rowid IN           ROWID,
      3       p_clob     IN OUT NOCOPY CLOB)
      4  AS
      5  BEGIN
      6    FOR r1 IN
      7        (SELECT *
      8         FROM      submission_advisors
      9         WHERE  ROWID = p_rowid)
    10    LOOP
    11        IF r1.first_name IS NOT NULL THEN
    12          DBMS_LOB.WRITEAPPEND (p_clob, 12, '<first_name>');
    13          DBMS_LOB.WRITEAPPEND (p_clob, LENGTH (r1.first_name), r1.first_name);
    14          DBMS_LOB.WRITEAPPEND (p_clob, 13, '</first_name>');
    15        END IF;
    16        IF r1.last_name IS NOT NULL THEN
    17          DBMS_LOB.WRITEAPPEND (p_clob, 11, '<last_name>');
    18          DBMS_LOB.WRITEAPPEND (p_clob, LENGTH (r1.last_name), r1.last_name);
    19          DBMS_LOB.WRITEAPPEND (p_clob, 12, '</last_name>');
    20        END IF;
    21        IF r1.suffix IS NOT NULL THEN
    22          DBMS_LOB.WRITEAPPEND (p_clob, 8, '<suffix>');
    23          DBMS_LOB.WRITEAPPEND (p_clob, LENGTH (r1.suffix), r1.suffix);
    24          DBMS_LOB.WRITEAPPEND (p_clob, 9, '</suffix>');
    25        END IF;
    26        FOR r2 IN
    27          (SELECT *
    28           FROM   submission
    29           WHERE  submission_id = r1.submission_id)
    30        LOOP
    31          DBMS_LOB.WRITEAPPEND (p_clob, 17, '<submission_name>');
    32          DBMS_LOB.WRITEAPPEND (p_clob, LENGTH (r2.submission_name), r2.submission_name);
    33          DBMS_LOB.WRITEAPPEND (p_clob, 18, '</submission_name>');
    34        END LOOP;
    35        FOR r3 IN
    36          (SELECT *
    37           FROM   advisor_type
    38           WHERE  advisor_type_id = r1.advisor_type_id)
    39        LOOP
    40          DBMS_LOB.WRITEAPPEND (p_clob, 19, '<advisor_type_name>');
    41          DBMS_LOB.WRITEAPPEND (p_clob, LENGTH (r3.advisor_type_name), r3.advisor_type_name);
    42          DBMS_LOB.WRITEAPPEND (p_clob, 20, '</advisor_type_name>');
    43        END LOOP;
    44    END LOOP;
    45  END submission_advisors_proc;
    46  /
    Procedure created.
    SCOTT@orcl_11gR2> SHOW ERRORS
    No errors.
    SCOTT@orcl_11gR2> -- examples of virtual documents that procedure creates:
    SCOTT@orcl_11gR2> DECLARE
      2    v_clob  CLOB := EMPTY_CLOB();
      3  BEGIN
      4    FOR r IN
      5        (SELECT ROWID rid FROM submission_advisors)
      6    LOOP
      7        DBMS_LOB.CREATETEMPORARY (v_clob, TRUE);
      8        submission_advisors_proc (r.rid, v_clob);
      9        DBMS_OUTPUT.PUT_LINE (v_clob);
    10        DBMS_LOB.FREETEMPORARY (v_clob);
    11    END LOOP;
    12  END;
    13  /
    <first_name>John</first_name><last_name>Doe</last_name><suffix>PhD</suffix><submission_name>Some
    Research Paper</submission_name><advisor_type_name>Department Co-Chair</advisor_type_name>
    <first_name>Jane</first_name><last_name>Doe</last_name><suffix>PhD</suffix><submission_name>Some
    Research Paper</submission_name><advisor_type_name>Department Co-Chair</advisor_type_name>
    <first_name>Johan</first_name><last_name>Smith</last_name><submission_name>Thesis on 17th Century
    Weather Patterns</submission_name><advisor_type_name>Professor</advisor_type_name>
    <first_name>Magnus</first_name><last_name>Jackson</last_name><suffix>MS</suffix><submission_name>The
    sis on 17th Century Weather Patterns</submission_name><advisor_type_name>Associate
    Professor</advisor_type_name>
    <first_name>Williard</first_name><last_name>Forsberg</last_name><suffix>AMS</suffix><submission_name
    Statistical Analysis on Sunny Days inMarch</submission_name><advisor_type_name>Scientist</advisor_type_name>
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> -- user_datastore that uses procedure:
    SCOTT@orcl_11gR2> BEGIN
      2    CTX_DDL.CREATE_PREFERENCE ('sa_datastore', 'USER_DATASTORE');
      3    CTX_DDL.SET_ATTRIBUTE ('sa_datastore', 'PROCEDURE', 'submission_advisors_proc');
      4  END;
      5  /
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> -- index (on optional extra column) that uses user_datastore and section group:
    SCOTT@orcl_11gR2> ALTER TABLE submission_advisors ADD (any_column VARCHAR2(1))
      2  /
    Table altered.
    SCOTT@orcl_11gR2> CREATE INDEX submission_advisors_idx
      2  ON submission_advisors (any_column)
      3  INDEXTYPE IS CTXSYS.CONTEXT
      4  PARAMETERS
      5    ('DATASTORE     sa_datastore
      6        SECTION GROUP     CTXSYS.AUTO_SECTION_GROUP')
      7  /
    Index created.
    SCOTT@orcl_11gR2> -- what is tokenized, indexed, and searchable:
    SCOTT@orcl_11gR2> SELECT token_text FROM dr$submission_advisors_idx$i
      2  /
    TOKEN_TEXT
    17TH
    ADVISOR_TYPE_NAME
    AMS
    ANALYSIS
    ASSOCIATE
    CENTURY
    CHAIR
    CO
    DAYS
    DEPARTMENT
    DOE
    FIRST_NAME
    FORSBERG
    JACKSON
    JANE
    JOHAN
    JOHN
    LAST_NAME
    MAGNUS
    MARCH
    PAPER
    PATTERNS
    PHD
    PROFESSOR
    RESEARCH
    SCIENTIST
    SMITH
    STATISTICAL
    SUBMISSION_NAME
    SUFFIX
    SUNNY
    THESIS
    WEATHER
    WILLIARD
    34 rows selected.
    SCOTT@orcl_11gR2> -- sample searches across all data:
    SCOTT@orcl_11gR2> VARIABLE search_string VARCHAR2(100)
    SCOTT@orcl_11gR2> EXEC :search_string := 'professor'
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> SELECT s.submission_name,
      2           a.advisor_type_name || ' ' ||
      3           sa.first_name || ' ' ||
      4           sa.last_name || ' ' ||
      5           sa.suffix AS advisor
      6  FROM   submission_advisors sa,
      7           submission s,
      8           advisor_type a
      9  WHERE  CONTAINS (sa.any_column, :search_string) > 0
    10  AND    sa.advisor_type_id = a.advisor_type_id
    11  AND    sa.submission_id = s.submission_id
    12  /
    SUBMISSION_NAME                               ADVISOR
    Thesis on 17th Century Weather Patterns       Professor Johan Smith
    Thesis on 17th Century Weather Patterns       Associate Professor Magnus Jackson MS
    2 rows selected.
    SCOTT@orcl_11gR2> EXEC :search_string := 'doe'
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> /
    SUBMISSION_NAME                               ADVISOR
    Some Research Paper                           Department Co-Chair John Doe PhD
    Some Research Paper                           Department Co-Chair Jane Doe PhD
    2 rows selected.
    SCOTT@orcl_11gR2> EXEC :search_string := 'paper'
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> /
    SUBMISSION_NAME                               ADVISOR
    Some Research Paper                           Department Co-Chair John Doe PhD
    Some Research Paper                           Department Co-Chair Jane Doe PhD
    2 rows selected.
    SCOTT@orcl_11gR2> -- sample searches within specific columns:
    SCOTT@orcl_11gR2> EXEC :search_string := 'chair'
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> SELECT s.submission_name,
      2           a.advisor_type_name || ' ' ||
      3           sa.first_name || ' ' ||
      4           sa.last_name || ' ' ||
      5           sa.suffix AS advisor
      6  FROM   submission_advisors sa,
      7           submission s,
      8           advisor_type a
      9  WHERE  CONTAINS (sa.any_column, :search_string || ' WITHIN advisor_type_name') > 0
    10  AND    sa.advisor_type_id = a.advisor_type_id
    11  AND    sa.submission_id = s.submission_id
    12  /
    SUBMISSION_NAME                               ADVISOR
    Some Research Paper                           Department Co-Chair John Doe PhD
    Some Research Paper                           Department Co-Chair Jane Doe PhD
    2 rows selected.
    SCOTT@orcl_11gR2> EXEC :search_string := 'phd'
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> SELECT s.submission_name,
      2           a.advisor_type_name || ' ' ||
      3           sa.first_name || ' ' ||
      4           sa.last_name || ' ' ||
      5           sa.suffix AS advisor
      6  FROM   submission_advisors sa,
      7           submission s,
      8           advisor_type a
      9  WHERE  CONTAINS (sa.any_column, :search_string || ' WITHIN suffix') > 0
    10  AND    sa.advisor_type_id = a.advisor_type_id
    11  AND    sa.submission_id = s.submission_id
    12  /
    SUBMISSION_NAME                               ADVISOR
    Some Research Paper                           Department Co-Chair John Doe PhD
    Some Research Paper                           Department Co-Chair Jane Doe PhD
    2 rows selected.
    SCOTT@orcl_11gR2> EXEC :search_string := 'weather'
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> SELECT s.submission_name,
      2           a.advisor_type_name || ' ' ||
      3           sa.first_name || ' ' ||
      4           sa.last_name || ' ' ||
      5           sa.suffix AS advisor
      6  FROM   submission_advisors sa,
      7           submission s,
      8           advisor_type a
      9  WHERE  CONTAINS (sa.any_column, :search_string || ' WITHIN submission_name') > 0
    10  AND    sa.advisor_type_id = a.advisor_type_id
    11  AND    sa.submission_id = s.submission_id
    12  /
    SUBMISSION_NAME                               ADVISOR
    Thesis on 17th Century Weather Patterns       Professor Johan Smith
    Thesis on 17th Century Weather Patterns       Associate Professor Magnus Jackson MS
    2 rows selected.

  • User Datastore for multiple tables and columns!

    Hi,
    I hop so much, someone can help me.
    I've made a user datastore to index multiple columns of multiple tables.
    Now, the Documentation of Oracle explains the idexing of one table.
    I have multiple tables, which have all, the columns descr and tagnr. I want to make a query sth like this:
    select table1.column, table2.columnd... where contains(indexed field,'gas within descr',1)>0
    is it possible to index 4 seperate tables, without having a collective key? I dont want to make a Concatenated Datastore.
    I have wrote this code.
    But it doesn't work. It's been compiled fine. But I don't get any result with my queries.
    create or replace
    procedure My_Proc_Wide
    Must be in ctxsys schema.
    In a full-scale example, this would be a wrapper
    for a proc in the user schema.
    rid in rowid,
    tlob in out NOCOPY clob /* NOCOPY instructs Oracle to pass
    this argument as fast as possible */
    is
    v_descr varchar2(80);
    v_tagnr varchar2(30);
    v_descr_name constant varchar2(20) := 'descr';
    v_descr_start_tag constant varchar2(20) := '<' || v_descr_name || '>';
    v_descr_end_tag constant varchar2(20) := '</' || v_descr_name || '>';
    v_tagnr_name constant varchar2(20) := 'tagnr';
    v_tagnr_start_tag constant varchar2(20) := '<' || v_tagnr_name || '>';
    v_tagnr_end_tag constant varchar2(20) := '</' || v_tagnr_name || '>';
    v_buffer varchar2(4000);
    v_length integer;
    begin
    /* verify the env which called this */
    if Dbms_Lob.Istemporary ( tlob ) <> 1
    then
    raise_application_error ( -20000,
    '"IN OUT" tlob isn''t temporary' );
    end if;
    /* the real logic */
    /* first tabel to be indexed */
    select t1.tagnr, t1.descr
    into v_tagnr, v_descr
    from tweb.pdp_positions t1
    where t1.rowid = rid;
    v_buffer := v_tagnr_start_tag ||
    v_tagnr ||
    v_tagnr_end_tag ||
    v_descr_start_tag ||
         v_descr ||
         v_descr_end_tag;
    v_length := length ( v_buffer );
    Dbms_Lob.WriteAppend(tlob, length(v_buffer) + 1, v_buffer || ' ');
    /* second table to be indexed */
    select t2.tagnr, t2.descr
    into v_tagnr, v_descr
    from tweb.pdp_schema_equ t2
    where t2.rowid = rid;
         v_buffer := v_tagnr_start_tag ||
    v_tagnr ||
    v_tagnr_end_tag ||
    v_descr_start_tag ||
         v_descr ||
         v_descr_end_tag;
    v_length := length ( v_buffer );
    Dbms_Lob.WriteAppend(tlob, length(v_buffer) + 1, v_buffer || ' ');
    /*third table to be indexed */
    select t3.tagnr, t3.descr
    into v_tagnr, v_descr
    from tweb.pdp_equipment t3
    where t3.rowid = rid;
         v_buffer := v_tagnr_start_tag ||
    v_tagnr ||
    v_tagnr_end_tag ||
    v_descr_start_tag ||
         v_descr ||
         v_descr_end_tag;
    v_length := length ( v_buffer );
    Dbms_Lob.WriteAppend(tlob, length(v_buffer) + 1, v_buffer || ' ');
    /* fourth table to be indexed */
    select t4.tagnr, t4.descr
    into v_tagnr, v_descr
    from tweb.pdp_Projcode t4
    where t4.rowid = rid;
         v_buffer := v_tagnr_start_tag ||
    v_tagnr ||
    v_tagnr_end_tag ||
    v_descr_start_tag ||
         v_descr ||
         v_descr_end_tag;
    v_length := length ( v_buffer );
    Dbms_Lob.WriteAppend(tlob, length(v_buffer) + 1, v_buffer || ' ');
    end My_Proc_Wide;
    what have I to do, to make this work?
    Any Help would be appriciated!!
    Kind Regards,
    Arsineh

    Arsineh,
    I realise that it has been quite some time since you posted this question but I thought I'd reply just in case you never did manage to get your user datastore working.
    The reason your procedure will not work is simple. A user datastore procedure accepts a rowid input parameter. The rowid is the ID of the row that Oracle Text is currently trying to index. In the example you have given, you are attempting to use the supplied rowid as the primary key for multiple tables, this will simply never work as the rowid's across multiple tables will never correspond.
    The best way to achieve your goal is to create the index on a master table which contains the common primary keys for each of your four tables e.g.
    MASTER_TABLE
    COL:COMMON_KEY (NUMBER(n))
    COL:USER_INDEX_COLUMN (VARCHAR2(1))
    If you create the user datastore index on the MASTER_TABLE.USER_UNDEX_COLUMN column your stored proc simply needs to read the correct row from the MASTER_TABLE (SELECT t.common_key into v_CommonKey FROM master_table t WHERE t.rowid = rid) and issue subsequent queries to extract the relavant data from the t1..t4 tables using the common key e.g.
    SELECT t1.tagnr, t1.descr into v_tagnr, v_descr FROM t1 WHERE t1.[PRIMARY_KEY_FIELD] = v_CommonKey;
    SELECT t2.tagnr, t2.descr into v_tagnr, v_descr FROM t2 WHERE t2.[PRIMARY_KEY_FIELD] = v_CommonKey;
    and so on...
    Hope this helps
    Dean

  • InterMedia Text with USER_DATASTORE and ORA-03113

    Hi,
    I have problems using Oracle's InterMedia Text-index with a
    USER_DATASTORE. I'm using Oracle 8.1.7 on Windows NT 4.0.
    What I try to do is to create a context-index on multiple columns
    of multiple tables. I created a table containing the original
    tablenames and primary keys plus a char(1)-column to index, a
    user_datastore, a procedure in a user-schema, a
    wrapping-procedure in ctxsys' schema and finally the index. All
    works fine so far but I get an ORA-03113 "end-of-file on
    communication channel" error when querying the table with
    contains. The procedure itself works.
    Here's what I tried in detail:
    I created a table "alldocs" containing the tablename and
    primary-key-value of each line of each table plus a dummy-column
    for the index:
    create table alldocs(
    table varchar2(30) not null,
    id number not null,
    data char(1),
    primary key(tabelle, id)
    I filled this table:
    insert into alldocs (select 'MYDOCS', id, 'a' from mydocs);
    insert into alldocs (select 'OTHERDOCS', id, 'b' from otherdocs);
    The user's procedure - only dummy for testing - is:
    create procedure test.GetAllDocsData(row IN ROWID, data IN OUT
    NOCOPY CLOB) IS
         tabname varchar2(30);
         myid     number;
         tmpclob clob;
    begin
         dbms_lob.createtemporary(tmpclob, TRUE);
         dbms_lob.writeappend(tmpclob, 34, 'Ein Text mit ca. 20
    Zeichen Ldnge.');
         data := tmpclob;
    end;
    In ctxsys' schema I defined the following procedure and the
    datastore:
    create or replace procedure sysGetAllDocsData(rid in rowid, tlob
    in out clob) is
    begin
    test.GetAllDocsData(rid, tlob);
    end sysGetAllDocsData;
    grant execute on sysGetAllDocsData to test;
    call ctx_ddl.create_preference('MyUserDS', 'user_datastore');
    call ctx_ddl.set_attribute('MyUserDS', 'procedure',
    'sysGetAllDocsData');
    call ctx_ddl.set_attribute('MyUserDS', 'output_type', 'CLOB');
    Finally I defined the index:
    create index test.alldocs_ctx on test.alldocs(data)
         indextype is ctxsys.context
         parameters ('DATASTORE CTXSYS.MyUserDS FILTER
    CTXSYS.INSO_FILTER LEXER BASIC_LEXER');
    This all works without errors. But when querying like this:
    select * from test.alldocs where contains('data', 'Text')>0
    the answer is
    ORA-03113: end-of-file on communication channel
    I hope someone can help.
    Greetings
    Ralf

    Hi Ralf,
    please define first your own preferences like this:
    exec CTX_DDL.drop_preference('MY_LEXER');
    exec CTX_DDL.create_preference('MY_LEXER','BASIC_LEXER');
    exec CTX_DDL.set_attribute('MY_LEXER','ALTERNATE_SPELLING',
    'GERMAN');
    exec CTX_DDL.set_attribute('MY_LEXER','BASE_LETTER','YES');
    exec CTX_DDL.set_attribute('MY_LEXER','MIXED_CASE', 'NO');
    exec CTX_DDL.set_attribute('MY_LEXER','INDEX_THEMES','NO');
    exec CTX_DDL.set_attribute('MY_LEXER','INDEX_TEXT', 'YES');
    exec CTX_DDL.set_attribute('MY_LEXER','COMPOSITE', 'GERMAN');
    exec ctx_ddl.Drop_Preference ('MY_FILTER');
    exec ctx_ddl.Create_Preference ('MY_FILTER','NULL_FILTER');
    exec ctx_ddl.drop_section_group ('MY_SECTION');
    exec ctx_ddl.create_section_group
    ('MY_SECTION','NULL_SECTION_GROUP');
    and then create your index with this preferences. You only need
    an INSO filter if you want to index pdf,word,...
    create index test.alldocs_ctx on test.alldocs(data)
         indextype is ctxsys.context
         parameters ('DATASTORE CTXSYS.MyUserDS FILTER
    CTXSYS.INSO_FILTER LEXER BASIC_LEXER');create index test.alldocs_ctx on test.alldocs(data)
         indextype is ctxsys.context
         parameters ('
    DATASTORE CTXSYS.MyUserDS
    lexer MY_LEXER
    filter MY_FILTER
    section group MY_SECTION');
    Then see in the token table what tokens are in the index:
    select token_text from dr$alldocs_ctx$i;
    If you got also an ORA-3113 see in alert.log if there is a trace
    referenced with this error and have a look in this file to find a
    better error message.
    Good luck.
    Thomas

  • How to return xmlType from Webservice generated with JDev and PL/SQL

    Hi,
    I have generated an PL/SQL package that's returning a value as xmlType.
    With JDeveloper I'm deploying this package as a webservice. When invoking the webservice from a webbrowser the result looks like:
    <?xml version="1.0" encoding="UTF-8" ?>
    <SOAP-ENV:Envelope
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <SOAP-ENV:Body>
    <ns1:testXmltypeResponse
    xmlns:ns1="http://app/webservice.wsdl"
    SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <return xsi:type="xsd:string">
    <ROWSET>
    <ROW>
    <TODAY>12-OCT-07</TODAY>
    </ROW>
    </ROWSET>
    </return>
    </ns1:testXmltypeResponse>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    The problem is that the <return> tag contains 'xsi:type="xsd:string"'. And now the webservice response is not valid XML because the return value contains XML and not a string.
    The solution would be, when invoking the webservice if the xsi:type would be missing from the result tag or would contains xsd:any. I tried editing the WSDL in JDeveloper and changing the type to xsd:any. After deploying and calling the WSDL from the webbrowser it contains this type. But when invoking the method from the webbrowser it still returns xsd:string as type.
    How can I get rid of this type in the <return> or change it.
    My JDeveloper version is 10.1.3.3.0 The Oracle database and 9iAS are 10.2.
    Thanks in advance,
    Thijs

    What version are you on?
    Works fine for me on my 11g:
    SQL> create or replace procedure testxml (clob_out out clob)
      2  is
      3     l_clob   clob;
      4     l_ctx    dbms_xmlquery.ctxhandle;
      5  begin
      6     l_ctx := dbms_xmlquery.newcontext ('select * from dual');
      7     l_clob := dbms_xmlquery.getxml (l_ctx);
      8     clob_out := l_clob;
      9     dbms_xmlquery.closecontext (l_ctx);
    10  end testxml;
    11  /
    Procedure created.
    SQL>
    SQL> variable vout clob;
    SQL>
    SQL> exec testxml (:vout)
    PL/SQL procedure successfully completed.
    SQL>
    SQL> print vout
    VOUT
    <?xml version = '1.0'?>
    <ROWSET>
       <ROW num="1">
          <DUMMY>X</DUMMY>
       </ROW>
    </ROWSET>But definitely you can optimize your proc a bit: Try
    create or replace procedure testxml (clob_out in out nocopy clob)
    is
       l_ctx    dbms_xmlquery.ctxhandle;
    begin
       l_ctx := dbms_xmlquery.newcontext ('select * from dual');
       clob_out := dbms_xmlquery.getxml (l_ctx);
       dbms_xmlquery.closecontext (l_ctx);
    end testxml;
    /

  • Where do we need to place DLL files for webutil_c_api

    Hi..
    (I posted this a few days back, but no reply..buddies, help me plz)
    In Forms 10g while using webutil_c_api to call c functions,
    where do we need to place the DLL files. Is it enough if we place in the AS or do we need to place the dll files in all the client machines.
    Please clarify me.
    Thnx and Regards
    Sriram

    Hi Sriram,
    Yes, you can place the dlls in the same folder as d2kwut60.dll. Also, for your dll
    to get donwloaded to the client, you need to configure the webutil.cfg file and add an entry for your own dll , after the webutil dll entries, as shown below:
    install.syslib.0.7.1=jacob.dll|94208|1.0|true
    install.syslib.0.9.1=JNIsharedstubs.dll|65582|1.0|true
    install.syslib.0.9.2=d2kwut60.dll|192512|1.0|true
    install.syslib.0.user.1=scanner.dll|192512|1.0|true
    Regards
    Kavitha

  • Use a window handler in a webutil_c_api.invoke

    Hi
    I need to get the window handler of the forms, but I always get 0 from get_window_property( 'my_win',WINDOW_HANDLE )
    and wen I ran the function:
    webutil_c_api.invoke(ps_dll,'TWAIN_AcquireToFilename',func_param_acq);
    the function send me a messagebox of "invalid window handler", then the twain execute well the function and when it finish, the web browser window is closed.
    Can somebody tell me what is wrong ?
    Is not possible to use a C function in a dll with webutil_c_api, that needs a window handler as a parameter
    Thanx in advance

    Hi
    I need to get the window handler of the forms, but I always get 0 from get_window_property( 'my_win',WINDOW_HANDLE )
    and wen I ran the function:
    webutil_c_api.invoke(ps_dll,'TWAIN_AcquireToFilename',func_param_acq);
    the function send me a messagebox of "invalid window handler", then the twain execute well the function and when it finish, the web browser window is closed.
    Can somebody tell me what is wrong ?
    Is not possible to use a C function in a dll with webutil_c_api, that needs a window handler as a parameter
    Thanx in advance

Maybe you are looking for

  • From one of my yahoo groups all the messages come thru appearing from the same person. Why is this?

    I belong to several yahoo groups and use the filters to send them to their respective folders. Lately with one group, all the messages appear to be from the same person, which I know is not true from looking internally. I've looked on my providers si

  • TS3899 my error is the user name or password for gmail is wrong

    How do you change your gmail password?

  • Can't connect to Wi-Fi after Lollipop upgrade

    Since updating my D6503 to Lollipop 5.0.2 (Build 23.1.A.0.726) yesterday, I can't connect to my workplace's Wi-Fi anymore. I'm still able to connect to my home and public Wi-Fi networks. My workplace network settings: WPA2 Enterprise EAP method: PEAP

  • Weak security in Mac OS X

    Hi! I just read this article: http://searchsecurity.techtarget.com.au/articles/30021-Researcher-finds-flaws-in -Mac-OS-X-memory And I want to know... Is this totally true?? How we can protect our systems?? Is Mac OS X 10.6 the only solution? I want t

  • No Video in Premiere CS4

    Hi all, i'm using Premiere Pro CS4 in a C2D 2.8GHz with 4GbRAM running Windows Vista Bussines the problem is that when I import a video i can hear it, but i can't see it in my playback, i put it in the time line but all i get is a "green" screen. i c