How to update PL/SQL block/Specs in Repository without cut/paste ?

(cross-posted in METALINK form also)
Hello,
Question: How to quickly update PL/SQL block/specs in a package
Repository Object Browser? (without cut/paste)
Tools: Designer 9i, ROB 9.0.2.6
Detailed description of a problem:
-- there is no good pl/sql IDE working with ROB
(JDeveloper can not work with NOT PRIVATE repository workspace)
-- I use Toad and develop/generate pl/sql object
directly in database.
-- I have to synchronize my work with repository as often
as possible the following way (we do not use read-server model
because afraid of getting 1000s of atomik func and proc):
---- navigate to the pl/sql package
---- select properties
---- click on pl/sql block - get old code in editor
---- copy all new code from Toad into editor
---- remove CREATE OR REPLACE and last line
---- save
---- do the same with specifications
I am looking for some way to do this with some script or
one-button click...
For example, for text files it is possible to use command line
Repository Tool. But I did not found the possibility to make
a script like this:
checkout
update workarea/container/plsql_definition/package_name/body....
.....with new_package_body.txt
checkin
Thanks in advance for any help/advice,
Alex V.

Hi Alex,
I just had an "Ah! I see!" moment. I now understand why you're having trouble and I can explain things so you can move on... I hope!
First it's important to understand that Oracle SCM is designed to support versioning of both files and Oracle Designer objects. Designer objects are stored as rows in specially structured tables that support that specific product. When you look at PL/SQL definitions in the RON you're looking at Designer definitions - not files. As I mentioned before, these are not the definitions of 'real' PL/SQL objects in the data dictionary, but definitions used by Designer (from which the real things can be generated - but that's another story).
If you're using TOAD you should probably avoid accessing the Designer objects. You need to work with files.
Here's a suggestion for a sequence of operations:
- In the RON check out & download the file (e.g. mypkg.plb)
- In TOAD load the package (from DB, or downloaded file), edit, update package in DB
- In TOAD save as mypkg.plb (overwriting the downloaded copy)
- IN RON upload mypkg.plb and check in
If you've not stored the file in Oracle SCM yet, jsut omit the first step.
You could even automate this to an extent using SQL to query the data dictionary views (e.g. USER_SOURCE) after making changes to get the code and edit/overwrite the file contents that way.
Does this help at all?
Keith.

Similar Messages

  • How to update java.sql.Clob using javax.persistence.EntityManager?

    Hello.
    Can anyone tell me (or show me some example) how to update java.sql.Clob using javax.persistence.EntityManager.
    When I’m trying to update column (with type Clob) value is not inserting, after update column is empty. I haven’t any error during update, I’m using database Oracle 10g.
    Edited by: ernest211 on Jul 16, 2009 1:24 AM

    Post some code so we can see how you are doing it. If you are using JPA entities take a look at the @Lob annotation.
    m

  • How to convert pl/sql block into single update statement

    Dear all gurus,
    I have pl/sql block mention below, Can I convert this pl/sql block to single update statement if possible?
    If not how to optimize this block?
    Pleaese suggest.
    thanks in advance.
    Vijay
    DECLARE
    CURSOR vt_mlr_cursor IS Select master_key, user4 from vt_mlr Where USER4 is not null;
    USERFIELD VARCHAR2(100);
    C1 VARCHAR2(3); /* this will return location of first space = 12 */
    C2 VARCHAR2(3); /* this will return location of second space = 20 */
    C3 VARCHAR2(3); /* this will return location of third space = 28 */
    C4 VARCHAR2(3); /* this will return location of forth space = 35 */
    Field1 VARCHAR2(40); /* this will return FTMYFLXA04W */
    Field2 VARCHAR2(10); /* this will return VPI0043 */
    Field3 VARCHAR2(10); /* this will return VCI0184 */
    Field4 VARCHAR2(10); /* this will return 005 */
    Field5 VARCHAR2(10); /* this will return 00001 */
    Field_2_n_3 VARCHAR2(25);
    key VARCHAR2(10);
    BEGIN
    FOR vt_mlr_record IN vt_mlr_cursor
    LOOP
    key := vt_mlr_record.master_key;
    USERFIELD := vt_mlr_record.user4;
    C1 := INSTR(vt_mlr_record.user4,' ',1,1); /* this will return location of first space = 12 */
    C2 := INSTR(vt_mlr_record.user4,' ',1,2); /* this will return location of second space = 20 */
    C3 := INSTR(vt_mlr_record.user4,' ',1,3); /* this will return location of third space = 28 */
    C4 := INSTR(vt_mlr_record.user4,' ',1,4); /* this will return location of forth space = 35 */
    Field1 := SUBSTR(vt_mlr_record.user4,1,C1-1); /* this will return FTMYFLXA04W */
    Field2 := SUBSTR(vt_mlr_record.user4,C1+4,C2-C1-4); /* this will return VPI0043 */
    Field3 := SUBSTR(vt_mlr_record.user4,C2+4,C3-C2-4); /* this will return VCI0184 */
    Field4 := SUBSTR(vt_mlr_record.user4,C3+4,C4-C3-4); /* this will return 005 */
    Field5 := SUBSTR(vt_mlr_record.user4,C4+4,LENGTH(vt_mlr_record.user4)-C4-3); /* this will return 00001 */
    Field_2_n_3 := Field2 || '/' || Field3;
    /*DBMS_OUTPUT.PUT_LINE ('Current key is: ' || vt_mlr_record.master_key);*/
    UPDATE vt_mlr
    SET
    aggregator_clli = Field1,
    aggregator_vpi_vci = Field_2_n_3,
    aggregator_slot = Field4,
    aggregator_port = Field5
    WHERE
    master_key = vt_mlr_record.master_key;
    END LOOP;
    END;
    /

    Hi Vijay,
    Here's something to start with, you should be able to complete it.
    First, combine your select and update statements:
    update vt_mlr
       set aggregator_clli = field1
          ,aggregator_vpi_vci = field_2_n_3
          ,aggregator_slot = field4
          ,aggregator_port = field5
    where user4 is not null;Then put these two
    C1 := INSTR(vt_mlr_record.user4,' ',1,1); 
    Field1 := SUBSTR(vt_mlr_record.user4,1,C1-1);into
    Field1 := SUBSTR(vt_mlr_record.user4,1,INSTR(vt_mlr_record.user4,' ',1,1) -1);And put it into the update statement, removing reference to record
    (I have also removed default values for position and occurrence in instr function):
    update vt_mlr
       set aggregator_clli = substr(user4, 1, instr(user4,' ') - 1)
          ,aggregator_vpi_vci = field_2_n_3
          ,aggregator_slot = field4
          ,aggregator_port = field5
    where user4 is not null; I think you can do the rest from here ;-)
    Regards
    Peter

  • How to use Pl/sql block to edit check user input

    Hi,
    Please advise on PL/SQL Block code that could be used to Check User input from within a Loop and proceed conditionally based upon User Supplied compliant Input. Thanks in advance.

    Hi,
    yakub21 wrote:
    You could use the ACCEPT to get user input and then assign the input to a variable that could then be verified.
    I believe that anything is possible because we don't yet have proof that it is not!
    I do have code that can accept user input. Is it PL/SQL code? Sybrand was clearly talking about PL/SQL:
    sybrand_b wrote:
    Pl/sql is for server side code, it is not a front end tool, and it is incapable of the functionality you describe.If you do have PL/SQL code that accepts user input, please post an example. A lot of people, including me, would be very interested.
    Pass the user-input value to a variable and then assign that value to another variable from within a Declare of a PL/SQL Block.
    The opportunity here is to figure a way to loop with user input until desired input is entered by the user before proceeding with the code. I'm using PL/SQL Block because I don't want the code to persist. I just want to run it as part of database configuration procedure. ThanksIt sounds like you're talking about SQL*Plus, which is a very poor tool for looping or branching.
    It's possible, but it's not pretty. The following thread shows one way of looping in SQL*Plus:
    Re: How to give the different values to runtime parameters in a loop?

  • How can update pop - up blocker settings

    How can I update pop - up blocker settings

    If you're suddenly seeing unaccustomed ad activity, you may have installed one or more of the common types of ad-injection malware. Follow the instructions on this Apple Support page to remove it. It's been reported that some variants of the "VSearch" malware block access to the page. If that happens, start in safe mode by holding down the shift key at the startup chime, then try again.
    Back up all data before making any changes.
    One of the steps in the article is to remove malicious Safari extensions. Do the equivalent in the Chrome and Firefox browsers, if you use either of those. If Safari crashes on launch, skip that step and come back to it after you've done everything else.
    If you don't find any of the files or extensions listed, or if removing them doesn't stop the ad injection, ask for further instructions.
    Make sure you don't repeat the mistake that led you to install the malware. It may have come from an Internet cesspit such as "Softonic" or "CNET Download." Never visit either of those sites again. You might also have downloaded it from an ad in a page on some other site. The ad would probably have included a large green button labeled "Download" or "Download Now" in white letters. The button is designed to confuse people who intend to download something else on the same page. If you ever download a file that isn't obviously what you expected, delete it immediately.
    Malware is also found on websites that traffic in pirated content such as video. If you, or anyone else who uses the computer, visit such sites and follow prompts to install software, you can expect more of the same, and worse, to follow. Never install any software that you downloaded from a bittorrent, or that was downloaded by someone else from an unknown source.
    In the Security & Privacy pane of System Preferences, select the General tab. The radio button marked Anywhere  should not be selected. If it is, click the lock icon to unlock the settings, then select one of the other buttons. After that, don't ignore a warning that you are about to run or install an application from an unknown developer.
    Still in System Preferences, open the App Store or Software Update pane and check the box marked
              Install system data files and security updates (OS X 10.10 or later)
    or
              Download updates automatically (OS X 10.9 or earlier)
    if it's not already checked.

  • How to execute pl/sql block from a file

    hi all,
    can anybody tell me how to execute a pl/sql block from a file.it wont contain any procedures.it is of the form
    --begin
    --declare
    --end;
    Thanx

    Here is the file
    File is stored in C Drive (Windows Environment)
    declare
    x number;
    begin
    select 1 into x from dual;
    dbms_output.put_line(x);
    end;
    SQL> @c:\t.sql;
    1
    PL/SQL procedure successfully completed.Are you facing any issues?
    Regards,
    Bhushan

  • How to update base view Block

    Hi,
    I have a View ( is based on more than one table) and created base table block based on that view.
    Question is, how can I update and save the data from Oracle forms ?
    I'm using Oracle forms 4.5 and Oracle8.0.6 database.
    Thanks in advance.

    Hi James
    Form based on Complex views:
    Records can be updated by writing the code in ON-UPDATE Trigger,
    Code for Inserting a record can be written in ON-INSERT trigger
    For delete u can write the code in ON-DELETE or KEY-DELREC (this worked for my form)
    Locking the rows can be done by ON-LOCK trigger.
    Here is the sample code....
    try to write a package and in that package write procedure for, insert, update, delete, lock, Call those procedures in your trigger which should be on your block level. Block's property that you have to set is: go to the property pallette:
    LOCKING MODE: IMMIDIATE
    KEY MODE: UPDATEABLE
    CODE FOR INSERT:
    --change field names according to your field names
    Package Spec:
    PACKAGE XXCPCRQM_PKG IS
    PROCEDURE insert_row;
    PROCEDURE update_row;
    PROCEDURE delete_row;
    PROCEDURE lock_row;
    END;
    Package Body:
    PACKAGE BODY XXCPCRQM_PKG IS
    --Procedure to Update Row into cpt_ar_charge_to_master table
    PROCEDURE update_row IS
    BEGIN
    UPDATE cpt.cpt_ar_charge_to_master
    SET
    ACCOUNT = :XXCPCRQM_BLK.ACCOUNT,
    SUFFIX = :XXCPCRQM_BLK.SUFFIX,
    REPORT_CODE = :XXCPCRQM_BLK.REPORT_CODE,
    CHARGE_TO_ACCOUNT = :XXCPCRQM_BLK.CHARGE_TO_ACCOUNT,
    CHARGE_TO_SUFFIX = :XXCPCRQM_BLK.CHARGE_TO_SUFFIX,
    CREATION_DATE = :XXCPCRQM_BLK.CREATION_DATE,
    CREATED_BY = :XXCPCRQM_BLK.CREATED_BY,
    LAST_UPDATE_DATE = :XXCPCRQM_BLK.LAST_UPDATE_DATE,
    LAST_UPDATED_BY = :XXCPCRQM_BLK.LAST_UPDATED_BY
    --WHERE ROWID = :XXCPCRQM_BLK.ROW_ID;
    WHERE CHARGE_TO_ID = :XXCPCRQM_BLK.CHARGE_TO_ID;
    EXCEPTION
    when NO_DATA_FOUND
    then
              fnd_message.debug('CAN NOT UPDATE RECORD');
    raise form_trigger_failure;
    commit;
    END;
    --Procedure to Insert Row into cpt_ar_charge_to_master table
    PROCEDURE insert_row IS
    BEGIN
    INSERT INTO cpt.cpt_ar_charge_to_master
    (CHARGE_TO_ID,
    ACCOUNT,
    SUFFIX,
    REPORT_CODE,
    CHARGE_TO_ACCOUNT,
    CHARGE_TO_SUFFIX,
    CREATION_DATE,
    CREATED_BY,
    LAST_UPDATE_DATE,
    LAST_UPDATED_BY)
    VALUES
    (cpt_chrg_to_id_s.nextval, -- Sequence
    :XXCPCRQM_BLK.ACCOUNT,
    :XXCPCRQM_BLK.SUFFIX,
    :XXCPCRQM_BLK.REPORT_CODE,
    :XXCPCRQM_BLK.CHARGE_TO_ACCOUNT,
    :XXCPCRQM_BLK.CHARGE_TO_SUFFIX,
    :XXCPCRQM_BLK.CREATION_DATE,
    :XXCPCRQM_BLK.CREATED_BY,
    :XXCPCRQM_BLK.LAST_UPDATE_DATE,
    :XXCPCRQM_BLK.LAST_UPDATED_BY);
    EXCEPTION
    when NO_DATA_FOUND
    then
              fnd_message.debug('CAN NOT INSERT RECORD');
    raise form_trigger_failure;
    commit;
    END;
    --Procedure to Delete rows from cpt_ar_charge_to_master
    PROCEDURE delete_row IS
    BEGIN
    DELETE FROM cpt.cpt_ar_charge_to_master
    WHERE charge_to_id = :XXCPCRQM_BLK.charge_to_id;
    EXCEPTION
    when NO_DATA_FOUND
    then
              fnd_message.debug('CAN NOT DELETE RECORD');
              raise form_trigger_failure;
    commit;
    END;
    PROCEDURE lock_row IS
    Counter NUMBER;
    CURSOR C IS
    SELECT
    CHARGE_TO_ID,
    ACCOUNT,
    SUFFIX,
    REPORT_CODE,
    CHARGE_TO_ACCOUNT,
    CHARGE_TO_SUFFIX
    FROM cpt_ar_charge_to_master
    WHERE charge_to_id = :XXCPCRQM_BLK.CHARGE_TO_ID
    FOR UPDATE of CHARGE_TO_ID NOWAIT;
    Recinfo C%ROWTYPE;
    BEGIN
    Counter := 0;
    LOOP
    BEGIN
    Counter := Counter + 1;
    OPEN C;
    FETCH C INTO Recinfo;
    if (C%NOTFOUND) then
    CLOSE C;
    FND_MESSAGE.Set_Name('FND','FORM_RECORD_DELETED');
    FND_MESSAGE.Error;
    Raise FORM_TRIGGER_FAILURE;
    end if;
    CLOSE C;
    if (
    (Recinfo. CHARGE_TO_ID = :XXCPCRQM_BLK.CHARGE_TO_ID)
    AND ( (Recinfo. ACCOUNT = :XXCPCRQM_BLK.ACCOUNT)
    OR ( (Recinfo. ACCOUNT IS NULL)
    AND (:XXCPCRQM_BLK.ACCOUNT IS NULL)))
    AND ( (Recinfo.SUFFIX= :XXCPCRQM_BLK.SUFFIX)
    OR ( (Recinfo.SUFFIX IS NULL)
    AND (:XXCPCRQM_BLK.SUFFIX IS NULL)))
    AND ( (Recinfo.REPORT_CODE = :XXCPCRQM_BLK.REPORT_CODE)
    OR ( (Recinfo.REPORT_CODE IS NULL)
    AND (:XXCPCRQM_BLK.REPORT_CODE IS NULL)))
    AND ( (Recinfo.CHARGE_TO_ACCOUNT = :XXCPCRQM_BLK.CHARGE_TO_ACCOUNT)
    OR ( (Recinfo.CHARGE_TO_ACCOUNT IS NULL)
    AND (:XXCPCRQM_BLK.CHARGE_TO_ACCOUNT IS NULL)))
    AND ( (Recinfo.CHARGE_TO_SUFFIX = :XXCPCRQM_BLK.CHARGE_TO_SUFFIX)
    OR ( (Recinfo.CHARGE_TO_SUFFIX IS NULL)
    AND (:XXCPCRQM_BLK.CHARGE_TO_SUFFIX IS NULL)))
    ) then
    return;
    else
    FND_MESSAGE.Set_Name('FND','FORM_RECORD_CHANGED');
    FND_MESSAGE.Error;
    Raise FORM_TRIGGER_FAILURE;
    end if;
    EXCEPTION
    When APP_EXCEPTIONS.RECORD_LOCK_EXCEPTION then
    IF (C% ISOPEN) THEN
    close C;
    END IF;
    APP_EXCEPTION.Record_Lock_Error(Counter);
    END;
    end LOOP;
    END lock_row;
    END XXCPCRQM_PKG;
    CALLING FROM TRIGGER:
    ON-INSERT: XXCPCRQM_PKG.insert_row;
    I am sure this will help you.
    Thanks
    Madhu

  • How to update apps but block install apps

    we use the iPad in my company. We want to block user to install apps, but allow user to update apps which is free apps.
    As block user to install apps, it will block the apps store. How can we update the apps when it block the apps store?

    If you block access to the App Store on the iPad then I don't think that you can update apps directly on the iPad - updating, as well as installing, is done via the store. The only other way to update apps is via a connection to a (iTunes account authorised) computer which has had the updated app(s) downloaded to it.

  • How to update the sql report column create using Htmldb_item

    Hi,
    I have a updateable sql report,which consist of htmldb_item like
    htmldb_item.hidden(1,a.id) "ID",
    htmldb_item.display_and_save(2,a.question,2,100) "Question",
    htmldb_item.text(3,b.answer,20,1000) "Answer"
    now in the report 'answer' coloumn i have made updateable,but my question is how to create the valdiation on the answer coloumn of the report.
    As i been to page source and for all the record of the answer coloumn the array id is f03, so how to identify the particular 'answer' on the report and give the validation for them...
    Thanks

    Validations in Apex are designed to operate upon individual page items that you have defined on the page, not tabular form elements.
    Search the forum for other techniques you can use
    http://forums.oracle.com/forums/search.jspa?objID=f137&q=tabular+form+validate+declaratively+javascript

  • How to update session state from form field values without submitting page?

    Hi,
    I am new to Oracle APEX. I am using Oracle Apex 4.2 on Oracle 11g release 2. The problem is that when I am entering data on a form, when I enter a value in one field and move to the next field, how can I use the value of first field in the validation procedure of next field? I know that when we enter data in fields, the session state is not updated with these values until we submit the page... right... but I have seen that if there is a control of List box type, then Apex gives an option "Action When List changes" where we can choose option to update corresponding session state field with the value of list box item, without submitting the page.
    Now my questions is why this option is only available for List box items? why not for other item types like Text box, Check box,... ? can someone please help me with this?
    (the issue with update of session state depending on page submitting, is that we need a complete network round trip from client to server in order for it. However if we can update session state variables without submitting page, then we can avoid this network traffic).
    Any help will be greatly appreciated. Thanks in advance.

    Create a dynamic action on change and run a PL/SQL process there with the following code:
    BEGIN
       NULL;
    END;Page items to submit > your item.
    This will set the session state without submitting the form.
    Further examples here:
    http://apex.oracle.com/pls/apex/f?p=31517:229
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.apress.com/9781430235125
    http://apex.oracle.com/pls/apex/f?p=31517:1
    http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494
    -------------------------------------------------------------------

  • How to update list item using client object model without changing created/modified dates?

    Hello All,
    I want to update list item using the SharePoint Client Object
    Model without updating the created / modified date. Is it possible?
    Please help.
    Thanks.

    Using the SystemUpdate method should do the trick, according
    to its literature.
    Additionally, would something like this be of any use for you?  Taken from this
    Stack Exchange thread: -
    public static class SPListItemExtensions
    /// <summary>
    /// Provides ability to update list item without firing event receiver.
    /// </summary>
    /// <param name="item"></param>
    /// <param name="doNotFireEvents">Disables firing event receiver while updating item.</param>
    public static void Update(this SPListItem item, bool doNotFireEvents)
    SPItemEventReceiverHandling rh = new SPItemEventReceiverHandling();
    if (doNotFireEvents)
    try
    rh.DisableEventFiring();
    item.Update();
    finally
    rh.EnableEventFiring();
    else
    item.Update();
    /// <summary>
    /// Provides ability to update list item without firing event receiver.
    /// </summary>
    /// <param name="item"></param>
    /// <param name="incrementListItemVersion"></param>
    /// <param name="doNotFireEvents">Disables firing event receiver while updating item.</param>
    public static void SystemUpdate(this SPListItem item, bool incrementListItemVersion, bool doNotFireEvents)
    SPItemEventReceiverHandling rh = new SPItemEventReceiverHandling();
    if (doNotFireEvents)
    try
    rh.DisableEventFiring();
    item.SystemUpdate(incrementListItemVersion);
    finally
    rh.EnableEventFiring();
    else
    item.SystemUpdate(incrementListItemVersion);
    /// <summary>
    /// Provides ability to update list item without firing event receiver.
    /// </summary>
    /// <param name="item"></param>
    /// <param name="doNotFireEvents">Disables firing event receiver while updating item.</param>
    public static void SystemUpdate(this SPListItem item, bool doNotFireEvents)
    SPItemEventReceiverHandling rh = new SPItemEventReceiverHandling();
    if (doNotFireEvents)
    try
    rh.DisableEventFiring();
    item.SystemUpdate();
    finally
    rh.EnableEventFiring();
    else
    item.SystemUpdate();
    private class SPItemEventReceiverHandling : SPItemEventReceiver
    public SPItemEventReceiverHandling() { }
    new public void DisableEventFiring()
    base.DisableEventFiring();
    new public void EnableEventFiring()
    base.EnableEventFiring();
    Steven Andrews
    SharePoint Business Analyst: LiveNation Entertainment
    Blog: baron72.wordpress.com
    Twitter: Follow @backpackerd00d
    My Wiki Articles:
    CodePlex Corner Series
    Please remember to mark your question as "answered" if this solves (or helps) your problem.

  • How to Set Distinct SQL Clause on View Object without using Expert Mode.

    Hi to all Actually i have a View Object usign 3 entities
    if i use expert mode in my VO, it generate
    QRSLT WHERE
    instruction and force to include all columns on my dynamic where clause on select statement i can't include columns because get me duplicate rows
    How i can include disctinct clause without usign expert mode or any other solution?
    Note that in normal mode without expert mode QRSLT WHERE is not generate and all work fine
    For example
    select * ( select id , name from table) QRSLT WHERE loc = ..
    if i use expert mode it generate QRSLT WHERE and if loc is not predicated colums get me and error :
    ( ORA-00904: invalid identifier )
    in simple mode of View Object all work fine..
    Any suggestion on It will be appreciate.....
    Tnx

    My problem is that when use expert mode
    it's change simple select statement for a select that use
    select * from (select column....)
    qrslt WHERE (column=somevalue)
    this kind of select force me to include all where conditions of qrslt on my select columns and this get duplicate rows
    thats beacuse i need include distinct without use expert mode
    Anny Help on this?

  • How to update my MSI X99S Gaming 7 Bios without loose my raid settings

    Hi all,
    I've got a MSI X99S Gaming 7 Motherboard.
    Last time I used MSI Live Update and I performed BIOS update I lost totally my raid settings ( O.S. HardDisk C is build on my raid 1) and I had to reinstall all from 0. Now MSI Live Update notified me a new BIOS version available, is there a way to perform it without lost my C Drive one more time?
    Thanks in advance for your help.

    Quote from: JLio01 on 03-March-15, 09:17:09
    The only settings should do is after BIOS updating, go the BIOS Settings--Advanced--Integrated Peripherals--SATA Mode switch to [RAID Mode], and everything should be fine.
    Yes exactly, that's usually and typically which has to be done.
    But with some note there are an exceptions from this:
    in the past there was some BIOSes due bugs which caused RAID array lost issue after flashing,
    assume raid was re-enabled after the update,
    but RAID array was lost(didn't recognize the settings) and didn't show and unable to rebuild..
    so its always good to have a backup of important data just in case..
    don't trust too much to technology

  • Pl/sql block updating orderId, itemID

    lol here i am again!
    This time its like this:
    i have a table (orderId, itemId, CustomerId, productId, quantity, start_date, end_date, oldRef)
    here are some of the values:
    2477, 1, 201, 111, 1,19-MAR-93,14-APR-93
    2477,2,201,112,1,19-MAR-93,14-APR-93
    2478,1,201,113,1,19-MAR-93,14-APR-93
    2478,2,201,110,19-Mar-93,14-APR-93
    Now as you can see that order_Id is different however order_date and ship_date both match. Now what i want to do is to give them a new orderId, re-arrange itemId if ship_date and order_date match for each customer so the ex above should come out like this:
    1, 1, 201, 111, 1,19-MAR-93,14-APR-93
    1,2,201,112,1,19-MAR-93,14-APR-93
    1,3,201,113,1,19-MAR-93,14-APR-93
    1,4,201,110,19-Mar-93,14-APR-93
    I have created a pl/sql block. It has a cursor that loops around each row of table. Then it stores orderdate, shipdate and customerId. it also has a itemId variable and orderDate variable. OrderDate variable takes its value from orderId sequence and itemId is just a number that increments itself.
    NOW when orderdate,shipdate&customerId are the same, i just update the itemId, if they differ or customer_id changes i get a new order_id, update the variables (orderdate,shipdate,customerid,itemId) but for some reason i dont think it is working!!
    DECLARE
         cursor c1 is
              SELECT
              FROM
                   ph2_item
              order by
                   customer_id,
                   ship_date,
                   order_date
              for update;
         new_order_id     number(8,0) := 0;
         new_item_id     number(4,0) := 1;
         temp_odate      date := '11-JUN-08';
         temp_sdate     date:= '11-JUN-08';
         temp_cId     number(8,0) := 1;
    BEGIN
         FOR rec in c1 LOOP
              IF  rec.customer_id = temp_cId  THEN
                   IF (rec.order_date <> temp_odate OR
                   rec.ship_date <> temp_sdate) THEN
                        new_item_id:= 1;
                                    SELECT  orderid.nextVal into new_order_id from dual;
                        temp_odate :=rec.order_date;
                        temp_sdate :=rec.ship_date;
                   END IF;
              ELSE
                   new_item_id:= 1;
                   SELECT  orderid.nextVal into new_order_id from dual;
                   temp_cid := rec.customer_id;
                   temp_odate :=rec.order_date;
                   temp_sdate :=rec.ship_date;
              END IF;
              update ph2_item
              set order_id = new_order_id, item_id = new_item_id
              where current of c1;
              new_item_id := new_item_id + 1;
         END LOOP;
    END;
    commit;PS> this is not a real life database and just a college assignment!
    just corrected a mistake in one of the example code i posted
    Message was edited by:
    user646562

    well it does seem to give the right results ie. orderId is changed and itemId is rearranged! however the college has an online marker and when i try to submit the code, it says that the max(order_id) of the resulting table (ph2_item) is wrong, the sum(item_id) is wrong and the no of distinct orders is wrong.. this means i am either consolidating orders whne i shouldnt, and this in turns make my item_id wrong..
    also there is one more criteria i should have mentioned but i forgot and that is even if the order_date and ship_date is the same as another order, we will only consolidate them if the customer in question has multiple sites.
    here is the updated pl/sql block taking into account this criteria (using if/else statement)
    DECLARE
         cursor c1 is
              SELECT
              FROM
                   ph2_item
              order by
                   order_date,
                   customer_id
              for update;
         new_order_id     number(8,0) := 0;
         new_item_id     number(4,0) := 1;
         temp_odate date := '11-JUN-08';
         temp_sdate     date:= '11-JUN-08';
         temp_cId     number(8,0) := 1;
         totalSites     number(2,0);
    BEGIN
         FOR rec in c1 LOOP
              select site_count into totalsites from customer_sites where customer_id = rec.customer_id;
              --dbms_output.put_line(rec.customer_id ||' ' || totalsites);
              if totalsites > 1 THEN
                   IF rec.customer_id = temp_cId THEN
                        IF (rec.ship_date <> temp_sdate AND rec.order_date <> temp_odate) AND rec.ship_date is null THEN
                             new_item_id:= 1;
         SELECT orderid.nextVal into new_order_id from dual;
                             temp_odate :=rec.order_date;
                             --temp_sdate :=rec.ship_date;
                        END IF;
                   ELSE
                        new_item_id:= 1;
                        SELECT orderid.nextVal into new_order_id from dual;
                        temp_cid := rec.customer_id;
                        temp_odate :=rec.order_date;
                        --temp_sdate :=rec.ship_date;
                   END IF;     
              ELSE
                   new_item_id:= 1;
                   SELECT orderid.nextVal into new_order_id from dual;
                   temp_cid := rec.customer_id;
                   temp_odate :=rec.order_date;
                   --temp_sdate :=rec.ship_date;
              END IF;      
              update ph2_item
              set order_id = new_order_id, item_id = new_item_id
              where current of c1;
              new_item_id := new_item_id + 1;
         END LOOP;
    END;

  • ORA-02070: Error when updating a SQL Server table thru an Oracle View

    I have a SQL Server table TIMESHEET which contains a number of VARCHAR and NUMERIC columns plus a DATETIME column.
    Only the DATETIME column is giving me trouble.
    On the ORACLE side I have a view which selects from the SQL Server table but in order to get the SELECT to work, I had to either put a CAST or TO_DATE function call around the DATETIME field
    Below is the relevant part of the 2 view definitions I have tried
    create view TIMESHEET as
    SELECT
    "TsKeySeq" as TS_KEY_SEQ,
    "EmployeeNo" as EMPLOYEE_NO,
    CAST("PeriodEnding" AS DATE) as PERIOD_ENDING,
    . . . (more columns - not relevant)
    FROM [email protected];
    An update to the view generates this message
    ORA-02070: database OLEMSQLPSANTDAS6 does not support CAST in this context
    create view TIMESHEET as
    SELECT
    "TsKeySeq" as TS_KEY_SEQ,
    "EmployeeNo" as EMPLOYEE_NO,
    TO_DATE("PeriodEnding") as PERIOD_ENDING,
    . . . (more columns - not relevant)
    FROM [email protected];
    An update to the view generates this message
    ORA-02070: database OLEMSQLPSANTDAS6 does not support TO_DATE in this context
    If I don't include either the TO_DATE() or CAST() then I get
    Select Error: ORA-28527: Heterogeneous Services datatype mapping error
    ORA-02063:preceding line from OLEMSQLSANTDAS6
    Does anyone have any idea how to update a SQL Server DATETIME column thru an ORACLE view?

    You can't cast accross heterogenious databases and there is no need to. HSODBC treats SQL Server DATETIME column as DATE. For example, I have SQL Server table:
    CREATE TABLE [Ops].[T_JobType](
         [JobType] [varchar](50) NOT NULL,
         [JobDesc] [varchar](200) NULL,
         [InsertDt] [datetime] NOT NULL CONSTRAINT [InsertDt_00000006]  DEFAULT (getdate()),
         [InsertBy] [varchar](128) NOT NULL CONSTRAINT [InsertBy_00000006]  DEFAULT (user_name()),
         [LastUpdated] [datetime] NOT NULL CONSTRAINT [LastUpdated_00000006]  DEFAULT (getdate()),
         [LastUpdatedBy] [varchar](128) NOT NULL CONSTRAINT [LastUpdatedBy_00000006]  DEFAULT (user_name()),
    CONSTRAINT [T_JobType_PK] PRIMARY KEY CLUSTERED
         [JobType] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON, FILLFACTOR = 100) ON [DATA01FG]
    ) ON [DATA01FG]Now on Oracle side I do:
    SQL> desc "Ops"."T_JobType"@pbods
    Name                                      Null?    Type
    JobType                                   NOT NULL VARCHAR2(50)
    JobDesc                                            VARCHAR2(200)
    InsertDt                                  NOT NULL DATE
    InsertBy                                  NOT NULL VARCHAR2(128)
    LastUpdated                               NOT NULL DATE
    LastUpdatedBy                             NOT NULL VARCHAR2(128)
    SQL> select "InsertDt" from "Ops"."T_JobType"@pbods;
    InsertDt
    18-AUG-08
    09-OCT-08
    22-OCT-09
    18-AUG-08
    19-NOV-08
    SQL> SY.

Maybe you are looking for