How to write a pl/sql procedure that checks the remote db?

Hi all

I have one criticism PROD remote database I want to check every 10 minutes for its connectivity. If the connection fails then an email and a text Message is sent to me.
My question is what is the best way to check if the remote database is running?

Can I use sqlplus system/manager@PROD? But sometimes this has taken so long and suspended. I want the best response time?

How can I write a pl/sql procedure control connection? What do something like the ff:

I created a table for my tnsname.ora entries.
cursor is c1 select dbname from tnsnames_tbl;
begin
    connect system/[email protected];
    print c1.dbname || 'DB Connection OK';
    exception
       when others;
        print c1.dbname || 'DB Connection Not OK';
    end;
end;
Something like that?

Thank you
Kinz

Not really feasible at the level of PL/SQL.

The reason is that the greatest strength of TCP's robustness. TCP will try as hard as possible to succeed, before failing. It was designed to still work on the severely damaged or broken communication as a result of nuclear infrastructure. A TCP connection can take up to 15 minutes, maybe even more, before failing. It can be as slow as a turtle-, but he's wearing a hardshell. (unlike the UDP, which is the opposite)

So if you want to test the TCP connectivity, you must design your own custom code to implement your assumptions about the latency of packets, earthquakes and drops and so on.

Otherwise, you will need to use a standard TCP socket, set a time limit, try to login - and hope for the best.

This approach, I have demonstrated in {message identifier: = 10111306}.

If the TCP test works, it means that the listener is in place. Does not mean that the database itself is in place. Which means then using a database link to be tested. And this in turn can hang due to problems with archive record being stuck, not enough idle servers shared, etc..

Tags: Database

Similar Questions

  • How to write a hierarchical query so that only the child nodes are displayed?

    Hi all

    I have a hierarchical query that I use in an area of tree demand APEX and there are nodes that have no children and I am trying to find a way to not display these nodes. Essentially if the user does not have to develop a lot of knots to know that nothing exists at the most detailed level.

    The data are based on the Oracle Fusion FND tables but for example purposes here is enough data to illustrate my question:


    create table APPL_TAXONOMY_HIERARCHY (SOURCE_MODULE_ID varchar2(30), TARGET_MODULE_ID varchar2(30));
    create table APPL_TAXONOMY_TL (module_id varchar2(30), description varchar2(100), user_module_name varchar2(30), language varchar2(5));
    create table APPL_TAXONOMY (MODULE_ID    varchar2(30),    MODULE_NAME    varchar2(30), MODULE_TYPE varchar2(10),    MODULE_KEY varchar2(30));
    create table TABLES (table_name varchar2(30), module_key varchar2(30));
    
    

    insert into APPL_TAXONOMY_TL values ('1', null, 'Oracle Fusion', 'US' );
    insert into APPL_TAXONOMY_TL values ('2', null, 'Financials', 'US' );
    insert into APPL_TAXONOMY_TL values ('3', null, 'Human Resources', 'US' );
    insert into APPL_TAXONOMY_TL values ('20', null, 'Accounts Payable', 'US' );
    insert into APPL_TAXONOMY_TL values ('10', null, 'General Ledger', 'US' );
    
    insert into APPL_TAXONOMY_HIERARCHY values ('1', 'DDDDDDDD');
    insert into APPL_TAXONOMY_HIERARCHY values ('2', '1');
    insert into APPL_TAXONOMY_HIERARCHY values ('3', '1');
    insert into APPL_TAXONOMY_HIERARCHY values ('4', '1');
    insert into APPL_TAXONOMY_HIERARCHY values ('10', '2');
    insert into APPL_TAXONOMY_HIERARCHY values ('20', '2');
    
    insert into APPL_TAXONOMY values ('1', 'Fusion', 'PROD', 'Fusion');
    insert into APPL_TAXONOMY values ('2', 'Financials', 'FAMILY', 'FIN');
    insert into APPL_TAXONOMY values ('10', 'GL', 'APP', 'GL');
    insert into APPL_TAXONOMY values ('3', 'Human Resources', 'FAMILY', 'HR');
    insert into APPL_TAXONOMY values ('20', 'AP', 'APP', 'AP');
    
    insert into tables values ('GL_JE_SOURCES_TL','GL');
    insert into tables values ('GL_JE_CATEGORIES','GL');
    

    My hierarchical query is as follows:

    with MODULES as
    (
    SELECT h.source_module_id, b.user_module_name, h.target_module_id
          FROM APPL_TAXONOMY_HIERARCHY H,
          APPL_TAXONOMY_TL B,
    APPL_TAXONOMY VL
    where H.source_module_id = b.module_id
    and b.module_id = vl.module_id
    and vl.module_type not in ('PAGE', 'LBA')
    UNION ALL
    select distinct table_name, table_name,  regexp_substr(table_name,'[^_]+',1,1) 
    from TABLES --needed as a link between TABLES and APPL_TAXONOMY
    union all
    select module_key as source_module_id, module_name as user_module_name, module_id as target_module_id  from appl_taxonomy VL where VL.module_type = 'APP')
    SELECT  case when connect_by_isleaf = 1 then 0
                when level = 1             then 1
                else                           -1
           end as status,
    LEVEL,
    user_module_name as title,
    null as icon,
    ltrim(user_module_name, ' ') as value,
    null as tooltip,
    null as link
          FROM MODULES
          START WITH source_module_id = '1'
          CONNECT BY PRIOR source_module_id = target_module_id
    ORDER SIBLINGS BY user_module_name;
    

    In Oracle APEX, this gives a tree with the appropriate data, you can see here:

    https://Apex.Oracle.com/pls/Apex/f?p=32581:29 (username: guest, pw: app_1000);

    The SQL of the query results are:

    STATUSTITLE LEVELVALUE

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

    11 oracle FusionOracle Fusion
    -12 financial tablesFinancials
    -13 accounts payableAccounts payable
    04 APAP
    -1General Accounting 3General Accounting
    -14 GLGL
    05 GL_JE_CATEGORIESGL_JE_CATEGORIES
    05 GL_JE_SOURCES_TLGL_JE_SOURCES_TL
    02 human resourcesHuman resources

    The lowest level is the name of the table to level 5. HR is not any level under level 2, in the same way, "AP" (level 4) has nothing below, i.e. no level 5 and that's why I don't want to show these nodes. Is this possible with the above query?

    Thanks in advance for your suggestions!

    John

    Hello

    The following query will include only the nodes of level = 5 and their ancestors (or descendants):

    WITH modules LIKE

    (

    SELECT h.source_module_id

    b.user_module_name AS the title

    h.target_module_id

    To appl_taxonomy_hierarchy:

    appl_taxonomy_tl b

    appl_taxonomy vl

    WHERE h.source_module_id = b.module_id

    AND b.module_id = vl.module_id

    AND vl.module_type NOT IN ('PAGE', "LBA")

    UNION ALL

    SELECT DISTINCT

    table-name

    table_name

    , REGEXP_SUBSTR (table_name, ' [^ _] +')

    From the tables - required as a link between the TABLES and APPL_TAXONOMY

    UNION ALL

    SELECT module_key AS source_module_id

    AS user_module_name module_name

    module_id AS target_module_id

    Of appl_taxonomy vl

    WHERE vl.module_type = 'APP '.

    )

    connect_by_results AS

    (

    SELECT THE CHECK BOX

    WHEN CONNECT_BY_ISLEAF = 1 THEN 0

    WHEN LEVEL = 1 THEN 1

    OF ANOTHER-1

    The END as status

    LEVEL AS lvl

    title

    -, NULL AS icon

    , LTRIM (title, "") AS the value

    -, NULL as ToolTip

    -, Link AS NULL

    source_module_id

    SYS_CONNECT_BY_PATH (source_module_id - or something unique

    , ' ~' - or anything else that may occur in the unique key

    ) || ' ~' AS the path

    ROWNUM AS sort_key

    Modules

    START WITH source_module_id = '1'

    CONNECT BY PRIOR Source_module_id = target_module_id

    Brothers and SŒURS of ORDER BY title

    )

    SELECT the status, lvl, title, value

    -, icon, tooltip, link

    OF connect_by_results m

    WHEN THERE IS)

    SELECT 1

    OF connect_by_results

    WHERE the lvl = 5

    AND the path AS ' % ~' | m.source_module_id

    || '~%'

    )

    ORDER BY sort_key

    ;

    You may notice that subqueries modules and the connect_by_results are essentially what you've posted originally.  What was the main request is now called connect_by_results, and it has a couple of additional columns that are necessary in the new main request or the EXISTS subquery.

    However, I am suspicious of the 'magic number' 5.  Could you have a situation where the sheets you are interested in can be a different levels (for example, some level = 5 and then some, into another branch of the tree, at the LEVEL = 6, or 7 or 4)?  If so, post an example.  You have need of a Query of Yo-Yo, where you do a bottom-up CONNECT BY query to get the universe of interest, and then make a descendant CONNECT BY query on this set of results.

  • How to make an alarm in VeriStand that checks the specific value?

    I need the alarm is triggered when the string value is 0x2C and only 0x2C.

    Creating calculated a channel, then select "Conditional" in the drop-down list.  The condition of '=' to compare your channel to a constant value.  The calculated channel will be 0 when the condition is false, and 1 when it is true.  You can then create an alarm based on the calculated string you created.

    Hope that helps!

  • How to write a query to return rows with the varchar column that contains even a single occurrence of the characters, such as Ÿ and

    How to write a query to return rows with the varchar column that contains even a single occurrence of the characters, such as Ÿ and

    I have a table whose columns with values such as

    MINNEAŸPOLIS and ¿VV ¿A

    Only the characters that are allowed in this column are alphabets, numbers, spaces, points and supports.

    Please help to write a SQL SELECT with Regexp_like query or any other option.

    Thanks to you all! Under query worked for me. Thank you Frank to explain the concept of hooks inside regexp_like.

    SELECT * FROM testspecial, WHERE REGEXP_LIKE (sampletext, "[^] ^ A - Z ^ a - z ^ 0-9 ^ [^.]") ^ {^} ^]') ;

  • How to write a simple select query to get the data of the table as an XML.

    How to write a simple select query to get the data of the table as an XML. In the query, I'm just adding items below which i need be there in the XML document
    select '<test_tag>'||EMP_NAME||'</test_tag>','<date>'||sysdate||'</date>' 
    from temp_table where id_num BETWEEN 1 AND 10;
    I have need to add the root tag as well in the beginning and the end of < root > < / root > this xml file. Please advice if this is possible with the select query
    without using XMLGEN, XMLQUERY or any other packages built and function?

    I need to URL escapes with the UTF-8 code points that we have already achieved using the utl_http package. Please help how to do that without using the utl_http package.

    What is wrong with him?

    At present, the only way I can think of to avoid a call to UTL_HTTP. SET_BODY_CHARSET is to write your own little wrapper.
    In this way, you can specify the Boolean parameter or omit it if you choose to use named parameters:

    SQL> create or replace function my_url_escape (url in varchar2)
      2  return varchar2
      3  deterministic
      4  is
      5  begin
      6   return utl_url.escape(url, false, 'AL32UTF8');
      7  end;
      8  /
    
    Function created
    
    SQL> select my_url_escape('http://some.uri.com/param?lang=fr&text=contrôle') from dual;
    
    MY_URL_ESCAPE('HTTP://SOME.URI
    --------------------------------------------------------------------------------
    http://some.uri.com/param?lang=fr&text=contr%C3%B4le
     
    
  • sql statement that activates the trigger to capture

    Hello

    I'm trying to enter the sql code that activates the trigger with this procedure:

    CREATE OR REPLACE TRIGGER t_trg
    after insert or update
    on the manikin
    for each line
    declare
    long p_stmt;
    sql_lines directory.
    MSG VARCHAR2 (32000);
    Return VARCHAR2 (2): = Chr (13).
    triggering_sql dbms_standard.ora_name_list_t;

    Start
    -get the SQL trigger
    sql_lines: = sql_txt (triggering_sql);
    FOR loop_counter IN triggering_sql. FIRST... triggering_sql. LAST
    LOOP
    -Add the SQL trigger to the message
    MSG: = msg | triggering_sql (loop_counter) | line feed;
    END LOOP;

    Insert into values dummy2 (msg) (cad);
    end t_trg;

    but...

    ORA-06531: Referencia a una recopilacion no inicializada
    ORA-06512: en "TRASPASO. T_TRG ', line 11.
    ORA-04088: error during the run "TRASPASO del disparador. T_TRG'

    Kind regards
    Daniel

    PD. Sorry for my bad English

    Published by: user10660485 on 30 / abr / 2010 0:35

    What is your version of the database? There is a bug with this statement. However, you can try the following

    CREATE OR REPLACE TRIGGER EMP_TRG1
    BEFORE UPDATE ON EMPLOYEES
    declare
    v_num NUMBER;
    sql_stmt varchar2(2000);
    sql_text ora_name_list_t;
    BEGIN
    v_num:=ora_sql_txt(sql_text);
    FOR i in 1..NVL(v_num,0) LOOP
    sql_stmt:=sql_stmt||sql_text(i);
    END LOOP;
    INSERT INTO EMP_LOG VALUES(sql_stmt);
    --dbms_output.put_line(sql_stmt);
    END;
    

    In my database to Oracle Database 10g Express Edition Release 10.2.0.1.0 that it always returns the value null;
    For more information, please visit http://www.orafaq.com/forum/t/68667/2/

  • How to write a script for date get to the Clipboard

    Hi experts,

    How to write a script for date get to the Clipboard.

    the date format will be like this:

    05 - may

    respect of

    John

    Thanks guys, thanks Sanon

    I finally use the .bat doc

    like this:

    @@echo off
    for /f "delims =" % in (' wmic OS Get localdatetime ^ | find ".") "") Set "dt = %% a"
    the value "YYYY = % dt: ~ 0, 4%.
    the value "MM = % dt: ~ 4, 2%.

    If MM % is 01 set MM = January
    If % MM == 02 set MM = February
    If MM % is MM value = March 03
    If MM % is 04 MM value = April
    If MM % is 05 MM value = may
    If MM % is 06 MM value = June
    If MM % == 07 set MM = July
    If MM % is MM value = August 08
    If MM % is MM value = September 09
    If MM % is 10 MM value = October
    If MM % is 11A set MM = November
    If MM % is game MM 12 = December

    the value "DD = % dt: ~ 6, 2%.
    the value "HH = % dt: ~ 8, 2%.
    the value "Min = % dt: ~ 10, 2%.
    Set "s = % dt: ~ 12, 2%.

    Echo DD - MM HH % %% % Min | Clip

    It works

    respect of

    John

  • How to expose a pl/sql procedure via slot shape of apex

    Hi gurus

    I have a form that is create from a procedure.

    I put the auth to pubic_user if it is available to the public.

    So now I need is to know how to find a way to imitate the button submit and draw the corresponding URL

    while I can expose my PL/SQL via a URL through apex procedure.

    I have attached a screenshot of my form

    Thx for all the help.

    Here's the URL of my pl/sql

    https://Apex.Oracle.com/pls/Apex/f?p=30141:1:5404118417577:

    and I look at the code with tool from dev on chrome for the Send button

    If only show.

    < a href = "javascript:apex.submit ('SUBMIT'); "class ="uButton"id ="B67074418713946955629"role ="button"> < span > Submit </span > < /a >

    So how do I know what return? Thx for all the help

    expose_plsql_via_apex.JPG

    Hi Kazuneric,

    kazuneric wrote:

    https://Apex.Oracle.com/pls/Apex/sdev.verify_user?p_user=Spring9111&P_Code=E7FB725F11A62BAFDCFB28C30653B72B

    I intend to pass the parameter in the URL for a user to click through

    You will find the following useful threads:

    Call a rendering of APEX (EPG) form of procedure within the error

    403 Forbidden error URL the PL/SQL procedure call

    I hope this helps!

    Kind regards

    Kiran

  • How to write expressions/rules/SQL workflow

    Hi all.

    We are recent users of CRM onDemand, we would write a few workflow rules, but can't seem to find all the information on how to do it. The help section is limited in the responses, and some of the issues here are not as specific in what we do.

    Someone has any advice on books, websites, etc. on where to find the knowledge we need on how to write workflow rules and the use of SQL and expressions in CRM on Demand?

    Thanks in advance!

    For your first case:
    1. you cannot create a workflow in r15 for activity but you can in R16

    Create new to create a workflow
    Name: Auto email send
    registration type: activity
    trigger: when the new record
    rules: put your rules by clicking the fx icon IE this is where you enter the rule by saying that the owner is different from the person who creates the activity or the delegate field is filled (another way of seeing things)
    then save the workflow

    In the section actions
    Choose the action 'create e-mail notifications '.
    In the: Section choose "Registration of the user on Relative" and "owner of the activity.

    Save it. Make sure that the activity and workflow are marked active.

    2. in the second scenario:
    How do you create an account and to automatically fill in the name of the sales of the sale - don't know
    But you can create a fill of opportunity and self with the name of the owner of the account using this validation in the field (you need not the workflow), you can use the FieldValueJoin function.

    Hope this helps - btb there's no book you can go thro the help and you will find some directions

  • The display of an image defined in an external PLSQL procedure that renders the code HTML and called in a region of the APEX

    I have an external PLSQL procedure that dynamically creates a report out of the HTML tags that I then called an anonymous block APEX PLSQL.  I'm making bad images with the following code:
    in the external procedure.  How do you get around that? (NOTE: the procedure is too big to store directly in the APEX)

    ....

    ' < style td = "width: auto;" "padding: 0px 5px 0px ' > '. spc_rec. SPC_VIABILITY_STATUS. "< table > ' |

    "< style td =" width: auto; " text-align: left; "padding: 0px 5px 0px" > ' | spc_rec. SPC_VIABILITY_REASON. "< table > ' |

    TD > < img src = "" #IMAGE_PREFIX #check2.gif "alt =" "/ > < table > '"

    ....

    Thanks in advance

    PaulP

    Hi Paul,.

    You can use the global variable of the APEX package below to get the image prefix in pl/sql. Of course, your procedure should be in APEX, schema analysis application.

    APEX_APPLICATION. G_IMAGE_PREFIX

    Kind regards

    Hari

  • Creating a PL/SQL procedure to run the following code but the landing upwards errors!

    Hey all!

    This is my first time with PL/SQL. I created the following procedure to load a major part of the update instructions at the same time to read the DB performance. I need to print a sysdate timestamp before and after the load so that I can know how long it takes for the DB update prescribed lines. I gave 100 lines initially and will keep changing. When I run this code, I came across some errors. Could you please help me with it.

    CODE:

    PROCEDURE FACT_UPDATE
    IS
    DECLARE
    CNT NUMBER: = 0;

    UPD CURSOR is
    SELECT
    'UPDATE XXAFL_MON_FACTS_F SET TASK_WID =' | NVL (TO_CHAR (TASK_WID), 'NULL') |', EXECUTION_PLAN_WID =' | NVL (TO_CHAR (EXECUTION_PLAN_WID), 'NULL').
    ', DETAILS_WID =' | NVL (TO_CHAR (DETAILS_WID), 'NULL') |', SOURCE_WID =' | NVL (TO_CHAR (SOURCE_WID), 'NULL') |', TARGET_WID = ' | NVL (TO_CHAR (TARGET_WID), 'NULL').
    ', RUN_STATUS_WID =' | NVL (TO_CHAR (RUN_STATUS_WID), 'NULL') |', SEQ_NUM =' | NVL (TO_CHAR (SEQ_NUM), 'NULL') |', NAME = "' | NVL (TO_CHAR (NAME), 'NULL').
    "', NO_POSITION =" ' | NVL (TO_CHAR (INSTANCE_NUM), e ') | " ', INSTANCE_NAME = "' | NVL (TO_CHAR (INSTANCE_NAME), 'NULL').
    "', TYPE_CD =" ' | NVL (TO_CHAR (TYPE_CD), e ') | " ', STATUS_CD = "' | NVL (TO_CHAR (STATUS_CD), e ') | " ', START_TS =' | Decode (START_TS, null, "to_date('''|| to_char (START_TS,' jj/mm/aaaa hh) |")) ((', "dd/mm/yyyy hh")').
    ', END_TS =' | Decode (END_TS, null, "to_date('''|| to_char (END_TS,' jj/mm/aaaa hh) |")) ((', "dd/mm/yyyy hh")') |', DURATION = ' | NVL (TO_CHAR (DURATION), 'NULL') |', STATUS_DESC = "' | NVL (TO_CHAR (STATUS_DESC), 'NULL').
    "', DBCONN_NAME =" ' | NVL (TO_CHAR (DBCONN_NAME), e ') | " ', SUCESS_ROWS =' | NVL (TO_CHAR (SUCESS_ROWS), 'NULL').
    ', FAILED_ROWS =' | NVL (TO_CHAR (FAILED_ROWS), 'NULL') |', ERROR_CODE = ' | NVL (TO_CHAR (ERROR_CODE), 'NULL') |', NUM_RETRIES =' | NVL (TO_CHAR (NUM_RETRIES), 'NULL').
    ', READ_THRUPUT =' | NVL (TO_CHAR (READ_THRUPUT), 'NULL') |', LAST_UPD = ' | Decode (LAST_UPD, null, "to_date('''|| to_char (LAST_UPD,' jj/mm/aaaa hh) |")) ((', "dd/mm/yyyy hh")') |', RUN_STEP_WID = "' | NVL (TO_CHAR (RUN_STEP_WID), 'NULL').
    "', W_INSERT_DT = ' | Decode (W_INSERT_DT, null, "to_date('''|| to_char (W_INSERT_DT,' jj/mm/aaaa hh) |")) ((', "dd/mm/yyyy hh")') |', W_UPDATE_DT = ' | Decode (W_UPDATE_DT, null, "to_date('''|| to_char (W_UPDATE_DT,' jj/mm/aaaa hh) |")) ((', "dd/mm/yyyy hh")').
    ', START_DATE_WID =' | NVL (TO_CHAR (START_DATE_WID), 'NULL') |', END_DATE_WID = ' | NVL (TO_CHAR (END_DATE_WID), 'NULL') |', START_TIME =' |
    NVL (TO_CHAR (START_TIME), 'NULL') |', END_TIME =' | NVL (TO_CHAR (END_TIME), 'NULL'). "WHERE INTEGRATION_ID ="' | INTEGRATION_ID | " « ; » AS a Column OF XXAFL_MON_FACTS_F;

    BEGIN
    dbms_output.put_line (sysdate);
    to record in a loop of the UPD

    dbms_output.put_line (record.col_name);
    immediately run record.col_name;

    CNT: = cnt + 1;
    If cnt > 1000
    and then commit;
    CNT: = 0;
    dbms_output.put_line (sysdate);
    end if;
    end loop;
    dbms_output.put_line (sysdate);


    END; -Procedure

    ERRORS:

    Error starting line: 1 at the controls.
    PROCEDURE FACT_UPDATE
    Error report-
    Unknown command

    Error from line: 2 in command.
    IS
    Error report-
    Unknown command
    Error from line: 3 in command.
    DECLARE
    CNT: = 0;

    UPD CURSOR is
    SELECT
    'UPDATE XXAFL_MON_FACTS_F SET TASK_WID =' | NVL (TO_CHAR (TASK_WID), 'NULL') |', EXECUTION_PLAN_WID =' | NVL (TO_CHAR (EXECUTION_PLAN_WID), 'NULL').
    ', DETAILS_WID =' | NVL (TO_CHAR (DETAILS_WID), 'NULL') |', SOURCE_WID =' | NVL (TO_CHAR (SOURCE_WID), 'NULL') |', TARGET_WID = ' | NVL (TO_CHAR (TARGET_WID), 'NULL').
    ', RUN_STATUS_WID =' | NVL (TO_CHAR (RUN_STATUS_WID), 'NULL') |', SEQ_NUM =' | NVL (TO_CHAR (SEQ_NUM), 'NULL') |', NAME = "' | NVL (TO_CHAR (NAME), 'NULL').
    "', NO_POSITION =" ' | NVL (TO_CHAR (INSTANCE_NUM), e ') | " ', INSTANCE_NAME = "' | NVL (TO_CHAR (INSTANCE_NAME), 'NULL').
    "', TYPE_CD =" ' | NVL (TO_CHAR (TYPE_CD), e ') | " ', STATUS_CD = "' | NVL (TO_CHAR (STATUS_CD), e ') | " ', START_TS =' | Decode (START_TS, null, "to_date('''|| to_char (START_TS,' jj/mm/aaaa hh) |")) ((', "dd/mm/yyyy hh")').
    ', END_TS =' | Decode (END_TS, null, "to_date('''|| to_char (END_TS,' jj/mm/aaaa hh) |")) ((', "dd/mm/yyyy hh")') |', DURATION = ' | NVL (TO_CHAR (DURATION), 'NULL') |', STATUS_DESC = "' | NVL (TO_CHAR (STATUS_DESC), 'NULL').
    "', DBCONN_NAME =" ' | NVL (TO_CHAR (DBCONN_NAME), e ') | " ', SUCESS_ROWS =' | NVL (TO_CHAR (SUCESS_ROWS), 'NULL').
    ', FAILED_ROWS =' | NVL (TO_CHAR (FAILED_ROWS), 'NULL') |', ERROR_CODE = ' | NVL (TO_CHAR (ERROR_CODE), 'NULL') |', NUM_RETRIES =' | NVL (TO_CHAR (NUM_RETRIES), 'NULL').
    ', READ_THRUPUT =' | NVL (TO_CHAR (READ_THRUPUT), 'NULL') |', LAST_UPD = ' | Decode (LAST_UPD, null, "to_date('''|| to_char (LAST_UPD,' jj/mm/aaaa hh) |")) ((', "dd/mm/yyyy hh")') |', RUN_STEP_WID = "' | NVL (TO_CHAR (RUN_STEP_WID), 'NULL').
    "', W_INSERT_DT = ' | Decode (W_INSERT_DT, null, "to_date('''|| to_char (W_INSERT_DT,' jj/mm/aaaa hh) |")) ((', "dd/mm/yyyy hh")') |', W_UPDATE_DT = ' | Decode (W_UPDATE_DT, null, "to_date('''|| to_char (W_UPDATE_DT,' jj/mm/aaaa hh) |")) ((', "dd/mm/yyyy hh")').
    ', START_DATE_WID =' | NVL (TO_CHAR (START_DATE_WID), 'NULL') |', END_DATE_WID = ' | NVL (TO_CHAR (END_DATE_WID), 'NULL') |', START_TIME =' |
    NVL (TO_CHAR (START_TIME), 'NULL') |', END_TIME =' | NVL (TO_CHAR (END_TIME), 'NULL'). "WHERE INTEGRATION_ID ="' | INTEGRATION_ID | " « ; » AS a Column OF XXAFL_MON_FACTS_F;

    BEGIN
    dbms_output.put_line (sysdate);
    to record in a loop of the UPD

    dbms_output.put_line (record.col_name);
    immediately run record.col_name;

    CNT: = cnt + 1;
    If cnt > 1000
    and then commit;
    CNT: = 0;
    dbms_output.put_line (sysdate);
    end if;
    end loop;
    dbms_output.put_line (sysdate);


    END; -Procedure
    Error report-
    ORA-06550: line 2, column 6:
    PLS-00103: encountered the symbol "=" when expecting one of the following conditions:

    constant exception < an ID >
    < a between double quote delimited identifiers > double long Ref table
    char time timestamp interval date binary national character
    NCHAR
    The symbol '< identifier >' has been substituted for "=" continue.
    06550 00000 - "line %s, column % s:\n%s".
    * Cause: Usually a PL/SQL compilation error.
    * Action:
    Error starting line: 1 at the controls.
    PROCEDURE FACT_UPDATE
    Error report-
    Unknown command

    Error from line: 2 in command.
    IS
    Error report-
    Unknown command
    Error from line: 3 in command.
    DECLARE
    CNT NUMBER: = 0;

    UPD CURSOR is
    SELECT
    'UPDATE XXAFL_MON_FACTS_F SET TASK_WID =' | NVL (TO_CHAR (TASK_WID), 'NULL') |', EXECUTION_PLAN_WID =' | NVL (TO_CHAR (EXECUTION_PLAN_WID), 'NULL').
    ', DETAILS_WID =' | NVL (TO_CHAR (DETAILS_WID), 'NULL') |', SOURCE_WID =' | NVL (TO_CHAR (SOURCE_WID), 'NULL') |', TARGET_WID = ' | NVL (TO_CHAR (TARGET_WID), 'NULL').
    ', RUN_STATUS_WID =' | NVL (TO_CHAR (RUN_STATUS_WID), 'NULL') |', SEQ_NUM =' | NVL (TO_CHAR (SEQ_NUM), 'NULL') |', NAME = "' | NVL (TO_CHAR (NAME), 'NULL').
    "', NO_POSITION =" ' | NVL (TO_CHAR (INSTANCE_NUM), e ') | " ', INSTANCE_NAME = "' | NVL (TO_CHAR (INSTANCE_NAME), 'NULL').
    "', TYPE_CD =" ' | NVL (TO_CHAR (TYPE_CD), e ') | " ', STATUS_CD = "' | NVL (TO_CHAR (STATUS_CD), e ') | " ', START_TS =' | Decode (START_TS, null, "to_date('''|| to_char (START_TS,' jj/mm/aaaa hh) |")) ((', "dd/mm/yyyy hh")').
    ', END_TS =' | Decode (END_TS, null, "to_date('''|| to_char (END_TS,' jj/mm/aaaa hh) |")) ((', "dd/mm/yyyy hh")') |', DURATION = ' | NVL (TO_CHAR (DURATION), 'NULL') |', STATUS_DESC = "' | NVL (TO_CHAR (STATUS_DESC), 'NULL').
    "', DBCONN_NAME =" ' | NVL (TO_CHAR (DBCONN_NAME), e ') | " ', SUCESS_ROWS =' | NVL (TO_CHAR (SUCESS_ROWS), 'NULL').
    ', FAILED_ROWS =' | NVL (TO_CHAR (FAILED_ROWS), 'NULL') |', ERROR_CODE = ' | NVL (TO_CHAR (ERROR_CODE), 'NULL') |', NUM_RETRIES =' | NVL (TO_CHAR (NUM_RETRIES), 'NULL').
    ', READ_THRUPUT =' | NVL (TO_CHAR (READ_THRUPUT), 'NULL') |', LAST_UPD = ' | Decode (LAST_UPD, null, "to_date('''|| to_char (LAST_UPD,' jj/mm/aaaa hh) |")) ((', "dd/mm/yyyy hh")') |', RUN_STEP_WID = "' | NVL (TO_CHAR (RUN_STEP_WID), 'NULL').
    "', W_INSERT_DT = ' | Decode (W_INSERT_DT, null, "to_date('''|| to_char (W_INSERT_DT,' jj/mm/aaaa hh) |")) ((', "dd/mm/yyyy hh")') |', W_UPDATE_DT = ' | Decode (W_UPDATE_DT, null, "to_date('''|| to_char (W_UPDATE_DT,' jj/mm/aaaa hh) |")) ((', "dd/mm/yyyy hh")').
    ', START_DATE_WID =' | NVL (TO_CHAR (START_DATE_WID), 'NULL') |', END_DATE_WID = ' | NVL (TO_CHAR (END_DATE_WID), 'NULL') |', START_TIME =' |
    NVL (TO_CHAR (START_TIME), 'NULL') |', END_TIME =' | NVL (TO_CHAR (END_TIME), 'NULL'). "WHERE INTEGRATION_ID ="' | INTEGRATION_ID | " « ; » AS a Column OF XXAFL_MON_FACTS_F;

    BEGIN
    dbms_output.put_line (sysdate);
    to record in a loop of the UPD

    dbms_output.put_line (record.col_name);
    immediately run record.col_name;

    CNT: = cnt + 1;
    If cnt > 1000
    and then commit;
    CNT: = 0;
    dbms_output.put_line (sysdate);
    end if;
    end loop;
    dbms_output.put_line (sysdate);


    END; -Procedure
    Error report-
    ORA-00911: invalid character
    ORA-06512: at line 24
    00911 00000 - "invalid character".
    * Cause: identifiers may not start with any character other than ASCII
    letters and numbers.  $# _ are allowed after the first
    character.  May contain identifiers surrounded by doublequotes
    any character other than a quotation mark.  Other quotes
    (q' #... #') cannot use spaces, tabs or as carriage returns
    delimiters.  For all other settings, consult the SQL language
    Reference manual.
    * Action:

    In addition to the other reviews, and apart from the quality of the code, you should really (really!) learn how to format your code for better "read-ability.  This will also contribute to a better quality.  If you are unsure how to format, then use a development as a SQL developer tool.  It will not format "as you type", but a frequent use of the shortened format keyboard (Ctrl + F7 in SQL Dev) will keep your code readable and coherent.

    And then you learn to keep this format when you post on the forum.

    Like this:

    PROCEDURE FACT_UPDATE

    IS

    DECLARE

    CNT NUMBER: = 0;

    CURSOR UPD

    IS

    SELECT "UPDATE XXAFL_MON_FACTS_F SET TASK_WID ='"

    || NVL (TO_CHAR (TASK_WID), 'NULL')

    |', EXECUTION_PLAN_WID ='

    || NVL (TO_CHAR (EXECUTION_PLAN_WID), 'NULL')

    || ', DETAILS_WID ='

    || NVL (TO_CHAR (DETAILS_WID), 'NULL')

    |', SOURCE_WID ='

    || NVL (TO_CHAR (SOURCE_WID), 'NULL')

    |', TARGET_WID = '

    || NVL (TO_CHAR (TARGET_WID), 'NULL')

    || ', RUN_STATUS_WID ='

    || NVL (TO_CHAR (RUN_STATUS_WID), 'NULL')

    |', SEQ_NUM ='

    || NVL (TO_CHAR (SEQ_NUM), 'NULL')

    |', NAME = "'

    || NVL (TO_CHAR (NAME), 'NULL')

    || ' ', NO_POSITION = "'

    || NVL (TO_CHAR (INSTANCE_NUM), 'NULL')

    ||'' ', INSTANCE_NAME = "'

    || NVL (TO_CHAR (INSTANCE_NAME), 'NULL')

    || ' ', TYPE_CD = "'

    || NVL (TO_CHAR (TYPE_CD), 'NULL')

    ||'' ', STATUS_CD = "'

    || NVL (TO_CHAR (STATUS_CD), 'NULL')

    ||'' ', START_TS ='

    || DECODE (START_TS, ",' to_date(''e))

    || To_char (START_TS, "mm/dd/yyyy hh)

    ||'' ((', "dd/mm/yyyy hh")')

    || ', END_TS ='

    || DECODE (END_TS, ",' to_date(''e))

    || To_char (END_TS, "mm/dd/yyyy hh)

    ||'' ((', "dd/mm/yyyy hh")')

    |', DURATION = '

    || NVL (TO_CHAR (DURATION), 'NULL')

    |', STATUS_DESC = "'

    || NVL (TO_CHAR (STATUS_DESC), 'NULL')

    || ' ', DBCONN_NAME = "'

    || NVL (TO_CHAR (DBCONN_NAME), 'NULL')

    ||'' ', SUCESS_ROWS ='

    || NVL (TO_CHAR (SUCESS_ROWS), 'NULL')

    || ', FAILED_ROWS ='

    || NVL (TO_CHAR (FAILED_ROWS), 'NULL')

    |', ERROR_CODE = '

    || NVL (TO_CHAR (ERROR_CODE), 'NULL')

    |', NUM_RETRIES ='

    || NVL (TO_CHAR (NUM_RETRIES), 'NULL')

    || ', READ_THRUPUT ='

    || NVL (TO_CHAR (READ_THRUPUT), 'NULL')

    |', LAST_UPD = '

    || DECODE (LAST_UPD, ",' to_date(''e))

    || To_char (LAST_UPD, "mm/dd/yyyy hh)

    ||'' ((', "dd/mm/yyyy hh")')

    |', RUN_STEP_WID = "'

    || NVL (TO_CHAR (RUN_STEP_WID), 'NULL')

    || ' ', W_INSERT_DT = '

    || DECODE (W_INSERT_DT, ",' to_date(''e))

    || To_char (W_INSERT_DT, "mm/dd/yyyy hh)

    ||'' ((', "dd/mm/yyyy hh")')

    |', W_UPDATE_DT = '

    || DECODE (W_UPDATE_DT, ",' to_date(''e))

    || To_char (W_UPDATE_DT, "mm/dd/yyyy hh)

    ||'' ((', "dd/mm/yyyy hh")')

    || ', START_DATE_WID ='

    || NVL (TO_CHAR (START_DATE_WID), 'NULL')

    |', END_DATE_WID = '

    || NVL (TO_CHAR (END_DATE_WID), 'NULL')

    |', START_TIME ='

    || NVL (TO_CHAR (START_TIME), 'NULL')

    |', END_TIME ='

    || NVL (TO_CHAR (END_TIME), 'NULL')

    ||' WHERE INTEGRATION_ID = "'

    || INTEGRATION_ID

    ||''';' AS Column

    OF XXAFL_MON_FACTS_F;

    BEGIN

    dbms_output.put_line (sysdate);

    FOR registration in UPD

    LOOP

    dbms_output.put_line (record.col_name);

    EXECUTE immediate record.col_name;

    CNT: = cnt + 1;

    IF cnt > 1000 THEN

    COMMIT;

    CNT: = 0;

    dbms_output.put_line (sysdate);

    END IF;

    END LOOP;

    dbms_output.put_line (sysdate);

    END; -Procedure

  • Help, please! PL/SQL procedure to count the character more occurent

    Hi guys,.

    I'm new in pl/sql and I need your expertise for the solution of the following problem:

    I have a string, for example: ' Hello, world! " How are you today? "and I wonder to find the character that occurs the most in this chain.

    Do you have any idea how to understand? I guess I should use a PL/SQL procedure.

    Thank you very much!

    Welcome to the forum!

    something like

    select *
      from (
    select ltr, count(*)
    from (
    select substr (str, rownum, 1) ltr
      from (select replace (str, ' ') str
             from test
           )
     connect by level <= length (str)
    )
    group by ltr
    order by count(*) desc
    )
     where rownum = 1
    

    as in

    SQL> with test as
      2  (select 'Hello, world! How are you today?' str from dual
      3  )
      4  select *
      5    from (
      6  select ltr, count(*)
      7  from (
      8  select substr (str, rownum, 1) ltr
      9    from (select replace (str, ' ') str
     10           from test
     11         )
     12   connect by level <= length (str)
     13  )
     14  group by ltr
     15  order by count(*) desc
     16  )
     17   where rownum = 1
     18  /
    
    LTR    COUNT(*)
    ---- ----------
    o             5
    
    SQL> 
    

    in Oracle 11 g, you can use REGEXP_COUNT

  • How I write more specific instruction of if at the same time!

    I'm trying to use an IF / formula of EELS in JavaScript for autopopulate a text field in a table, but I get a syntax error.

    Could someone please help?

    and I want to write a specific text on the cells of a table, but before I want to check if this cell was empty or not, if it's empty (this cell1.rawValue = 'text') silt must go in the cell 2 silt and piloted at the other. And so on.

    Tabel1

    1Yes
    2None

    tabel2 |

    cell1"text".
    cell2
    cell3
    cell4

    something close with that can help you understand me more: (it's not really in the code)

    If tabel1.rawValue = 1

    and if tabel2.cell1.rawValue is nothing then

    tabel2.cell1.RawValue = "text".

    on the other

    If tabel2.cell2.rawValue == null then

    tabel2.cell2.rawValue = "text".

    Silt

    If tabel2.cell3.rawValue == null then

    tabel2.cell3.rawValue = "text".

    Silt

    If tabel2.cell4.rawValue = null then

    tabel2.cell4.rawValue = "text".

    Silt

    {

    xfa.host.messageBox ("there is no space in the table!");

    }

    Thnak you! I wish you can help me!

    Hello

    before understanding in JavaScript syntax, there are databases, you need to understand with operators

    JavaScript operators:

    the use of "=" is to assign a value to the value of the left side of the operator (this operator should not be in an if statement)

    the use of "is" is to compare the 2 values

    for another explanation on operators, search for 'Operators JavaScript' on google

    JavaScript syntax:

    "then" is omitted in JavaScript and {} is used instead

    don't forget to put the end of line (semicolon) on each line (excluding statements (if, switch, otherwise ElseIf, etc...))

    If (tabel2.cell1.rawValue == null) {}

    tabel2.cell1.RawValue = 'text ';

    } Else if (tabel2.cell2.rawValue == null) {}

    tabel2.cell2.RawValue = 'text ';

    } Else if (tabel2.cell3.rawValue == null) {}

    tabel2. CELL3. RawValue = "text";

    } Else if (tabel2.cell4.rawValue == null) {}

    tabel2.cell4.RawValue = 'text ';

    } else {}

    xfa.host.messageBox ("there is no space in the table!");

    }

    To help you understand how to fix your JavaScript syntax, you can use the validator to syntax like, Esprima: validator for syntax

    More information on the syntax JavaScript can be found on google, W3Schools is a good start

    I hope this will help you!

  • SQL procedure to copy the data

    Hello

    I'm looking for an example of a stored procedure that captures data on the dblink and fill a local table, the update ONLY when a State has changed in the GENERAL_STATE column.

    Example of data of the remote server in the examples with explanation of the syntax will be really useful as I'm new to PL:

    IDATN_IDID_EXTNAMES-TYPEMANDATEGENERAL_STATEJOB_CLASSIND_JOB_STOPPED
    1000019971819911Initialization of the operational planJOBMANDATORY_PRIMARYHAS BEGUNcom.vanderlande.opm.bs.tasks.OperationalPlanInstantiationTask

    0

    Do not reinvent the wheel. Use the MATERIALISEE VIEW? Read documentation http://docs.oracle.com/cd/B28359_01/server.111/b28326/repmview.htm

  • When the tabs are right of the Firefox button, how you lesson their height must match that of the button?

    When Firefox is maximized, the empty space below the Firefox button is almost 1/3 height.

    About: config, I see entries to specify what the minimum and maximum width as "browser.tabs.tabMinWidth", but none for its height.

    The height of the tab is based on the built-in style rules. You can override the built-in style rules by adding new style rules in a file named userChrome.css or using the stylish accessory. (The advantage of using the Stylish extension, is that you don't need to restart Firefox to see the rules being applied, so you can experiment more quickly.) The tab that contains the text, icons and possibly a close button, it may take several rules to get the size of the way you like it. I saw a recipe in my quick search, but I'm sure you can find some good suggestions if you dig around.

Maybe you are looking for