regexp_substr within pl/sql

Table:

REFERRING_PAGE SEARCH_TERM
ESTENCHERES.FR4RUNER; HIGHLANDER; COROLLA; CAMRY;
HONDA.COMAGREEMENT; CIVIC; PILOT
FORD.COMEXPLORER; ESCAPE SUV; MUSTANG; TAURUS

Outputs of the screen:

REFERRING_PAGE Search_term WORDS
ESTENCHERES.FR4RUNNER; HIGHLANDER; COROLLA; CAMRY;4RUNNER;
HIGHLANDER;
COROLLA;

CAMRY;

HONDAAGREEMENT; CIVIC; PILOTAGREEMENT;CIVIC;PILOTFORD.COMEXPLORER;EXPLORERESCAPE SUV;MUSTANG;TAURUS

Dear OTN forum;

How can I build this function RUN IMMEDIATELY REGEXP_SUBSTR in PL/SQL. Thanks in advance.

SET SERVEROUTPUT SIZE 100000;

DECLARE

v_referring_page dealers.referring_page%type;

v_search_term dealers.search_term%type;

MyCursor CURSOR IS

SELECT referring_page

search_term

AT SELECT RETAILERS

WHERE search_term IS NOT NULL

AND TRUNC (log_date) = TO_DATE('30-JAN-14','DD-MON-YY');

iRec myCursor % ROWTYPE;

BEGIN

OPEN myCursor;

LOOP

FETCH myCursor INTO iRec;

OUTPUT WHEN myCursor % NOTFOUND;

DBMS_OUTPUT. Put_line (iRec.referring_page |) »  '|| iRec.search_term);

DBMS_OUTPUT. PUT_LINE(' ');

DBMS_OUTPUT. Put_line (EXECUTE IMMEDIATE ' SELECT REGEXP_SUBSTR (iRec.search_term, "[^;]")) + ", 1, level) FROM DUAL

CONNECT BY REGEXP_SUBSTR (iRec.search_term, "[^;]") (+ 1, level) IS NOT NULL ");"

END LOOP;

CLOSE MyCursor;

END;

Hello

2745978 wrote:

Table:

REFERRING_PAGE SEARCH_TERM
ESTENCHERES.FR 4RUNER; HIGHLANDER; COROLLA; CAMRY;
HONDA.COM AGREEMENT; CIVIC; PILOT
FORD.COM EXPLORER; ESCAPE SUV; MUSTANG; TAURUS

Outputs of the screen:

REFERRING_PAGE Search_term WORDS
ESTENCHERES.FR 4RUNNER; HIGHLANDER; COROLLA; CAMRY; 4RUNNER;
HIGHLANDER;
COROLLA;

CAMRY;

HONDA AGREEMENT; CIVIC; PILOT AGREEMENT;
CIVIC;
PILOT
FORD.COM EXPLORER; EXPLORER
ESCAPE SUV;
MUSTANG;
TAURUS

Dear OTN forum;

How can I build this function RUN IMMEDIATELY REGEXP_SUBSTR in PL/SQL. Thanks in advance.

SET SERVEROUTPUT SIZE 100000;

DECLARE

v_referring_page dealers.referring_page%type;

v_search_term dealers.search_term%type;

MyCursor CURSOR IS

SELECT referring_page

search_term

AT SELECT RETAILERS

WHERE search_term IS NOT NULL

AND TRUNC (log_date) = TO_DATE('30-JAN-14','DD-MON-YY');

iRec myCursor % ROWTYPE;

BEGIN

OPEN myCursor;

LOOP

FETCH myCursor INTO iRec;

OUTPUT WHEN myCursor % NOTFOUND;

DBMS_OUTPUT. Put_line (iRec.referring_page |) »  '|| iRec.search_term);

DBMS_OUTPUT. PUT_LINE(' ');

DBMS_OUTPUT. Put_line (EXECUTE IMMEDIATE ' SELECT REGEXP_SUBSTR (iRec.search_term, "[^;]")) + ", 1, level) FROM DUAL

CONNECT BY REGEXP_SUBSTR (iRec.search_term, "[^;]") (+ 1, level) IS NOT NULL ");"

END LOOP;

CLOSE MyCursor;

END;

REGEXP_SUBSTR, like almost all other single-row functions, can be invoked directly in PL/SQL; you need not EXECUTE IMMEDIATE or double table.

You can do something like this:

item_cnt: = REGEXP_COUNT (iRec.search_term

, '[^;] +'

);

IF item_cnt > 0

THEN

FOR j IN 1... item_cnt

LOOP

dbms_output.put_line (REGEXP_SUBSTR (iRec.search_term

, '[^;] +'

1

j

)

);

END LOOP;

END IF;

Tags: Database

Similar Questions

  • error in pseudo-column "DECODE" can be used within an SQL statement

    Hi gurus,

    Your help is grealty appreciated. Please help me.


    I'm trying to see if I can use the function decode as below and get the error, here below vPlatformfrom value would be QA or MTS


    vDataBase1 :='@'|| Decode (vPlatformfrom, 'STD', 'STD', 'QA', 'QA')


    Before we check function NVL to a single platform, but now we need the database based on the platform is here.

    -vDataBase1 :='@'|| NVL (vPlatformto, 'MTS');

    Error:

    PLS-00204: pseudo-column "DECODE" or function may be used within an SQL statement

    > So, here, instead of the decode function, I can use this case as below:

    Well... you can, but why?  In your CASE, you simply return the same value as the variable.

    You might as well use: vDataBase1: = vPlatformfrom;  It would reach exactly the same thing.

    If vPlatformfrom can be a null value, you will need to decide what database to use or an exception.  I think you're original code (NVL) were probably more correct, but I can't decide which.

    (and don't bother selecting double, it is an unnecessary sql statement which must be analysed, etc..)

  • don't count elements in a variable within pl/sql block

    Hello

    I'm creating a pl/sql procedure
    declare
    ABC varchar2 (100): = '100, 20, 90';
    Start

    end;

    I want to use a loop for inside the begin-end block, such that it begins with 1 and goes up to the total no of elements in abc
    i.e. for i in 1.3 in the form abc now has the number 3.

    The value of the abc is not fixed it can have a 0r more numbers separated by a «,»

    So, how can I write that my select queries so that it returns me the number of the elements in abc.

    Thank you
    Olivier
    SQL> ed
    Wrote file afiedt.buf
    
      1  declare
      2    abc varchar2(100):='100,20,90';
      3    cursor cur_split is
      4      select regexp_substr(abc, '[^,]+', 1, rownum) as txt
      5      from   dual
      6      connect by rownum <= length(regexp_replace(abc,'[^,]'))+1;
      7  begin
      8    for i in cur_split
      9    loop
     10      dbms_output.put_line(i.txt);
     11    end loop;
     12* end;
    SQL> /
    100
    20
    90
    
    PL/SQL procedure successfully completed.
    
    SQL>
    
  • SDO_RELATE within PL/SQL query with rownum clause runs slowly on 12 c - works great on 10 g

    Hello

    I use the database 12.1.0.2 with a node 2 RAC on Windows.

    I am struck by a really weird performance problem with a particular query.  Bear with me while I try to explain...

    I have a chart with lines 30 sdo_geometry million, in 7 partitions with a local partitioned spatial index divided.  Called BIG_PARTITIONED_TABLE for this example.

    I query the table to search for one line with a geometry that is equal to the geometry of my request.  In this case I use sdo_relate with "mask = equal".  Instantly returns:

    SQL> select id, geometry
      2  from       BIG_PARTITIONED_TABLE o
      3  where      sdo_relate(o.geometry, sdo_geometry(2002, 2157, NULL, SDO_ELEM_INFO_ARRAY(1, 2, 1),
      4     SDO_ORDINATE_ARRAY(604853.595, 692379.864, 604879.046, 692350.272)), 'mask=equal') = 'TRUE'
      5  and rownum = 1;
    
            ID
    ----------
    GEOMETRY(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)
    -------------------------------------------------------------------------------
    2.5405E+12
    SDO_GEOMETRY(2002, 2157, NULL, SDO_ELEM_INFO_ARRAY(1, 2, 1), SDO_ORDINATE_ARRAY(604853.595, 692379.864, 604879.046, 692350.272))
    
    Elapsed: 00:00:00.10
    
    

    But if I put the same query in PL/SQL, so it takes 21 seconds:

    SQL> declare
      2     l_id number;
      3     l_geom sdo_geometry;
      4     l_window_geom sdo_geometry;
      5  begin
      6     l_window_geom := sdo_geometry(2002, 2157, NULL, SDO_ELEM_INFO_ARRAY(1, 2, 1),
      7             SDO_ORDINATE_ARRAY(604853.595, 692379.864, 604879.046, 692350.272));
      8
      9     select id, geometry
    10     into l_id, l_geom
    11     from    BIG_PARTITIONED_TABLE o
    12     where   sdo_relate(o.geometry, l_window_geom, 'mask=equal') = 'TRUE'
    13     and rownum = 1;
    14
    15  end;
    16  /
    
    PL/SQL procedure successfully completed.
    
    Elapsed: 00:00:21.13
    
    

    If I remove the "rownum = 1", then it returns instantly:

    SQL> declare
      2     l_id number;
      3     l_geom sdo_geometry;
      4     l_window_geom sdo_geometry;
      5  begin
      6     l_window_geom := sdo_geometry(2002, 2157, NULL, SDO_ELEM_INFO_ARRAY(1, 2, 1),
      7             SDO_ORDINATE_ARRAY(604853.595, 692379.864, 604879.046, 692350.272));
      8
      9     select id, geometry
    10     into l_id, l_geom
    11     from    BIG_PARTITIONED_TABLE o
    12     where   sdo_relate(o.geometry, l_window_geom, 'mask=equal') = 'TRUE';
    13
    14  end;
    15  /
    
    PL/SQL procedure successfully completed.
    
    Elapsed: 00:00:00.03
    
    

    If using sdo_equal instead of sdo_relate and keep the "rownum = 1", then it returns instantly.

    SQL> declare
      2     l_id number;
      3     l_geom sdo_geometry;
      4     l_window_geom sdo_geometry;
      5  begin
      6     l_window_geom := sdo_geometry(2002, 2157, NULL, SDO_ELEM_INFO_ARRAY(1, 2, 1),
      7             SDO_ORDINATE_ARRAY(604853.595, 692379.864, 604879.046, 692350.272));
      8
      9     select id, geometry
    10     into l_id, l_geom
    11     from    BIG_PARTITIONED_TABLE o
    12     where   sdo_equal(o.geometry, l_window_geom) = 'TRUE'
    13     and rownum = 1;
    14
    15  end;
    16  /
    
    PL/SQL procedure successfully completed.
    
    Elapsed: 00:00:00.13
    
    

    Here is a comparison of the plans to explain.  First, here's the good thing, that is using the spatial index (BIG_PARTITIONED_TABLE_SPIND):

    select id, GEOMETRY
    FROM
    BIG_PARTITIONED_TABLE O WHERE SDO_EQUAL(O.GEOMETRY, :B1 ) = 'TRUE'
    AND ROWNUM = 1
    
    call     count       cpu    elapsed       disk      query    current        rows
    ------- ------  -------- ---------- ---------- ---------- ----------  ----------
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      0.01       0.02          0         39          0           0
    Fetch        1      0.00       0.01          0         31          0           1
    ------- ------  -------- ---------- ---------- ---------- ----------  ----------
    total        3      0.01       0.04          0         70          0           1
    
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 263     (recursive depth: 1)
    Number of plan statistics captured: 1
    
    Rows (1st) Rows (avg) Rows (max)  Row Source Operation
    ---------- ---------- ----------  ---------------------------------------------------
             1          1          1  COUNT STOPKEY (cr=99 pr=0 pw=0 time=43307 us)
             1          1          1   PARTITION RANGE ALL PARTITION: 1 7 (cr=99 pr=0 pw=0 time=43297 us cost=0 size=66 card=1)
             1          1          1    TABLE ACCESS BY LOCAL INDEX ROWID BIG_PARTITIONED_TABLE PARTITION: 1 7 (cr=99 pr=0 pw=0 time=43280 us cost=0 size=66 card=1)
             1          1          1     DOMAIN INDEX  BIG_PARTITIONED_TABLE_SPIND (cr=98 pr=0 pw=0 time=43250 us)
    
    

    Then the slow that does not use the spatial index.

    select id, GEOMETRY
    FROM
    BIG_PARTITIONED_TABLE O WHERE SDO_RELATE(O.GEOMETRY, :B1 , 'mask=equal') = 'TRUE'
      AND ROWNUM = 1
    
    call     count       cpu    elapsed       disk      query    current        rows
    ------- ------  -------- ---------- ---------- ---------- ----------  ----------
    Parse        1      0.01       0.00          0          0          0           0
    Execute      1      0.03       0.03          0       1123          0           0
    Fetch        1     24.25      24.25          0     499429          0           1
    ------- ------  -------- ---------- ---------- ---------- ----------  ----------
    total        3     24.30      24.29          0     500552          0           1
    
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 263     (recursive depth: 1)
    Number of plan statistics captured: 1
    
    Rows (1st) Rows (avg) Rows (max)  Row Source Operation
    ---------- ---------- ----------  ---------------------------------------------------
             1          1          1  COUNT STOPKEY (cr=499532 pr=0 pw=0 time=24289612 us)
             1          1          1   HASH JOIN RIGHT SEMI (cr=499532 pr=0 pw=0 time=24289586 us cost=32 size=144 card=1)
             1          1          1    VIEW  VW_NSO_1 (cr=103 pr=0 pw=0 time=31110 us cost=29 size=98016 card=8168)
             1          1          1     COLLECTION ITERATOR PICKLER FETCH SDO_PQRY (cr=103 pr=0 pw=0 time=31104 us cost=29 size=16336 card=8168)
      16914892   16914892   16914892    PARTITION RANGE ALL PARTITION: 1 7 (cr=499429 pr=0 pw=0 time=28678375 us cost=3 size=6600 card=100)
      16914892   16914892   16914892     TABLE ACCESS FULL BIG_PARTITIONED_TABLE PARTITION: 1 7 (cr=499429 pr=0 pw=0 time=23406547 us cost=3 size=6600 card=100)
    
    

    I tried adding an indication / * + index (o BIG_PARTITIONED_TABLE_SPIND) * / but that did not help.

    I am struck this issue during testing of upgrade 10.2.0.5 to 12.1.0.2.  The query works perfectly on 10g - we note only that this question on 12 c.

    I can't use sdo_equal as the real mask that we want is equal + dommagescausdspar + covers.  I'm just using equal here to simplify the test.

    I use "rownum = 1" because I want to just the first result.  In practice I can rewrite probably is a FOR LOOP, I get out after the first result, but that seems all just awful.

    Any ideas?  If anyone has seen anything like this before?  Its an optimizer delivers really so I'm going to cross post the SQL Forum after a certain time, but thought I would post it here first.

    Thank you

    John

    Hi John,.

    Can you please try the following before your slow queries event?

    "ALTER session set events ' trace 54669 name context forever."

    Thank you

    Ying

  • Call Shell Script from within PL/SQL - using DBMS_PIPE

    Hi all

    I'm trying to run a shell script inside my PL/SQL using DBMS_PIPE block (not sure if this is the right way or not)

    Pl Sql script

    ==========

    Set serveroutput size 100000

    declare

    cursor c1 is select * from mag_images

    where nom_image like '% comp2.

    v_path varchar2 (100): = ' / home/maguzzi/DOCUMENTS_DIR / ";

    v_result number: = 0;

    v_in_filename varchar2 (100): = v_path | ' test_file.jpg';

    v_out_filename varchar2 (100): = v_path | ' test_file_out.jpg';

    v_script varchar2 (100): = "tst_convert.sh";

    v_command varchar2 (200): = 'sh'. v_path | v_script | » '|| v_in_filename | » '|| v_out_filename;

    Start

    A1 to c1 loop

    dbms_output.put_line ('v_command: ' | v_command);

    write_to_file ('test_file.jpg', 'DOCUMENTS_DIR', a1. Content);

    dbms_output.put_line (' file write result: ' | v_result);

    v_result: = exec_host_command (v_command);

    dbms_output.put_line (' resize result :'|| file v_result);

    end loop;

    end;

    Result DBMS_OUTPUT

    ====================

    v_command: /home/maguzzi/DOCUMENTS_DIR/tst_convert.sh test_file.jpg test_file_out.jpg

    Result of the entry of the file: 0

    Result of resizing the file: 0

    PL/SQL procedure successfully completed.

    Function exec_host_command

    =======================

    FUNCTION to CREATE or REPLACE exec_host_command (lc_cmd IN VARCHAR2)

    RETURN INTEGER IS

    ln_status NUMBER;

    lc_errormsg VARCHAR2 (80);

    lc_pipe_name VARCHAR2 (30);

    BEGIN

    lc_pipe_name: = 'Maguzzi_PIPE ';

    DBMS_PIPE. PACK_MESSAGE (lc_cmd);

    ln_status: = dbms_pipe.send_message (lc_pipe_name);

    RETURN ln_status;

    END;

    /

    The Image of the BLOB is written to the correct location on the server "test_file.jpg", and although the exec_host_command function returns a value of 0, the shell script (tst_convert.sh) is not executed (i.e. no output file is created - outfile.txt and the image is not copied/converted to a new file name "" test_file_out.jpg" )

    Shell script

    ========

    tst_convert.sh

    echo 'Here' > outfile.txt

    Echo $1 > > outfile.txt

    Echo $2 > > outfile.txt

    resizing to convert $1 - $200 2

    Could this be problems with permissions on files?

    test_file1.jpg has permission - rw-rw-r-

    test_convert.sh a permission rwxrwxrwx

    When I run the script manually and pass in 2 parameters ($1 = infilename and $2 = outfilename), it works...

    I'd appreciate if someone can point out my mistake or suggest another method that works.

    Thanks in advance

    How long does it take to create the converted file? Remember that the external Scheduler is running asynchronously, so it is possible that the converted file does not exist yet when the PL/SQL block subsequently tries to open it.

    Try to add some delay seconds to the routine to ensure that the external task is completed:

        begin
          dbms_scheduler.create_job(
              job_name => 'MAG_IMAGE_CONVERT2'
            , job_type => 'EXECUTABLE'
            , job_action => '/home/oracle/DOCUMENTS_DIR/tst_convert2.sh' );--  '/home/oracle/DOCUMENTS_DIR/tst_convert.sh');
          dbms_scheduler.enable('MAG_IMAGE_CONVERT2');
          dbms_lock.sleep(3);
        end;
    

    This probably isn't really a viable solution in the long term if it turns out that this is really the problem.

  • How to execute a SQL statement that is stored within a SQL Table

    Hello

    If someone please help me with the following problem I would be eternally grateful

    I have a SQL statement that is stored inside a certain SQL table, I want to use this SQL statement inside my PL/SQL procedure.

    Thought a simple solution was to get the SQL statement in a table, and then run it, but how could I do so exactly with PL/SQL? I only started to play with PL/SQL in the last days.

    Thanks in advance!

    This is what it looks like more or less:

    Display result for:

    ---------------------

    SELECT TRIM (OBJ_VALU_TXT)

    OF OBJ_VALU_DOC

    WHERE TYPE_OBJET = 'FLD '.

    AND OBJECT_CODE = 15443

    AND OBJ_VALU_CD = 'CAB '.

    ORDER BYDOC_SEQ_NO

    00001

    ------------------------------------------------------------------

    SELECT

    VALUE (MAX (RECEIPT_NO) + 1,: OUT-COMP-FACTOR)

    THE FRONT DESK

    WHERE (RECEIPT_NO BETWEEN

    (: OUT-COMP-FACTOR AND: OUT TO A NUMBER) OR

    (RECEIPT_NO >: OUT-COMP-FACTOR AND)

    (: OUT-TO-NUMBER = 0)

    Here's a demo of your condition.

    create table t (col1 varchar2 (200));

    table created

    insert into values t ('select * from double ');

    1 row inserted

    declare
    v_col varchar2 (200);
    v_val varchar2 (200);
    Start

    Select col1 in t v_col;

    run immediately v_col in v_val;
    dbms_output.put_line (v_val);
    end;

    -----
    X

    Use in the clause, you can use as many variables as needed. But the basic approach remains the same.

    But storage in DB SQL is not an efficient design.

    Ishan

  • Lines of columns within PL/SQL or sql.

    Hi I need to get this data, which are retrieved using a query sql with a prerequisite by clause and are displayed as lines. for display in a separate on one... rank column, the values must be in their own column on the same line...

    tabular presentation
     Level 1   Level2     Level3    Level4    Level5  
    column1     column2     column3
    270767     197851            1
    64631     230693            2
    33115     230481            3
    229148     209655            4
     
    So, I need to enter these lines in the columns of the table... But the lines can be up to 11 and beyond so I'll create a table with many columns, but for now
    just using 5, but I want the script, so it can just keep going through the columns not only limited to 5...

    This query you posted could be reduced up to...

    select max(decode(hierarchy_level,1,subordinate_position_id)) as number1
          ,max(decode(hierarchy_level,2,subordinate_position_id)) as number2
          ,max(decode(hierarchy_level,3,subordinate_position_id)) as number3
          ,max(decode(hierarchy_level,4,subordinate_position_id)) as number4
          ,max(decode(hierarchy_level,5,subordinate_position_id)) as number5
          ,max(decode(hierarchy_level,6,subordinate_position_id)) as number6
          ,max(decode(hierarchy_level,7,subordinate_position_id)) as number7
          ,max(decode(hierarchy_level,8,subordinate_position_id)) as number8
          ,max(decode(hierarchy_level,9,subordinate_position_id)) as number9
          ,max(decode(hierarchy_level,10,subordinate_position_id)) as number10
          ,max(decode(hierarchy_level,11,subordinate_position_id)) as number11
          ,max(decode(hierarchy_level,12,subordinate_position_id)) as number12
          ,max(decode(hierarchy_level,13,subordinate_position_id)) as number13
          ,max(decode(hierarchy_level,14,subordinate_position_id)) as number14
          ,max(decode(hierarchy_level,15,subordinate_position_id)) as number15
    from
         (SELECT pos.subordinate_position_id
                ,LEVEL AS hierarchy_level
          FROM   apps.per_pos_structure_elements pos,
                (select paf.position_id,paf.person_id
                 from   per_all_assignments_f paf
                 where  sysdate between paf.effective_start_date and paf.effective_end_date
                 and    paf.assignment_type = 'E') people_data
          WHERE  pos.pos_structure_version_id = 103
          and    pos.subordinate_position_id = people_data.position_id (+)
          CONNECT BY PRIOR pos.parent_position_id = pos.subordinate_position_id
          AND pos.pos_structure_version_id = 103
          START WITH pos.subordinate_position_id = 197851
         )
    
  • How to initialize the Java variable within pl/sql block in the ODi procedure

    I have a step in the procedure of odi that using oracle technology.

    I want to initialize the java variable inside that.

    Please help me for this.

    < @ if (odiRef.getOption ("USE_PUBADMIN_PARAM_TABLE").equals("1")) {@ >}

    DENIZ

    EH_FAILURE_MESSAGE_TEXT VARCHAR2 (4000);

    EH_FIXED_VERSION VARCHAR2 (4000);

    EH_ISSUE_TYPE VARCHAR2 (4000);

    EH_PRIORITY VARCHAR2 (4000);

    EH_SUMMARY VARCHAR2 (4000);

    EH_DESCRIPTION VARCHAR2 (4000);

    EH_PROJECT_ID VARCHAR2 (4000);

    EH_COMPONENT VARCHAR2 (4000);

    EH_AFFECTED_VERSION VARCHAR2 (4000);

    EH_CUSTOMPROPXML VARCHAR2 (4000);

    EH_LOG_JIRA VARCHAR2 (4000);

    EH_CONTINUE_ON_ERROR VARCHAR2 (4000);

    EH_SEND_MAIL_NOTIFICATION VARCHAR2 (4000);

    EH_NOTIFICATION_RECIPENTS VARCHAR2 (4000);

    EH_JIRAJARPATH VARCHAR2 (4000);

    BEGIN

    SELECT

    DECODE ('< % = odiRef.getOption ("FAILURE_MESSAGE_TEXT") % >', NULL, PBA_PARAM_PKG.) ("GET_PARAMETER ('EH_FAILURE_MESSAGE_TEXT'),' < % = odiRef.getOption ("FAILURE_MESSAGE_TEXT") % >") IN EH_FAILURE_MESSAGE_TEXT.

    DECODE ('< % = odiRef.getOption ("FIXED_VERSION") % >', NULL, PBA_PARAM_PKG.) ("GET_PARAMETER ('EH_FIXED_VERSION'),' < % = odiRef.getOption ("FIXED_VERSION") % >") IN EH_FIXED_VERSION.

    DECODE ('< % = odiRef.getOption ("ISSUE_TYPE") % >', NULL, PBA_PARAM_PKG.) ("GET_PARAMETER ('EH_ISSUE_TYPE'),' < % = odiRef.getOption ("ISSUE_TYPE") % >") IN EH_ISSUE_TYPE.

    DECODE ('< % = odiRef.getOption ("PRIORITY") % >', NULL, PBA_PARAM_PKG.) ("GET_PARAMETER ('EH_PRIORITY'),' < % = odiRef.getOption ("PRIORITY") % >") IN EH_PRIORITY.

    DECODE ('< % = odiRef.getOption ("SUMMARY") % >', NULL, PBA_PARAM_PKG.) ("GET_PARAMETER ('EH_SUMMARY'),' < % = odiRef.getOption ("SUMMARY") % >") IN EH_SUMMARY.

    DECODE ('< % = odiRef.getOption ("DESCRIPTION") % >', NULL, PBA_PARAM_PKG.) ("GET_PARAMETER ('EH_DESCRIPTION'),' < % = odiRef.getOption ('DESCRIPTION') % >") IN EH_DESCRIPTION.

    DECODE ('< % = odiRef.getOption ("project") % >', NULL, PBA_PARAM_PKG.) ("GET_PARAMETER ('EH_PROJECT_ID'),' < % = odiRef.getOption ("project") % >") IN EH_PROJECT_ID.

    DECODE ('< % = odiRef.getOption ("ELEMENT") % >', NULL, PBA_PARAM_PKG.) ("GET_PARAMETER ('EH_COMPONENT'),' < % = odiRef.getOption ('ELEMENT') % >") IN EH_COMPONENT.

    DECODE ('< % = odiRef.getOption ("AFFECTED_VERSION") % >', NULL, PBA_PARAM_PKG.) ("GET_PARAMETER ('EH_AFFECTED_VERSION'),' < % = odiRef.getOption ("AFFECTED_VERSION") % >") IN EH_AFFECTED_VERSION.

    DECODE ('< % = odiRef.getOption ("CUSTOMPROPXML") % >', NULL, PBA_PARAM_PKG.) ("GET_PARAMETER ('EH_CUSTOMPROPXML'),' < % = odiRef.getOption ("CUSTOMPROPXML") % >") IN EH_CUSTOMPROPXML.

    DECODE ('< % = odiRef.getOption ("LOG_JIRA") % >', '0', PBA_PARAM_PKG.) ("GET_PARAMETER ('EH_LOG_JIRA'),' < % = odiRef.getOption ("LOG_JIRA") % >") IN EH_LOG_JIRA.

    Decode('%=odiRef.GetOption("CONTINUE_ON_ERROR") % > ', '0', PBA_PARAM_PKG. ("GET_PARAMETER ('EH_CONTINUE_ON_ERROR'),' < % = odiRef.getOption ("CONTINUE_ON_ERROR") % >") IN EH_CONTINUE_ON_ERROR.

    DECODE ('< % = odiRef.getOption ("SEND_MAIL_NOTIFICATION") % >', '0', PBA_PARAM_PKG.) ("GET_PARAMETER ('EH_SEND_MAIL_NOTIFICATION'),' < % = odiRef.getOption ("SEND_MAIL_NOTIFICATION") % >") IN EH_SEND_MAIL_NOTIFICATION.

    DECODE ('< % = odiRef.getOption ("NOTIFICATION_RECIPENTS") % >', NULL, PBA_PARAM_PKG.) ("GET_PARAMETER ('EH_NOTIFICATION_RECIPENTS'),' < % = odiRef.getOption ("NOTIFICATION_RECIPENTS") % >") IN EH_NOTIFICATION_RECIPENTS.

    PBA_PARAM_PKG. GET_PARAMETER ('EH_JIRAJARPATH') IN EH_JIRAJARPATH

    Double;

    / * I want to start as it is below. idon't want to control user source and control target conecpt.

    Please help me to below concept.

    */

    < @.

    String V_EH_FAILURE_MESSAGE_TEXT = EH_FAILURE_MESSAGE_TEXT;

    String V_EH_FIXED_VERSION = EH_FIXED_VERSION;

    String V_EH_ISSUE_TYPE = EH_ISSUE_TYPE;

    String V_EH_PRIORITY = EH_PRIORITY;

    String V_EH_SUMMARY = EH_SUMMARY;

    String V_EH_DESCRIPTION = EH_DESCRIPTION;

    String V_EH_PROJECT_ID = EH_PROJECT_ID;

    String V_EH_COMPONENT = EH_COMPONENT;

    String V_EH_AFFECTED_VERSION = EH_AFFECTED_VERSION;

    String V_EH_CUSTOMPROPXML = EH_CUSTOMPROPXML;

    String V_EH_LOG_JIRA = EH_LOG_JIRA;

    String V_EH_CONTINUE_ON_ERROR = EH_CONTINUE_ON_ERROR;

    String V_EH_SEND_MAIL_NOTIFICATION = EH_SEND_MAIL_NOTIFICATION;

    String V_EH_NOTIFICATION_RECIPENTS = EH_NOTIFICATION_RECIPENTS;

    String V_EH_JIRAJARPATH = EH_JIRAJARPATH;

    @ >

    END;

    {< @} @ >

    I have corrected this problem. No need to search on that.

  • Question about a view inline or function within SQL

    Hi all


    I would like to know if using a view inline with a sql query is better or a call of function within the sql query is preferable.

    When I check the plan explained in both cases I see no difference in the cost.

    Appreciate your valuable suggestions on this.


    Thank you
    Maddy K.

    A function of a query will be worse than an inline view, given the context of switching between SQL and PL/SQL engines.

    See http://asktom.oracle.com/pls/apex/f?p=100:11:0:P11_QUESTION_ID:60122715103602
    Bonus http://www.oracle.com/technetwork/database/features/plsql/overview/doing-sql-from-plsql-129775.pdf

  • Service Pack compliance - SQL - SCOM

    We have:

    SCOM R2 2012

    SQL MP is up to date

    The question:

    We rely on the compliance of Service Pack within the SQL MP in order to know when the SQL servers fall in non-compliance.  He worked up to 1.5 months ago.  It worked so well, that it has become a tool for our team of SQL.

    We have realized that it stopped working when the SQL team members out of non-compliant servers where we have not received any notification.

    There is little documentation about this tool.

    (1) how do SCOM servers communicate with MS on knowledge when check compliance?  My hunch is that something has changed in the Internet network access.

    (2) is just use MS Updates?

    Any help will be greatly appreciated.

    Thank you!!!

    Hello

    Your question is beyond the scope of this community.

    Please repost your question in the SQL Server TechNet Forums.

    https://social.technet.Microsoft.com/forums/SQLServer/en-us/home?category=SQLServer

    Or here:

    https://social.technet.Microsoft.com/forums/SystemCenter/en-us/home?category=systemcenteroperationsmanager

    See you soon.

  • cached SQL query?

    Hello, when the 11 GR 2. run a select package.f_function ('STRING') of double) as a subquery, that subquery runs only the first initial, and then every other time, if the main application is in the loop, is run from the cache? The CHAIN will be the same and is placed as a constant, it is not variable binding. But I doubt he is read from the cache because it is a within a SQL PL, am I correct?

    If you ask about the caching of scalar subquery in Oracle - Yes Oracle can cache the result (no DETERMINISTIC or RESULT_CACHE) when the function is called a SELECT query. But there is a method or a way to do it. Read the Blog of Tom Kyte: yet another new...  and http://www.oracle.com/technetwork/issue-archive/2011/11-sep/o51asktom-453438.html

    to see some examples.

  • How to get the PL/SQL-call of a running application stack? (11.2.0.3)

    Hello

    I have an app running, but does not end.

    I can see the SQL, but I need to find out what PL/SQL-package the SQL.

    Does anyone have a tip for me where to look?

    There are many examples in order to recover the call in the exception management stack, but none to recover by session_id.

    Thanks in advance,

    Mynz

    Columns in session $ v % plsql_ can help, the query below is about the same.
    https://community.Oracle.com/thread/2232972?TSTART=0

    Alternatively, you can get some respect distinctive within the SQL text and research in dba/all/user_source for him.

  • How to truncate the table in a pl/sql block

    Hello guys, I'm trying to truncate a table that includes data using a pl/sql block, so if the table has even a single row then the truncate should run. to do this, I wrote the following code


    declare
    number num.
    Start
    Select count (*) in the num from table_name;
    If num > 0 then
    truncate table table_name;
    end if;
    end;

    Now, when I execute the pl/sql block, I get the following error.

    PLS-00103: encountered the symbol "TABLE" when the expected in the following way:

    When I run the truncate without pl/sql command, it runs very well.

    Can someone please where I'm wrong.

    Thank you

    Published by: 969224 on April 23, 2013 08:08

    969224 wrote:
    Hello guys, I'm trying to truncate a table that includes data using a pl/sql block, so if the table has even a single row then the truncate should run. to do this, I wrote the following code

    declare
    number num.
    Start
    Select count (*) in the num from table_name;
    If num > 0 then
    truncate table table_name;
    end if;
    end;

    Now, when I execute the pl/sql block, I get the following error.

    PLS-00103: encountered the symbol "TABLE" when the expected in the following way:

    When I run the truncate without pl/sql command, it runs very well.

    Can someone please where I'm wrong.

    Thank you

    Published by: 969224 on April 23, 2013 08:08

    DDL is not allowed directly within PL/SQL procedures.

    You must (ab) use EXECUTE IMMEDIATE issuing the DDL

  • DATA_TYPE Oracle (using SQL) questions

    I have a Client Server application that I created using a server for MS - SQL (MS - SQL Server 2008 R2 Express) database.

    Since MS - SQL Server has wide range and number of DATA_TYPEs, I chose to devote some of these DATA_TYPEs to the application-specific processing (mainly MONEY and DATA_TYPES BOOLEAN).

    In addition, I decided that in the Client Application that the general treatment of a particular field would be determined by the corresponding DATA_TYPE stored in the database.

    The value of the DATA_TYPE for a particular field within the SQL Server database and can be determined by querying:

    "select DATA_TYPE from INFORMATION_SCHEMA. Columns
    "where ((Column_name = «my_Field») and (Table_Name = 'myTable')).

    I also extract/use other DATA_TYPE information as necessary or appropriate.

    With this information the Client Application can systematically treated differently may be a MONEY (a DATA_TYPE in MS - SQL Server) a decimal or one BIGINT (two other DATA_TYPEs in MS - SQL Server). I have to create the field with the correct DATA_TYPE in the database, but after that I don't have to worry about this.
    .
    .
    .
    Now, I'm moving a database to Oracle (Oracle Database Express Edition 11 g Release 2). And I would have the same (or similar) feature, as described above.

    Oracle has less DATA_TYPES is more difficult to bind an application-specific-data type to a database-Oracle-DATA_TYPE-specific. There are simply not as many "sacrifice" to my specific processing of the application. I don't want to treat each field DIGITAL like 'le-apps-money-type.'

    With Oracle can I associate 'the-apps-money-type', let's say, a NUMERIC (9,2), then the Client Application will process all NUMERIC (9.2) as 'the-apps-money-type '.

    The Client Application queries the Oracle database for DATA_TYPE DATA_PRECISION, DATA_SCALE to make this determination.

    But this approach doesn't appeal to me, suppose I have other NUMERIC fields (9,2) who are not of the 'the-apps-money-type '. How can I set and then later determine, from the Oracle backend, if the NUMERIC field (9.2) is intended to be used as 'the-apps-money-type' or just a regular number?

    Is it possible I can create a kind of "sub DATA_TYPE" in Oracle?

    I have considered this in the COMMENT field associated with particular field. Then a query for this comment when I did DIGITAL DATA_TYPEs. But the COMMENTS field seems not to turn all_tab_columns and user_tab_columns.

    (With Oracle SQL Developer, you can create/edit/delete user created tables/fields. COMMENTS can be added to the individual fields in a table - this are the COMMENTS that I am referring above).
    .
    .
    .
    What I would do, and a more direct approach for me, would be in some way create a user defined DATA_TYPE is simply:
    (1) a user defined DATA_TYPE name (such as MY_MONEY_TYPE),
    (2) associated with a built-in Oracle data type (such as NUMERIC (9.2).)

    Then when the client application queries user_tab_columns the field may be treated appropriately. If I can't do it, maybe there is somewhere else I may be put and subsequently ask for such information.

    What are the most direct ways to implement the functionality described above?

    You can create an object type and certainly use it in your table definition

    SQL> create type my_money_type as object (
      2    val number(9,2)
      3  );
      4  /
    
    Type created.
    
    SQL> create table foo (
      2    col1 number primary key,
      3    col2 my_money_type
      4  );
    
    Table created.
    
    SQL> insert into foo values( 1, my_money_type(1.23) );
    
    1 row created.
    
    SQL> select col1, col2 from foo;
    
       COL1
    -------
    COL2(VAL)
    --------------------------------------------------------------------------------
       1.00
    MY_MONEY_TYPE(1.23)
    

    This usually isn't a particularly good way to design an application, however. Types of objects are very useful in the treatment of PL/SQL, but their conservation in a table is usually a pain - you must constantly to call the constructor of the object and the getter methods (I did not worth defining here) assuming that you want to return the number of 1.23 rather than an instance of MY_MONEY_TYPE.

    Justin

  • SQL * more: how to avoid asking them &amp; 1?

    I use a parameter within a SQL Script more to set a value for the creation of different environments.
    DEFINE _env = '&1'
    The parameter & 1 is used. However, a NULL value is allowed. But if this parameter is not defined, sql * more guests to enter something for & 1. How can we avoid this?

    SQL use
    sqlplus user/password@database @test_parameter.sql
    
    SQL> exit
    
    Verbunden mit:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Partitioning, Oracle Label Security, OLAP, Data Mining,
    Oracle Database Vault and Real Application Testing options
    
    "Geben Sie einen Wert f³r 1 ein:"
    
    SQL> prompt Env&_env.
    Env
    SQL>
    I'm looking for an easy way avoid the message < font color = "red" > "enter a value for 1:" < / police > if no parameter is added.
    If a parameter is added, this message does not appear.
    sqlplus user/password@database @test_parameter.sql _TST
    example script
    -- set environment 
    ------------------
    -- Allowed values are 
    -- "_DEV" = Development 
    -- "_TST" = Test
    -- "" = Production)
    set verify off
    
    DEFINE _env = '&1'
    
    begin 
      if '&_env' is null 
        or regexp_like ('&_env', '_[[:alnum:]]{3}') then 
         null; --ok
      else
        raise_application_error(-20000,'Parameter 1 (''&_env'') has wrong value. Must start with _ and only 3 letters or be empty.' );
      end if;
    end;
    /
    
    set echo on
    
    prompt env&_env.
    Published by: Sven w. March 15, 2012 16:40

    When you want to call it "parameterless" give a string empty (two single quotes) like this:

    sqlplus user/password@database @test_parameter.sql ''
    

Maybe you are looking for

  • How can I change the network address of my Time Machine drive?

    Hi people, This is my second question in 12 hours. Thanks to help I received here, I abandoned my doomed attempt to use my old AirPort Extreme and a USB key for Time Machine backups. I've used my ReadyNAS for Time Machine backups, but it has never be

  • memory reader and iPad iCloud

    I was wondering if the files and or photo that you put in your iCloud drive take up any room on your iPad, iPod Touch and the thing like that. I have a lot of photo in my iCloud drive and when I look at my memory on my iPad it to me I lost like 2 GB

  • How to fill out the list devices shared in the sidebar of finder

    The Finder sidebar shows no sharing and peripherals.  2 mac under v10.11.4, each set to share files and screens between them and set for the remote access connection.  Both on the same account iCloud. Try to make a remote access connection and cannot

  • Satellite A500 - 17 X - version of Windows that is installed?

    Toshiba detection tool indicates that my laptop is running a Windows Vista operating system. But hardware basic information says it's an edition home Windows7 premium. Which is correct? I have a Satellite A500 - 17 X bought from pc world. The laptop

  • HP d 506: driver problem

    We are connecting remote on our server. We bought a printer hp 506 x and connect to our a portable computer terminal current. We install the driver. When we try printing a windows 10 document is not printed correctly. But same printer send us another