Can we use DBMS_JOB.BROKEN IN PL/SQL CODE

HI
below is my code
CREATE OR REPLACE procedure dept_insert1 is
X NUMBER;
y number;
BROKEN_FLAG CHAR(1);
begin
Select count(*) into Y from dept1;
if y < 20 then
SELECT trim(BROKEN) INTO BROKEN_FLAG FROM USER_JOBS WHERE JOB='1517';
DBMS_OUTPUT.PUT_LINE ('FLAG.....'||BROKEN_FLAG);
IF BROKEN_FLAG='Y' THEN
DBMS_JOB.BROKEN(1517,FALSE);
DBMS_OUTPUT.PUT_LINE ('FLAG.....1'||BROKEN_FLAG);
DBMS_JOB.RUN(1517);
DBMS_OUTPUT.PUT_LINE ('FLAG.....2'||BROKEN_FLAG);
END IF;
for i in 1..5
loop
insert into dept1 values (i,'DEPT'||i,'India');
commit;
end loop;
end if;
DBMS_JOB.BROKEN(1517,TRUE);
End;
i have 2 jobs --
1st is validation job and second will excute if 1st compelete successfully.
so hw can we do that??
i did in following way --
i created 2nd job and load it then set broken flag is Y then i called that job in my 1st job ..above is my proc which i using in my 1st job.
but my 1st job fails every time and unable to broken flag =n for second job
Reply ASAP

1st is validation job and second will excute if 1st compelete successfully.
so hw can we do that??using DBMS_JOBs to implement this sort of workflow is rather difficult because it is hard to co-ordinate these things, being as how they are background processes and don't talk nicely with each other.
One way is to just have one job which calls a wrapping procedure which executes the procedure from the first job and then conditionally executes the code from the second job. This is the easiest way so I presume you have a good reason for not implementing things this way.
Alternatively you could build a progress tracking table. the code in the first job sets a status flag. The code in the second jobs checks this flag to determine whether to continue with its processing or abend.
Cheers, APC

Similar Messages

  • Can we use multiple "pivot_for_clauses" in 11g SQL PIVOT

    Can we use multiple "pivot_for_clauses" in 11g SQL PIVOT. Below SQL is an example of what I am trying to do - In this case instead of using JOIN, can I have three pivot_for_clauses in the same sql?
    SQL:
    MERGE INTO Test_1 dest
    USING (SELECT P1.company_id,trunc(sysdate) as load_date,num_logins,......
    FROM (SELECT company_id,action_type_id
    FROM Testauditinfo_1 where trunc(audit_date_time)=trunc(sysdate)-1) a
    PIVOT (count(action_type_id) FOR (action_type_id) IN ((1) as num_logins,(2) as num_logouts,(61) as
    num_logins_from_mobile_device,(16) as num_pref_changed,....)) P1
    JOIN
    (SELECT company_id,action_type_id,tx_type_id
    FROM Testauditinfo_1 where trunc(audit_date_time)=trunc(sysdate)-1) a
    PIVOT (count(action_type_id) FOR (action_type_id,tx_type_id) IN ((3,4) AS add_invoice, (4,4) AS
    edit_invoice,(3,3) as num_checks,(3,47) as num_paychecks,(3,7) as num_recvd_payments,(3,9) as num_bills,
    (3,35) as num_estimates,(3,46) as num_purchase_orders)) P2
    on P1.company_id=P2.company_id
    JOIN
    (SELECT company_id,action_type_id,list_type_id
    FROM Testauditinfo_1 where trunc(audit_date_time)=trunc(sysdate)-1) a
    PIVOT (count(action_type_id) FOR (action_type_id,list_type_id) IN ((3,2) AS num_items,(3,1) as
    num_accounts,(3,4) as num_employees,(3,6) as num_customers,(3,14) as num_memorized_reports)) P3
    on P2.company_id=P3.company_id
    left outer JOIN
    (SELECT company_id,create_date,count(*) as num_logos
    FROM qbo.companylogos_1 group by company_id,create_date having trunc(create_date)=trunc(sysdate)-1) P4
    on P3.company_id=P4.company_id
    ORDER BY P1.company_id) source
    ON ((dest.company_id = source.company_id) and (dest.load_date = source.load_date))WHEN MATCHED THEN
    UPDATE SET dest.num_items = source.num_items where 1=2
    WHEN NOT MATCHED THEN
    INSERT (dest.company_id,.....) values (source.company_id,.....);

    Maybe
    MERGE INTO Test_1 dest
    USING (SELECT P1.company_id,trunc(sysdate) as load_date,num_logins,......
             FROM (select *
                     from (SELECT company_id,action_type_id
                             FROM Testauditinfo_1
                            where trunc(audit_date_time) = trunc(sysdate)-1
                          ) a
                          PIVOT (count(action_type_id)
                            FOR (action_type_id) IN ((1) as num_logins,
                                                     (2) as num_logouts,(61) as num_logins_from_mobile_device,
                                                     (16) as num_pref_changed,....
                  ) P1
                  JOIN
                  (select *
                     from (SELECT company_id,action_type_id,tx_type_id
                             FROM Testauditinfo_1
                            where trunc(audit_date_time) = trunc(sysdate)-1
                          ) a
                          PIVOT (count(action_type_id)
                            FOR (action_type_id,tx_type_id) IN ((3,4) AS add_invoice,
                                                                (4,4) AS edit_invoice,
                                                                (3,3) as num_checks,
                                                                (3,47) as num_paychecks,
                                                                (3,7) as num_recvd_payments,
                                                                (3,9) as num_bills,
                                                                (3,35) as num_estimates,(3,46) as num_purchase_orders
                  ) P2
               on P1.company_id = P2.company_id
                  JOIN
                  (select *
                     from (SELECT company_id,action_type_id,list_type_id
                             FROM Testauditinfo_1
                            where trunc(audit_date_time) = trunc(sysdate)-1
                          ) a
                          PIVOT (count(action_type_id)
                            FOR (action_type_id,list_type_id) IN ((3,2) AS num_items,
                                                                  (3,1) as num_accounts,
                                                                  (3,4) as num_employees,
                                                                  (3,6) as num_customers,
                                                                  (3,14) as num_memorized_reports
                  ) P3
               on P2.company_id = P3.company_id
                  left outer JOIN
                  (SELECT company_id,create_date,count(*) as num_logos
                     FROM qbo.companylogos_1
                    group by company_id,create_date
                    having trunc(create_date) = trunc(sysdate)-1
                  ) P4
               on P3.company_id = P4.company_id
            ORDER BY P1.company_id
          ) source
       ON ((dest.company_id = source.company_id) and (dest.load_date = source.load_date))
    WHEN MATCHED
    THEN UPDATE SET dest.num_items = source.num_items where 1 = 2
    WHEN NOT MATCHED
    THEN INSERT (dest.company_id,.....)
          values (source.company_id,.....)Did you try it ?
    Regards
    Etbin

  • Can I use Reports Server Queue PL/SQL Table API to retrieve past jobs ?

    Hi all,
    Can I use Reports Server Queue PL/SQL Table API to retrieve past jobs using WEB.SHOW_DOCUMENT from Forms ?
    I have reviewed note 72531.1 about using this feature and wonder if i can use this metadata to retrieve past jobs submitted by a user.
    The idea would be to have a form module that can filter data from the rw_server_queue table, say, base on user running the form, and be able to retrieve past jobs from Report Server Queue. For this, one would query this table and use WEB.SHOW_DOCUMENT.
    Is this possible ...?
    Regards, Luis ...!

    Based on that metalink note and the code in the script rw_server.sql, I am pretty sure that by querying the table you would be able accomplish what you want... I have not tested it myself... but it looks that it will work... you have the jobid available from the queue, so you can use web.show_document to retrieve the output previously generated...
    ref:
    -- Constants for p_status_code and status_code in rw_server_queue table (same as zrcct_jstype)
    UNKNOWN CONSTANT NUMBER(2) := 0; -- no such job
    ENQUEUED CONSTANT NUMBER(2) := 1; -- job is waiting in queue
    OPENING CONSTANT NUMBER(2) := 2; -- opening report
    RUNNING CONSTANT NUMBER(2) := 3; -- running report
    FINISHED          CONSTANT NUMBER(2) := 4; -- job has finished
    TERMINATED_W_ERR CONSTANT NUMBER(2) := 5; -- job has terminated with

  • Can you use ActiveX controls in PL/SQL?

    I am trying to find a way to start email from within a database trigger. Someone told me I could use an ActiveX Control (custom made by a colleague). Although I have never worked with ActiveX or OLE, I know that it is possible to use them in Forms. Is is also possible to call an ActiveX in PL/SQL? How? And if it is impossible, could someone tell me another way to start email (the application is to be implemented in a Windows NT Network).
    Lots of thanks for any answer or advice,
    Joeri Folman
    null

    Joen,
    I am not totally sure what you mean when you say 'start email', but you should check out the utl_smpt packages in the database. They can be used to send email messages from the database. I believe that you need to have an email server (like sendmail) running on the machine for these to work correctly.
    Check out Oracle Built-In Packages by Steven Feuerstein. Steven also has a real good book on PL/SQL programming that you may find helpful.

  • Can i use commit in between pl sql statements

    Hi,
    I have written program unit , in that I used insert statements and after that I used commit command.
    But in runtime it's getting oracle error unable to insert . because I used some non database items and database items
    so that it's coming error.
    But my question is , Can i use commit after executing some statements in program unit procedure.
    Thanks in advance.

    FORMS_DDL restrictions
    The statement you pass to FORMS_DDL may not contain bind variable references in the string, but the
    values of bind variables can be concatenated into the string before passing the result to FORMS_DDL.
    For example, this statement is not valid:
    Forms_DDL ('Begin Update_Employee (:emp.empno); End;');
    However, this statement is valid, and would have the desired effect:
    Forms_DDL ('Begin Update_Employee ('||TO_CHAR(:emp.empno)
    ||');End;');
    However, you could also call a stored procedure directly, using Oracle8's shared SQL area over
    multiple executions with different values for emp.empno:
    Update_Employee (:emp.empno);
    SQL statements and PL/SQL blocks executed using FORMS_DDL cannot return results to Form
    Builder directly.
    In addition, some DDL operations cannot be performed using FORMS_DDL, such as dropping a table
    or database link, if Form Builder is holding a cursor open against the object being operated upon.
    Sarah

  • I have a product code for my photoshop c6 under a different account that i cant remember. how can i use my software with the product code that i have with the new user i made?

    I have a product code for my photoshop c6 and i used a different account to register this software. how can i use this product that i have with my new account that i just made?
    please advise
    I dont have the serial number so yeah
    i have a product code

    Contact Adobe Customer Service directly by phone or web chat (they don't do email).  They don't do email.  If you can provide proof of purchase to their satisfaction, they may be able to help you.
    These are user forums, so you're not addressing Adobe here.  We can't help you with this type of issue.

  • Can u tell me how can i use a given gateway in jsp code?

    Hi everybody,
    As iam working on a project,i need to send and receive sms using given gateway(given by client).
    can any one tell me.. how can i use the gateway using java code in jsp page?i need the total java
    code.

    No.
    Your client has provided you with a SMS gateway, and we don't know anything else about it. So we can't give you the code.
    Even if we could give you the code, we don't know what you want to do with it - what functionality do you want to expose to the users of the JSP?
    Even if we could knew what you were using and exactly what you wanted to do with it, why on earth would we want to write all your code for you?
    [Please read this link|http://www.catb.org/~esr/faqs/smart-questions.html]

  • Can we use xml Publisher reporting for sql* Plus in EBS

    Hello All,
    The current report is designed in Sql* Plus Executable report and the output is in txt format, Now the requirement is to have the output in Excel format.
    So is it possible to use the xml reporting and make the output as Excel from the word template we design from MSword as we do for rdf(I have done few reports created in rdf to xml publisher reports in EBS and stand alone as well.).
    Do the same procedure will suit for Sql*Plus reports tooo or Is there any work around to achieve this.
    Thanks and Regards
    Balaji.

    Hi
    Thanks for the reply..
    I tried to do the follwoing
    1. changed the output to xml in the conc. prog.
    2. ran the same report but i am getting the follwoing error in the output file
    The XML page cannot be displayed
    Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
    Invalid at the top level of the document. Error processing resource
    Other reports which are using the Oracle Reports(rdf) as source, i am able to generated the xml as expected....
    So my question is whether we can use sql* reports executable and generate xml in the conc.prog.
    if any one has used the sql*reports for xml publisher reporting... please let me know, so that if its possible i will check my sql needs some validation or tuning...
    thanks in advance
    Balaji.

  • Help me! can not using JDBC driver for MS SQL server

    I can test sucess in connection, but create EJB when have follow error.
    04/05/19 12:23:04 SQL error: No suitable driver
    04/05/19 12:23:10 Error creating table: No suitable driver
    500 Internal Server Error
    java.lang.NoClassDefFoundError: oracle/jbo/html/HtmlServices
         at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:182)
         at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:600)
         at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:317)
         at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
         at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
         at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
         at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
         at java.lang.Thread.run(Thread.java:534)

    HI All,
    I am using JDBC driver to pull data from MS SQL Server
    2000 for my application Liaison Content Exchange, and
    which only accepts JDBC drivers to talk to databases.
    I dowloaded the driver from Microsoft website, and had
    a successful installation.What do you call "a successful installation"? Where was the JAR file places?
    But the application ask me for Driver Name, Class, URL, Time out and Data Source.What application do you mean? Liaison Content Exchange? I'm not familiar with that product.
    By default no driver is available in the drop down combo box. After using
    "com.microsoft.jdbcx.sqlserver.SQLServerDataSource" as
    class and
    jdbc:microsoft:sqlserver://192.168.17.2:1433; as url,
    the application throw me a error which states "Unable
    to instantiate an instance of the application driver"Sounds like it could be one of several things:
    (1) The JDBC JAR is not in the CLASSPATH where Liaison Content Exchange expects to find it.
    (2) You need to do something else to tell Liaison Content Exchange more information to define the data source.
    (3) The URL might be incorrect. Only you can know if the IP address of the host is correct. You don't supply a database name - perhaps you should. Are you sure that 1433 is the correct port number? I know that's true for SQL Server 7.0, but I remember that the default was changed to something else for SQL Server 2000. Ask your database admin what port this listener is assigned to for SQL Server 2000.
    (4) You might want to append ";selectmethod=cursor" to the end of your URL. (See the docs for this.)
    (5) Make sure you can connect to the database with something other than Java (e.g., the M$ SQL Server client).
    . I am not able to trouble shoot this problem, any one
    pls help me ASAP at [email protected]
    Thx.Bad idea to post an e-mail address. You're not supposed to communicate outside the forum. it's against the guidelines for using the forum.

  • Can I use Same ADF application with SQL server 2008 as well as Oracle 11g?

    Hi ,
    I have created a application in ADF(Using J-Developer). I used SQL server 2008 as Database Provider. I have same Database in Oracle 11g. I want to connect my appliction to Oracle 11g database. I changed connection and connected to Oracle. But, when I tried to save or delete any data from front end, it gave error. Any solution on this?
    Thanks

    Hi,
    I have created Entity object and View object for every page in my application. That objects created from sql server database. Application is working fine with sql server. But when connected with Oracle 11g. It is giving following errors:
    On clicking search control it gives: ORA 00923 From keyword not found where expected.
    On searching with perticular field it gives: ORA-01722: Invalid Number.
    On Clicking save buttonit gives: ORA-00933: SQL command not properly ended.
    These are error messages from IntegratedWebLogicServer-Log:
    java.sql.SQLSyntaxErrorException: ORA-00923: FROM keyword not found where expected
    <QueryCollection> <buildResultSet> [3929] java.sql.SQLSyntaxErrorException: ORA-00923: FROM keyword not found where expected
    Caused by: java.sql.SQLSyntaxErrorException: ORA-00923: FROM keyword not found where expected
    <DCBindingContainer> <cacheException> [3947] * * * BindingContainer caching EXCEPTION:oracle.jbo.SQLStmtException
    <DCBindingContainer> <cacheException> [3948] java.sql.SQLSyntaxErrorException: ORA-00923: FROM keyword not found where expected
    <DCBindingContainer> <cacheException> [3949] * * * BindingContainer caching EXCEPTION:oracle.jbo.SQLStmtException
    <DCBindingContainer> <cacheException> [3950] java.sql.SQLSyntaxErrorException: ORA-00923: FROM keyword not found where expected
    <DCBindingContainer> <cacheException> [3951] * * * BindingContainer caching EXCEPTION:oracle.jbo.SQLStmtException
    <DCBindingContainer> <cacheException> [3952] java.sql.SQLSyntaxErrorException: ORA-00923: FROM keyword not found where expected
    <DCBindingContainer> <cacheException> [3953] * * * BindingContainer caching EXCEPTION:oracle.jbo.SQLStmtException
    <DCBindingContainer> <cacheException> [3954] java.sql.SQLSyntaxErrorException: ORA-00923: FROM keyword not found where expected
    java.lang.NullPointerException

  • Can you use an ActiveX in PL/SQL

    I am trying to find a way to start email from within a database trigger. Someone told me I could use an ActiveX Control (custom made by a colleague). Although I have never worked with ActiveX or OLE, I know that it is possible to use them in Forms. Is is also possible to call an ActiveX in PL/SQL? How? And if it is impossible, could someone tell me another way to start email (the application is to be implemented in a Windows NT Network).
    Lots of thanks for any answer or advice,
    Joeri Folman
    null

    Do mean "cause a database trigger to send an e-mail"? If this is the case, check out the package UTL_SMTP, which allows the database to send and receive messages via an SMTP gateway.
    If you mean a client-side activity, like starting up MS Outlook, then you'll have to look at some client-side coding, like Forms, VB.
    null

  • Can Centura SQL Base Can be Used as a Source for SQL Server Reporting Services

    I have bunch of Centura Report Builder and need to show them inside .NET WPF UI. I was thinking to convert those reports to SSRS and then show. But database here is SQL Base
    and want to know whether SSRS supports SQL Base as a source. Also let me know is there a way to show Centura Report Builder inside WPF without converting to SSRS.

    Hi JAISH,
    In Reporting Services, a set of data processing extensions are automatically installed and registered on both the report authoring client and on the report server to provide access to a variety of data source types. But the SQLBase is not included.
    However, custom data processing extensions and standard Microsoft .NET Framework data providers can be installed and registered by system administrators. So we can install and register the data processing extensions and data providers on the report server
    to process and view a report; we can install and register them on the report authoring client to preview a report. But data processing extensions and data providers must be natively compiled for the platform where they are installed.
    For more information about Implementing a Data Processing Extension, please refer to the following document:
    http://msdn.microsoft.com/en-IN/library/ms154655.aspx
    As the issue about how to show Centura Report Builder inside WPF, it related to WPF. It is out of the support boundaries of our forum, I suggestion you post the question in the following forum:
    http://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=wpf. It is appropriate and more experts will assist you.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Blinking question mark within a folder? can not use my broken cd drive for the systems disc?

    My optical drive is broken, so i cannot insert my system software disc. Is there another way to repair my macbook with a flashing ? within a fold upon startup?

    If you have another Mac you can you the target disk mode and have a look if you could access the hard drive from the other Mac. Could also be a hardware error on/with the drive.

  • How can one keep a history of PL/SQL code changes?

    Hello All,
    I am trying to execute the following code found at
    http://www.orafaq.com/faqplsql.htm#HIST
    CREATE OR REPLACE TRIGGER change_hist -- Store code in hist table
    AFTER CREATE ON OPERADWOWNER.SCHEMA -- Change SCOTT to your schema name
    DECLARE
    BEGIN
    if DICTIONARY_OBJ_TYPE in ('PROCEDURE', 'FUNCTION',
    'PACKAGE', 'PACKAGE BODY', 'TYPE') then
    -- Store old code in SOURCE_HIST table
    INSERT INTO SOURCE_HIST
    SELECT sysdate, user_source.* FROM USER_SOURCE
    WHERE TYPE = DICTIONARY_OBJ_TYPE
    AND NAME = DICTIONARY_OBJ_NAME;
    end if;
    EXCEPTION
    WHEN OTHERS THEN
    raise_application_error(-20000, SQLERRM);
    END;
    It is giving the error
    6/14 PL/SQL: SQL Statement ignored
    9/31 PL/SQL: ORA-00904: "DICTIONARY_OBJ_NAME": invalid identifier
    I want to understand what is DICTIONARY_OBJ_NAME in the above given code.
    Regards

    It's supposed to be ora_dict_obj_type. This is one of many event attributes that we can interrogate in DDL triggers. You can find out more in the online docs.
    Cheers, APC

  • Can I Use Dreamwever Site manager with Edge Code? Or at least have the ability to upload through FTP

    Hi There
    I develop all day in Dreameaver CC.
    I Use DW Site manager to upload files to the site.
    Unfortunately - DW code view is really laggy recently and it's really hard to work with.
    I wonder whether I can use Edge code on a live site so I can upload my files to an online site like I do with DW site manager.
    Thanks A  LOT
    Guy Lev
    Adobe ACE, ACI
    IDUG chapter representative
    Israel

    There's no integration between the 2 programs, but you should be able to use them at the same time. Be careful to:
    1. Save all of your files in EC before jumping to DW to use FTP
    2. Don't edit any files in a EC that are being FTPed by DW
    Randy

Maybe you are looking for

  • Syncing multiple ipods to one itunes account

    I have two ipods nano's and two shuffles. I'm having difficulty getting the twonano's to sync to aone account. One is recognized, when the second is plugged in, the sync ipod options is greyed out and not available. I haven't got past this to try the

  • Keynote - cannot save document

    Hi, anybody knows how to solve this problem? I am creating a keynote document with quite a lot of pictures. After the 3-4 slide I could save the document with no problems. I am in the 11th slide now and suddenly, when I tried to save the document it

  • Style for the button

    Hi, it is possible to define style for the button on the form? Portal version: 3.0.6.6.5

  • Where did my external drives go?

    I have 4 external hard drives plugged into my Mac and, one by one, upon restarting my computer, 3 of them got wiped. My 4th drive, which I use for TimeMachine, hasn't been affected. The other 3 are no longer recognized by my Mac. I plug them in and i

  • Erreur d'impression avec adobe photoshop CC sur PC win 8.1

    Bonjour, Lorsque je veux imprimer, j'ai une fenêtre d'erreur. "Une erreur s'est produite lors de l'ouverture de l'imprimante. Les fonctions d'impression ne seront pas disponibles tant que vous n'aurez pas selectionné une imprimante et rouvert les doc