GET_SQL

Use the DBMS_HYBRID_VECTOR.GET_SQL PL/SQL function to return the internal SQL query that is generated from the parameters.

When calling the DBMS_HYBRID_VECTOR Search function, the API is called using the JSON Document format. Using the GET_SQL procedure shows the SQL that the DBMS_HYBRID_VECTOR.SEARCH API has generated. The resulting SQL can be used to view the query execution plan to view the index chosen for the hybrid search operation. An example is shown below:

SET LINESIZE 200;
SET PAGESIZE 1000;
SET TAB OFF;
SET TRIMSPOOL ON;
DECLARE
    res CLOB;
BEGIN
    res := dbms_hybrid_vector.get_sql(JSON('{"hybrid_index_name" : "trecvol2j_idx",
                                            "search_text" : "offers",
                                            "return" : { "values" : [ "score" ] } }'));
    execute immediate 'EXPLAIN PLAN FOR '||res;
END;
/
SELECT PLAN_TABLE_OUTPUT FROM TABLE(DBMS_XPLAN.DISPLAY(NULL,NULL,'ADVANCED'));