Updates/Inserts to the Tablespace

We have this centralized database called CONSOLE running in Oracle Database 10.2.0.5. We have site databases (150 small database from different towns). All of these inserts data into the CONSOLE database every 4 hours. I was tasked to monitor the console database. Part of my plan is to make sure that no tablespaces will be full and I need to address this issue before it occurs. The problem is we only have limited storage in the CONSOLE database and the upgrade in storage is scheduled in the 3rd week of June.
Is there a way to find out when was a tablespace (datafile) was last written to? (And from which table this data (row) belongs?)
The concept that I would like to find out is the same in the dba_tables view where you can check when was the table last analyzed.

With this script you can monitor the tablespace size and take action:
==========================================
set linesize 150
column tablespace_name format a20 heading 'Tablespace'
column sumb format 999,999,999
column extents format 9999
column bytes format 999,999,999,999
column largest format 999,999,999,999
column Tot_Size format 999,999 Heading 'Total| Size(Mb)'
column Tot_Free format 999,999,999 heading 'Total Free(MB)'
column Pct_Free format 999.99 heading '% Free'
column Chunks_Free format 9999 heading 'No Of Ext.'
column Max_Free format 999,999,999 heading 'Max Free(Kb)'
set echo off
PROMPT FREE SPACE AVAILABLE IN TABLESPACES
select a.tablespace_name,sum(a.tots/1048576) Tot_Size,
sum(a.sumb/1048576) Tot_Free,
sum(a.sumb)*100/sum(a.tots) Pct_Free,
sum(a.largest/1024) Max_Free,sum(a.chunks) Chunks_Free
from
select tablespace_name,0 tots,sum(bytes) sumb,
max(bytes) largest,count(*) chunks
from dba_free_space a
group by tablespace_name
union
select tablespace_name,sum(bytes) tots,0,0,0 from
dba_data_files
group by tablespace_name) a
group by a.tablespace_name
order by pct_free;
=========
regards
Shanoj

Similar Messages

  • Problems with update/insert and the ON clause

    I have two rather identical mappings, both supporting SCD Type II. One of them works, the other one doesn't.
    As in the SCD whitepaper, I have a split, that ultimately ends in a union, and then UPDATE/INSERTs into the target dimension. My problem is, that though using the matching_id for matching in one mapping, it is not allowed in the second mapping. The error is ORA-38104: The columns refererred in the ON-Clause cannot be updated "MyTable.MyId" (all loosely translated).
    I just don't understand it, as it should be able to match the ID, and if not found, create a new record using INSERT.
    I found a description of the error that sounded like this (https://cwisdb.cc.kuleuven.ac.be/ora10doc/server.101/b10744/e38001.htm):
    ORA-38104: Columns referenced in the ON Clause cannot be updated: string
    Cause: LHS of UPDATE SET contains the columns referenced in the ON Clause
    Action: none
    I just don't understand how this can be a problem, since I have to carry the surrogate key along, in order to assure that the proper records gets updated...
    Anyone who can enlighten me on this one?
    Regards
    Kim

    Oh yes :) I was a quite active participant. What puzzles me is, that I cannot get mapping #2 to work. I have tried to do everything virtually alike, with regards to the surrogate key, and the extra mapping column.
    My setting for the keys are as below:
    Surrogate Matching
    Load column when inserting: yes no
    Load column when updating: yes no
    Match column when updating: no yes
    Load column when deleting: no no
    Table best viewed in notepad :)
    It "feels" like it's trying to update the surrogate key, instead of actually matching.
    Regards
    Kim

  • MULTIPLE UPDATES/INSERTIONS TO THE SAME TABLE

    How can I update/insert mutiple rows into the same table from one form ?

    Hi,
    Using the portal form on table you can insert only a single row. You can use master-detail form to insert multiple rows.
    Thanks,
    Sharmila

  • SQL MERGE trying to duplicate update/insert. The insert/update is not ideal, but the sql merge hangs.

    I am trying to duplicate this update/insert with a sql merge:
    -UPDATE [etag].Energy_Processed
    SET Start_Datetime = estg.Start_Datetime,
    --End_Datetime = estg.End_Datetime,
    --Schedule_MW = estg.Schedule_MW,
    --Active_MW = estg.Active_MW,
    Load_Dt = GETUTCDATE() 
    FROM  [etag].Energy_Stg estg, [etag].[Energy_Processed] ep
    WHERE estg.Tag_Name IN
    SELECT DISTINCT(tproc.Tag_Name) from [etag].[Energy_Processed] eproc
    INNER JOIN [etag].[Tag_Processed] tproc ON tproc.Id = eproc.Tag_Id
    INNER JOIN [etag].[Energy_Stg] estg1 ON estg1.Tag_Name = tproc.Tag_Name
               AND ep.Active_MW = estg.Active_MW
               AND ep.End_Datetime = estg.End_Datetime
              AND ep.Schedule_MW = estg.Schedule_MW 
    INSERT into [etag].[Energy_Processed] (Tag_Id, Start_Datetime, End_Datetime, Schedule_MW, Active_MW, Load_Dt)
    SELECT tproc.Id, estg.Start_Datetime, estg.End_Datetime, Schedule_MW, Active_MW, GETUTCDATE()  FROM [etag].[Energy_Stg] estg
    INNER JOIN [etag].[Tag_Processed] tproc ON tproc.Tag_Name = estg.Tag_Name
    WHERE estg.Id BETWEEN @minEId AND @maxEId AND
    estg.Tag_Name NOT IN (
    SELECT DISTINCT (tproc.Tag_Name) from [etag].[Energy_Processed] eproc
    INNER JOIN [etag].[Tag_Processed] tproc ON tproc.Id = eproc.Tag_Id
    INNER JOIN [etag].[Energy_Stg] estg1 ON estg1.Tag_Name = tproc.Tag_Name
    SQL MERGE:
    MERGE [Forecast_Data_Repository].[etag].[Energy_Archive] enArch
    USING 
    (SELECT ep.Tag_Id, ep.Start_Datetime, ep.End_Datetime, ep.Schedule_MW, ep.Active_MW, ep.Load_Dt 
    FROM  [etag].[Energy_Stg] estg, [etag].[Energy_Processed] ep
    WHERE estg.Tag_Name IN
    SELECT DISTINCT(tproc.Tag_Name) from [etag].[Energy_Processed] eproc
    INNER JOIN [etag].[Tag_Processed] tproc ON tproc.Id = eproc.Tag_Id
    INNER JOIN [etag].[Energy_Stg] estg1 ON estg1.Tag_Name = tproc.Tag_Name
    ) AS sourceEP
    ON EXISTS(SELECT sourceEP.Tag_Id)
    WHEN MATCHED THEN
    UPDATE
    SET Tag_Id = sourceEP.Tag_Id,
    Start_DateTime = sourceEP.Start_Datetime,
    End_Datetime = sourceEP.End_Datetime,
    Schedule_MW = sourceEP.Schedule_MW,
    Load_dt = GETUTCDATE()
    WHEN NOT MATCHED BY TARGET THEN
    INSERT (Tag_Id, Start_Datetime, End_Datetime, Schedule_MW, Active_MW, Load_dt)
    VALUES (sourceEP.Tag_Id, sourceEP.Start_Datetime, sourceEP.End_Datetime, sourceEP.Schedule_MW,
    sourceEP.Active_MW, GETUTCDATE())
    OUTPUT
    $action,
    INSERTED.Tag_Id
    --UPDATED.Tag_Name
    INTO @MergeOutput;
    Greg Hanson

    This bit
        ON EXISTS(SELECT sourceEP.Tag_Id)
    Looks wrong. Sould be something like:
       ON sourceEP.Tag_Id = enArch.Tag_Id
    And don't update the matching columns in the UPDATE part, as they already match.
    David
    David http://blogs.msdn.com/b/dbrowne/

  • How do I update/insert into a target table, rows after date X

    Hi all
    I have a mapping from source table A to target table B. Identical table structure.
    Target table A updates rows and inserts rows daily. Every week I want to synchronize this with table B.
    I have CREATION_DATE and LAST_UPDATE_DATE on both tables. I want to pass in a parameter to this mapping of date X which tells the mapping:
    "if CREATION_DATE is past X then do an insert of this row in B, if LAST_UPDATE_DATE is past X then do an update of this row in B"
    Please can you help me work out how to map this correctly as I am new to OWB.
    Many thanks
    Adi

    Hi,
    You can achieve this by -
    1. Create a control table, say Control_Table, with structure
    Map Name, last_load_date. Populate this table with the mappings that synchronizes your Table B.
    2. Alter mapping, that loads Table B to use the above control table to get all the records from Table A, you have to join Table A and Control_Table with the condition -
    Control_Table.Map_Name = < mapping name>
    AND ( TableA.Creation_Date > Control_Table.last_load_date
    OR TableA.Last_Update_Date > Control_Table.last_load_date )
    3. Then use UPDATE/INSERT on the Table B based on the Keys. This should take care of INSERT ( if not present) / UPDATE (if the row already exists).
    4. Schedule the mapping to run on weekly basis.
    5. You have to maintain the Control_Table to keep changing the values for Last_Load_Date to pick the data since the last time Table B is synchronized.
    HTH
    Mahesh

  • Data comparison and update/insert between two schemas in same database

    Hi all,
    I have requirement like this. In one database, i am having two users, user1 and user2. Both users is having same tables and structure wise also same. In user1, data will be populated by job.
    Now, what i want to do is, i have to find out difference between user1 and user2 data and the Difference data will be updated/inserted into the user2.
    Any ideas please...
    Thanks in advance,
    Pal

    Will trigger help you ... ie. for every update/insert on user1 will do on user2-- it is heavy to do for all table...
    --svmg                                                                                                                                                                                                                                                                   

  • Update/Insert key matching

    I've got a table in OWB that has a surrogate key as the unique key and the natural key (matching the source data) as part of the orginal key and a lookup value that's part of a dimension in OWB.
    I'm trying to figure out how to get OWB to match data to do an update/insert on the incoming data, but I keep getting VLD-2780 errors (saying that it can't update the surrogate key because it comes from a sequence). Duh..
    The short of it is this:
    Source_Table (key_part1, key_part2, key_part3)
    Dest_table (surrogate_key, key_part1, dimension_key)
    The dimension key is obtained from a key_lookup using key_part2 and key_part3 to return a single dimension key.
    I have a PK on the surrogate key and a unique key on key_part1, dimension_key in the DEST table. The source_table has a PK across all three columns.
    What's the proper way to tell OWB how to match data between teh two tables for an update/insert?
    Thanks!

    Hi!
    Make sure to have the following properties set correcty in the mapping editor:
    For the target table: "match by constraint" : choose the key yo want to use or "No constraints" if you do not wish to use any key.
    For each attribute of the target table:
    Loading properties:
    Load column when updating: no for your matching fields, yes otherwise
    Match column when updating: yes for your matching fields, no otherwise
    Load column when inserting: yes
    Load column when updating must be no for the primary key!
    Regards,
    Carsten.

  • HT201210 I have tried to update to IOS6 and it has prompted me to connect to ITunes but when I do I keep getting the message ' There is no sim card inserted in the Iphone you are trying to activate'.  My phone is now locked on the IOS6 update screen!

    I have been without mu IPhone 4 since yesterday now as I tried to do the IOS6 update and since then it has messed up my phone and I am unable to access any of it's functions as it is locked on the update screen. 
    My phone was bought through Vodfone and have been on their network ever since, never had any problems like this.
    It prompts me to connect to ITunes and when I do it will not go any further as stating 'No sim card is inserted in the IPhone you are trying to activate'.  Well there is a sim in there and I have removed it and reinserted it on many occasions today.  I am also not trying to activate my phone as all I did was try to the update which I was prompted to do in my setting!
    I have seen many people on the net today with the same or similar problems but as yet I am to find a solution!
    Help, please as it is driving me crazy!!!

    Try a Hard Reset.....
    Press and hold the Wake / Sleep button AND the Home button at the same time, keep them both pressed until the Apple Logo appears on the screen, it can take 10 or more seconds.  Ignore the swipe to turn off message.

  • In jdbc adapter what is the difference between insert and update insert

    in jdbc adapter what is the difference between insert and update insert
    Edited by: katru vijay on Mar 22, 2010 7:43 AM

    Please refer to this Link [Document Formats for the Receiver JDBC Adapter|http://help.sap.com/saphelp_nw04/Helpdata/EN/22/b4d13b633f7748b4d34f3191529946/frameset.htm]
    Hope this helps.
    Regards,
    Chandravadan

  • I WANT THE RESULT PAGE OF MY INSERT FORM TO BE AN UPDATE FORM OF THE JUST INSERTED DATA

    I WANT THE RESULT PAGE OF MY INSERT FORM TO BE AN UPDATE FORM OF THE JUST INSERTED DATA USING ADDT. PLS HELP WITH EXMPLE . THANKS

    let me xplain
    i am trying to create a 3  page form. i used the insert form wizard to create the first form and ask the form to go to the next page which i made an update form to continue the next set of fields. i tried what u said...but the next form did not add records to the database as i expected.below is my code for the two pages. pls tell me the best approach..thanks
    page 1
    <?php require_once('Connections/crusader.php'); ?>
    <?php
    //MX Widgets3 include
    require_once('includes/wdg/WDG.php');
    // Load the common classes
    require_once('includes/common/KT_common.php');
    // Load the tNG classes
    require_once('includes/tng/tNG.inc.php');
    // Make a transaction dispatcher instance
    $tNGs = new tNG_dispatcher("");
    // Make unified connection variable
    $conn_crusader = new KT_connection($crusader, $database_crusader);
    // Start trigger
    $formValidation = new tNG_FormValidation();
    $tNGs->prepareValidation($formValidation);
    // End trigger
    // Make an insert transaction instance
    $ins_capital = new tNG_insert($conn_crusader);
    $tNGs->addTransaction($ins_capital);
    // Register triggers
    $ins_capital->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Insert1");
    $ins_capital->registerTrigger("BEFORE", "Trigger_Default_FormValidation", 10, $formValidation);
    $ins_capital->registerTrigger("END", "Trigger_Default_Redirect", 99, "top.php");
    // Add columns
    $ins_capital->setTable("capital");
    $ins_capital->addColumn("cap_firstname", "STRING_TYPE", "POST", "cap_firstname");
    $ins_capital->addColumn("cap_username", "STRING_TYPE", "POST", "cap_username");
    $ins_capital->addColumn("cap_lastname", "STRING_TYPE", "POST", "cap_lastname");
    $ins_capital->addColumn("cap_dateofbirth", "DATE_TYPE", "POST", "cap_dateofbirth", "{NOW}");
    $ins_capital->addColumn("cap_sex", "STRING_TYPE", "POST", "cap_sex");
    $ins_capital->setPrimaryKey("cap_id", "NUMERIC_TYPE");
    // Execute all the registered transactions
    $tNGs->executeTransactions();
    // Get the transaction recordset
    $rscapital = $tNGs->getRecordset("capital");
    $row_rscapital = mysql_fetch_assoc($rscapital);
    $totalRows_rscapital = mysql_num_rows($rscapital);
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xmlns:wdg="http://ns.adobe.com/addt">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <link href="includes/skins/mxkollection3.css" rel="stylesheet" type="text/css" media="all" />
    <script src="includes/common/js/base.js" type="text/javascript"></script>
    <script src="includes/common/js/utility.js" type="text/javascript"></script>
    <script src="includes/skins/style.js" type="text/javascript"></script>
    <?php echo $tNGs->displayValidationRules();?>
    <script type="text/javascript" src="includes/common/js/sigslot_core.js"></script>
    <script type="text/javascript" src="includes/wdg/classes/MXWidgets.js"></script>
    <script type="text/javascript" src="includes/wdg/classes/MXWidgets.js.php"></script>
    <script type="text/javascript" src="includes/wdg/classes/Calendar.js"></script>
    <script type="text/javascript" src="includes/wdg/classes/SmartDate.js"></script>
    <script type="text/javascript" src="includes/wdg/calendar/calendar_stripped.js"></script>
    <script type="text/javascript" src="includes/wdg/calendar/calendar-setup_stripped.js"></script>
    <script src="includes/resources/calendar.js"></script>
    </head>
    <body>
    <p> 
      <?php
        echo $tNGs->getErrorMsg();
    ?>
    <form method="post" id="form1" action="<?php echo KT_escapeAttribute(KT_getFullUri()); ?>">
      <table cellpadding="2" cellspacing="0" class="KT_tngtable">
        <tr>
          <td class="KT_th"><label for="cap_firstname">Cap_firstname:</label></td>
          <td><input type="text" name="cap_firstname" id="cap_firstname" value="<?php echo KT_escapeAttribute($row_rscapital['cap_firstname']); ?>" size="32" />
            <?php echo $tNGs->displayFieldHint("cap_firstname");?> <?php echo $tNGs->displayFieldError("capital", "cap_firstname"); ?></td>
        </tr>
        <tr>
          <td class="KT_th"><label for="cap_lastname">Cap_lastname:</label></td>
          <td><input type="text" name="cap_lastname" id="cap_lastname" value="<?php echo KT_escapeAttribute($row_rscapital['cap_lastname']); ?>" size="32" />
            <?php echo $tNGs->displayFieldHint("cap_lastname");?> <?php echo $tNGs->displayFieldError("capital", "cap_lastname"); ?></td>
        </tr>
        <tr>
          <td class="KT_th"><label for="cap_dateofbirth">Cap_dateofbirth:</label></td>
          <td><input name="cap_dateofbirth" id="cap_dateofbirth" value="<?php echo KT_formatDate($row_rscapital['cap_dateofbirth']); ?>" size="32" wdg:mondayfirst="false" wdg:subtype="Calendar" wdg:mask="<?php echo $KT_screen_date_format; ?>" wdg:type="widget" wdg:singleclick="true" wdg:restricttomask="no" />
            <?php echo $tNGs->displayFieldHint("cap_dateofbirth");?> <?php echo $tNGs->displayFieldError("capital", "cap_dateofbirth"); ?></td>
        </tr>
        <tr>
          <td class="KT_th"><label for="cap_sex">Cap:</label></td>
          <td><input type="text" name="cap_sex" id="cap_sex" value="<?php echo KT_escapeAttribute($row_rscapital['cap_sex']); ?>" size="32" />
            <?php echo $tNGs->displayFieldHint("cap_sex");?> <?php echo $tNGs->displayFieldError("capital", "cap_sex"); ?></td>
        </tr>
        <tr class="KT_buttons">
          <td colspan="2"><input type="submit" name="KT_Insert1" id="KT_Insert1" value="Insert record" /></td>
        </tr>
      </table>
    </form>
    <p> </p>
    </p>
    </body>
    </html>
    Page2
    <?php require_once('Connections/crusader.php'); ?>
    <?php
    // Load the common classes
    require_once('includes/common/KT_common.php');
    // Load the tNG classes
    require_once('includes/tng/tNG.inc.php');
    // Make a transaction dispatcher instance
    $tNGs = new tNG_dispatcher("");
    // Make unified connection variable
    $conn_crusader = new KT_connection($crusader, $database_crusader);
    // Start trigger
    $formValidation = new tNG_FormValidation();
    $tNGs->prepareValidation($formValidation);
    // End trigger
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    mysql_select_db($database_crusader, $crusader);
    $query_rdd = "SELECT * FROM capital ORDER BY cap_id DESC LIMIT 1";
    $rdd = mysql_query($query_rdd, $crusader) or die(mysql_error());
    $row_rdd = mysql_fetch_assoc($rdd);
    $totalRows_rdd = mysql_num_rows($rdd);
    // Make an update transaction instance
    $upd_capital = new tNG_update($conn_crusader);
    $tNGs->addTransaction($upd_capital);
    // Register triggers
    $upd_capital->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Update1");
    $upd_capital->registerTrigger("BEFORE", "Trigger_Default_FormValidation", 10, $formValidation);
    // Add columns
    $upd_capital->setTable("capital");
    $upd_capital->addColumn("cap_firstname", "STRING_TYPE", "POST", "cap_firstname");
    $upd_capital->addColumn("cap_dateofbirth", "DATE_TYPE", "POST", "cap_dateofbirth");
    $upd_capital->addColumn("cap_mobilephone", "STRING_TYPE", "POST", "cap_mobilephone");
    $upd_capital->addColumn("cap_occupation", "STRING_TYPE", "POST", "cap_occupation");
    $upd_capital->addColumn("cap_sumassured", "STRING_TYPE", "POST", "cap_sumassured");
    $upd_capital->setPrimaryKey("cap_id", "NUMERIC_TYPE", "GET", "cap_id");
    // Execute all the registered transactions
    $tNGs->executeTransactions();
    // Get the transaction recordset
    $rscapital = $tNGs->getRecordset("capital");
    $row_rscapital = mysql_fetch_assoc($rscapital);
    $totalRows_rscapital = mysql_num_rows($rscapital);
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <link href="includes/skins/mxkollection3.css" rel="stylesheet" type="text/css" media="all" />
    <script src="includes/common/js/base.js" type="text/javascript"></script>
    <script src="includes/common/js/utility.js" type="text/javascript"></script>
    <script src="includes/skins/style.js" type="text/javascript"></script>
    <?php echo $tNGs->displayValidationRules();?>
    </head>
    <body>
    <p> 
    <p> 
      <?php
        echo $tNGs->getErrorMsg();
    ?>
    <form method="post" id="form1" action="<?php echo KT_escapeAttribute(KT_getFullUri()); ?>">
      <table cellpadding="2" cellspacing="0" class="KT_tngtable">
        <tr>
          <td class="KT_th"><label for="cap_firstname">Cap_firstname:</label></td>
          <td><input type="text" name="cap_firstname" id="cap_firstname" value="<?php echo KT_escapeAttribute($row_rdd['cap_firstname']); ?>" size="32" />
            <?php echo $tNGs->displayFieldHint("cap_firstname");?> <?php echo $tNGs->displayFieldError("capital", "cap_firstname"); ?></td>
        </tr>
        <tr>
          <td class="KT_th"><label for="cap_dateofbirth">Cap_dateofbirth:</label></td>
          <td><input type="text" name="cap_dateofbirth" id="cap_dateofbirth" value="<?php echo KT_formatDate($row_rdd['cap_dateofbirth']); ?>" size="32" />
          <?php echo $tNGs->displayFieldHint("cap_dateofbirth");?> <?php echo $tNGs->displayFieldError("capital", "cap_dateofbirth"); ?></td>
        </tr>
        <tr>
          <td class="KT_th"><label for="cap_mobilephone">Cap_mobilephone:</label></td>
          <td><input type="text" name="cap_mobilephone" id="cap_mobilephone" value="<?php echo KT_escapeAttribute($row_rdd['cap_mobilephone']); ?>" size="32" />
          <?php echo $tNGs->displayFieldHint("cap_mobilephone");?> <?php echo $tNGs->displayFieldError("capital", "cap_mobilephone"); ?></td>
        </tr>
        <tr>
          <td class="KT_th"><label for="cap_occupation">Cap_occupation:</label></td>
          <td><input type="text" name="cap_occupation" id="cap_occupation" value="<?php echo KT_escapeAttribute($row_rdd['cap_occupation']); ?>" size="32" />
          <?php echo $tNGs->displayFieldHint("cap_occupation");?> <?php echo $tNGs->displayFieldError("capital", "cap_occupation"); ?></td>
        </tr>
        <tr>
          <td class="KT_th"><label for="cap_sumassured">Cap_sumassured:</label></td>
          <td><input type="text" name="cap_sumassured" id="cap_sumassured" value="<?php echo KT_escapeAttribute($row_rdd['cap_sumassured']); ?>" size="32" />
          <?php echo $tNGs->displayFieldHint("cap_sumassured");?> <?php echo $tNGs->displayFieldError("capital", "cap_sumassured"); ?></td>
        </tr>
        <tr class="KT_buttons">
          <td colspan="2"><input type="submit" name="KT_Update1" id="KT_Update1" value="Update record" /></td>
        </tr>
      </table>
    </form>
    <p> </p>
    </p>
    </p>
    </body>
    </html>
    <?php
    mysql_free_result($rdd);
    ?>

  • Insert only the updated Fields

    I have a log table based on the master table. The master table have 50 fields. Any update in the master data has to be logged in a new table. So the master table will have only the last updated data.
    Any change in the master table to be inserted in to a logged table. I need to insert only the updated fileds not all the fields.
    How to write insert statement in forms 6i for inserting to a logged table where only the changed fields.
    INSERT TO EMASTER_LOGTABLE
    (ECODE,
    ENAME,
    EDEPT,
    ETRADE
    VALUES
    (:ECODE,
    :ENAME,
    :EDEPT,
    :ETRADE
    Row will be inserted in to the EMASTER_LOGTABLE with the updated field only not all the field except primary.

    Hi!
    Whats about a new idea?
    Create a new table:
    create table EMASTER_HISTORY (
    EMP_CODE        number(6),  --> i don't know yours
    CHANGED_COLUMN  varchar2(30) not null,
    CHANGED_USER    varchar2(30) default user not null,
    CHANGE_TIME     date default sysdate not null,
    OLD_VALUE       varchar2(4000),
    NEW_VALUE       varchar2(4000) )
    storage ( your storage );In your form create a pre-update-trigger on your block like:
    declare
    l_item varchar2(30) := get_block_property ( 'your_block', first_item );
    l_data_old varchar2(4000);
    l_data_new varchar2(4000);
    begin
    loop
      if
       get_item_property ( 'your_block.' || l_item, item_type ) in ( 'BUTTON', 'IMAGE' )
      then
        null;
      elsif
        get_item_property ( 'your_block.' || l_item, database_value ) != name_in ( 'your_block.' || l_item ) OR
         ( get_item_property ( 'your_block.' || l_item, database_value ) is null AND name_in ( 'your_block.' || l_item ) is not null ) OR
         ( get_item_property ( 'your_block.' || l_item, database_value ) is not null AND name_in ( 'your_block.' || l_item ) is null )
      then
        l_data_old := get_item_property ( 'your_block.' || l_item, database_value );
        l_data_new := name_in ( 'your_block.' || l_item );
        insert into test.emaster_history ( emp_code, changed_column, old_value, new_value )
        values ( :your_block.emp_code, l_item, l_data_old, l_data_new );
      end if;
      exit when l_item = get_block_property ( 'your_block', last_item );
      l_item := get_item_property ( 'your_block.' || l_item, nextitem );
    end loop;
    exception
    when others then message ( l_item || ': ' || nvl ( error_text, dbms_error_text ) );
    end;So, for every updated item in your form you will have a record in EMASTER_HISTORY with timestamp
    and you're able to read the history of data in every column in your emp_master table.
    Addition:
    The only disadvantage is, non database items may will be logged too.
    This because i don't know a "clean" item property to find out, if a item is a database item.
    The item property column_name is not required and could by null alltough the item is a database item.
    Regards

  • What's the exact trigger for when updating/inserting/deleting data from one DB to another DB which contains same info?

    Hi guys,
    I have created a copy of the AdventureWorks2012 DB called AdventureWorks2012_new on the same instance.
    I have created the following trigger below but my friend who is a DBA told me that this is not correct and I should be using the inserted table when creating this trigger. I would like AdventureWorks2012_new DB to be updating/inserting/deleting data from
    the same tables that have been updated/inserted/deleted in the AdventureWorks2012 DB. How exactly should I do this for all the tables in the whole database ? What I have written below is just for one of the tables, is there a quicker way to do it for all tables
    in this DB so that it performs the actions mentioned above, automatically ? Help would be greatly appreciated so I can understand how this works, thanks
    CREATE TRIGGER [HumanResources].[tr_HumanResources_AfterUpdate]
    ON [AdventureWorks2012].[HumanResources].[Department]
    AFTER UPDATE
    AS
    BEGIN
    SET NOCOUNT ON;
    UPDATE AdventureWorks2012_new.HumanResources.Department
    SET Name = t2.Name,
    GroupName = t2.GroupName,
    ModifiedDate = t2.ModifiedDate
    FROM AdventureWorks2012.HumanResources.Department AS t2
    INNER JOIN AdventureWorks2012_new.HumanResources.Department AS t1
    ON t2.DepartmentID = t1.DepartmentID
    END

    For insert it's easy:
    CREATE TRIGGER [HumanResources].[tr_HumanResources_AfterInsert]
    ON [AdventureWorks2012].[HumanResources].[Department]
    AFTER INSERT
    AS
    BEGIN
    SET NOCOUNT ON;
    Insert INTO AdventureWorks2012_new.HumanResources.Department
    (DepartmentID, Name, GroupName, ModifiedDate)
    SELECT DepartmentID, Name, GroupName, ModifiedDate
    FROM Inserted;
    END
    I didn't verify column names, so you may need to make sure to use correct column names for that table.
    Setting replication is a bit advanced topic although BOL is clear and you may start here
    http://technet.microsoft.com/en-us/library/ms151198.aspx
    If it will be complicated for you, you can ask extra questions in the MSDN Replication forum.
    For every expert, there is an equal and opposite expert. - Becker's Law
    My blog
    My TechNet articles

  • How to do update instead of insert / cancel the insert

    Hello,
    we are porting an application, written originally for PostgreSQL, to Oracle. Most of the porting is pretty straightforward - change column types, simple trigger syntax changes etc.
    But we have a table (more precisely several tables) with a set of triggers, holding a tree-like structure. The point is in PostgreSQL we're using a RETURN NULL; behavior in BEFORE triggers, which means 'do nothing' to simplify thing.
    For example imagine tables A and B - and in a trigger on B we could have something like
    INSERT INTO A VALUES (id, ...)
    without a check on a uniqueness of the id value. And in a BEFORE INSERT trigger on A we have something like
    SELECT INTO c id FROM A where id = NEW.id;
    IF FOUND THEN
    UPDATE A SET .... WHERE id = NEW.id;
    -- cancel the insert without an exception
    RETURN NULL;
    END IF;
    which checks for existence of the row, and if it already exists it effectively replaces with UPDATE and cancels the INSERT without an exception.
    Is there something like this in Oracle or do I have to completely rewrite / refactor the whole thing?
    PS: We do have UNIQUE (more precisely PRIMARY KEY) on the columns - I am aware that this is not sufficient to enforce uniqueness in Oracle.

    There are a couple of ways that this could be accomplished in Oracle, although the though of an insert into table b also inserting or updating rows in table a makes me cringe. The easiest way only requires a trigger on table b.
    Something along the lines of:
    SQL> CREATE TABLE a (ID NUMBER PRIMARY KEY, descr VARCHAR2(10));
    Table created.
    SQL> CREATE TABLE b (id NUMBER, descr VARCHAR2(10), descr2 VARCHAR2(20));
    Table created.
    SQL> CREATE TRIGGER b_bi
      2     BEFORE INSERT ON b
      3     FOR EACH ROW
      4  BEGIN
      5     INSERT INTO a VALUES (:new.id, :new.descr);
      6  EXCEPTION
      7     WHEN DUP_VAL_ON_INDEX THEN
      8        UPDATE a SET descr = :new.descr
      9        WHERE id = :new.id;
    10  END;
    11  /
    Trigger created.
    SQL> INSERT INTO a VALUES(1, 'One');
    1 row created.
    SQL> COMMIT;
    Commit complete.
    SQL> INSERT INTO b VALUES(1, 'NewOne', 'New One');
    1 row created.
    SQL> SELECT * FROM a;
            ID DESCR
             1 NewOne
    SQL> INSERT INTO b VALUES(2, 'Two', 'Old Two');
    1 row created.
    SQL> SELECT * FROM a;
            ID DESCR
             1 NewOne
             2 Two
    SQL> COMMIT;
    Commit complete.If you really require the trigger on table a for other reasons, then you could do something like:
    SQL> RENAME a to a_table;
    Table renamed.
    SQL> CREATE VIEW a AS SELECT * FROM a_table;
    View created.
    SQL> CREATE TRIGGER a_ii
      2     INSTEAD OF INSERT ON a
      3     FOR EACH ROW
      4  BEGIN
      5     INSERT INTO a_table VALUES(:new.id, :new.descr);
      6  EXCEPTION
      7     WHEN DUP_VAL_ON_INDEX THEN
      8        UPDATE a_table SET descr = :new.descr
      9        WHERE id = :new.id;
    10  END;
    11  /
    Trigger created.
    SQL> CREATE OR REPLACE TRIGGER b_bi
      2     BEFORE INSERT ON b
      3     FOR EACH ROW
      4  BEGIN
      5     INSERT INTO a VALUES (:new.id, :new.descr);
      6  END;
      7  /
    Trigger created.
    SQL> INSERT INTO b VALUES(2, 'NewTwo', 'New Two');
    1 row created.
    SQL> SELECT * FROM a;
            ID DESCR
             1 NewOne
             2 NewTwo
    SQL> INSERT INTO b VALUES(3, 'Three','Third');
    1 row created.
    SQL> SELECT * FROM a;
            ID DESCR
             1 NewOne
             2 NewTwo
             3 ThreeNeither should require any changes to your application code. However, once agan, I think it is a really bad idea for triggers to have side efects on other tables.
    John

  • After update insert trigger is not working correctly

    Hello experts!
    I created an after insert/update trigger and what strikes me is that it is not working as expected.
    The trigger launches a procedure that does an insert in a second table if values in the triggered table ("my_table") are altered.
    The problem is that the values in my second table, which are correlated to "my_table", are not changed with the correct values right away. The trigger and insert trails behind!
    I have to update twice for the values to appear in my second table. Only then, the data of the first update will be inserted into the second table wheras the parent table ("my_table") will hold the latest values.
    Do you have an idea what could be wrong?
    create or replace
    trigger myscheme.after_update_insert_set_tw
    after update or insert
      on myscheme.my_table
      for each row
    declare
    begin
    pr_my_table_tw_sync_sk(:new.lng_falle, :new.int_fallennummer, :new.lng_schaedling, :new.objectid);
    end;Brgds,
    Seb

    Okay I'll give my best to explain what my procedure is supposed to do and what the table structure is like. I hope it'll help you to help me :-)
    My parent table is called fangzahlen and is created as follows:
    CREATE TABLE "BORKI"."FANGZAHLEN"
       (     "OBJECTID" NUMBER(10,0) NOT NULL ENABLE,
         "LNG_FALLE" NUMBER(10,0) NOT NULL ENABLE,
         "LNG_BEARBEITER" NUMBER(10,0),
         "DATE_DATUM" DATE DEFAULT SYSDATE NOT NULL ENABLE,
         "INT_FALLENNUMMER" NUMBER(4,0) NOT NULL ENABLE,
         "LNG_SCHAEDLING" NUMBER(2,0) NOT NULL ENABLE,
         "INT_VOLUMEN" NUMBER(10,0),
         "INT_ANZAHL" NUMBER(10,0),
         "INT_ANTEIL_JUNGKAEFER" NUMBER(3,0),
         "BOOL_KOEDERWECHSEL" NUMBER(1,0),
          CONSTRAINT "PK_FANGZAHLEN" PRIMARY KEY ("OBJECTID")
      USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS"  ENABLE,
          CONSTRAINT "CHECK_DATE_DATUM" CHECK ("DATE_DATUM" >= '1.apr.2006') ENABLE
       ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS" ;It holds values such as:
    OBJECTID,"LNG_FALLE","LNG_BEARBEITER","DATE_DATUM","INT_FALLENNUMMER","LNG_SCHAEDLING","INT_VOLUMEN","INT_ANZAHL","INT_ANTEIL_JUNGKAEFER","BOOL_KOEDERWECHSEL"
    97548,"39","1081","08.04.10","1","2","","220","","0"
    97534,"39","1081","06.04.10","1","2","","100","","-1"My subtable is called tbl_test and created with:
    CREATE TABLE "BORKI"."TBL_TEST"
       (     "OBJECTID" NUMBER(12,0) NOT NULL ENABLE,
         "LNG_FALLE" NUMBER(10,0),
         "DATE_DATUM" DATE,
         "INT_FALLENNUMMER" NUMBER(4,0),
         "LNG_SCHAEDLING" NUMBER(2,0),
         "INT_VOLUMEN" NUMBER(10,0),
         "INT_ANZAHL" NUMBER(10,0),
         "LNG_FANGZAHLEN" NUMBER(12,0)
       ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS" ;Okay, this were the prerequisites!
    Let's concentrate on the trigger and procedure:
    The purpose of the procedure is to insert data into tbl_test once a record in "fangzahlen" has been updated or inserted.
    Tbl_test holds the mean average values (int_anzahl) for a number of collected items (lng_schaedling).
    I need to insert date values for the combination of each lng_fangzahlen, lng_schaedling, lng_falle and int_fallennr into tbl_test.
    If I had the following data in table fangzahlen:
    97548,"39","1081","08.04.10","1","2","","220","","0"
    97534,"39","1081","06.04.10","1","2","","100","","-1"the query in the insert section of my procedure returns the following data when run manually:
    97534     31.03.10     16,667     (null)     1     39     2
    97548     06.04.10     110     (null)     1     39     2Now, I need to generate the dates between the first and the second objectid (column 1 in the data above).
    Hence,
    97534     31.03.10     16,667     (null)     1     39     2
    97534     01.04.10     16,667     (null)     1     39     2
    97534     02.04.10     16,667     (null)     1     39     2
    97534     03.04.10     16,667     (null)     1     39     2
    97534     04.04.10     16,667     (null)     1     39     2
    97534     05.04.10     16,667     (null)     1     39     2
    97534     06.04.10     16,667     (null)     1     39     2
    97548     07.04.10     110     (null)     1     39     2
    97548     08.04.10     110     (null)     1     39     2
    My problem is thatthe values above will only appear after I do another update to table fangzahlen or insert a new record into it. Theoretically the result above should be inserted right away?
    Below is my procedure, which might give you a better idea of what I am trying to do! Please excuse this rather awkward explanation. If you need more info please don't hesitate to ask for it!
    create or replace
    Procedure "PR_FANGZAHLEN_TW_SYNC_SK"
        Pr_falle        Number,
        Pr_fallennummer Number,
        Pr_schaedling   Number,
        Pr_objectid     Number)
    Is
      Y                Number (10);
      pragma autonomous_transaction;
    Begin
    -- first all records should be deleted from the subtable i.e. tbl_test
        delete from borki.tbl_test where lng_falle = pr_falle
            and int_fallennummer = pr_fallennummer
            and lng_schaedling   = pr_schaedling
           and date_datum       > '31.03.2010';
          commit;
          For Rec In
          (select objectid lng_fangzahlen,
            date_datum,
            prev_date,
            (date_datum - prev_date) difference_in_days,
            round((
            case
              when nvl(int_volumen,0) > 0
              and lng_schaedling      = 1
              then int_volumen * 40
              when nvl(int_volumen,0) > 0
              and lng_schaedling      = 2
              then int_volumen * 550
              when nvl(int_anzahl,0) > 0
              then int_anzahl
            end ) / (date_datum - prev_date),3) counted_bugs,
            int_fallennummer,
            lng_falle,
            lng_schaedling
          from
            (select objectid,
              date_datum,
              case
                when lag(date_datum) over(order by date_datum) is null
                then to_date('31.03.2010')
                else lag(date_datum) over(order by date_datum)
              end as prev_date,
              int_volumen,
              int_anzahl,
              int_fallennummer,
              lng_falle,
              lng_schaedling
            from borki.fangzahlen
            where lng_falle      = pr_falle
            and int_fallennummer = pr_fallennummer
            and lng_schaedling   = pr_schaedling
            and date_datum       > '31.03.2010'
           -- and objectid         = pr_objectid
            order by date_datum desc
          order by date_datum asc
          Loop
            Y := 1;
            While Y < rec.difference_in_days + 1
            Loop
              Insert
              Into tbl_test
                  lng_fangzahlen,
                  date_datum,
                  int_anzahl,
                  int_volumen,
                  int_fallennummer,
                  lng_falle,
                 lng_schaedling
              select objectid lng_fangzahlen,
            prev_date +Y,
            round((
            case
              when nvl(int_volumen,0) > 0
              and lng_schaedling      = 1
              then int_volumen * 40
              when nvl(int_volumen,0) > 0
              and lng_schaedling      = 2
              then int_volumen * 550
              when nvl(int_anzahl,0) > 0
              then int_anzahl
            end ) / (date_datum - prev_date),3) counted_bugs,
            int_volumen,
            int_fallennummer,
            lng_falle,
            lng_schaedling
          from
            (select objectid,
              date_datum,
              case
                when lag(date_datum) over(order by date_datum) is null
                then to_date('31.03.2010')
                else lag(date_datum) over(order by date_datum)
              end as prev_date,
              int_volumen,
              int_anzahl,
              int_fallennummer,
              lng_falle,
              lng_schaedling
            from borki.fangzahlen
            where lng_falle      = pr_falle
            and int_fallennummer = pr_fallennummer
            and lng_schaedling   = pr_schaedling
            and date_datum       > '31.03.2010'
            order by date_datum desc
          order by date_datum asc
              commit;
              Y := Y + 1;
            End Loop;
          End Loop; -- end of cursor
      Exception
      When No_data_found Then
        Null;
      When Others Then
        -- Consider logging the error and then re-raise
        Raise;
      End "PR_FANGZAHLEN_TW_SYNC_SK";

  • Error While updating info in the People Form-Additional Personla Details

    Hi All,
    Iam getting an Error While updating information in the People Form,Additional Personla Details DFF.
    Error Like:
    APP-PER-289974:There has been an error Processing this person,The error encountered is 'ORA-20001:HZ_STNC_SQL_EXCEP:N,PROC.sync_Person,N,ERROR.ORA-25153:Temporary Tablespace is empty ,N,POO,1265890',which occured in procedure  per_htrca_merge_tca_person at step10.
    Please contact your support represntative.
    Thanks -
    Sowmya

    Thanks you,
    By this Note id:395136.1
    Iam unable to find this Set profile 'HZ: Generate Events for DQM Real-Time Synchronization' to No
    with this Note id:278422.1
    We are unable to find this proifle option : HZ: Data Sharing and Security Enabled profile
    we are using applications 11i.
    please help to find this Profile option.
    But with this note id:ID 395136.1
    This is Working.
    Query for HZ: DQM Synchronization Method profile. Set the value to Disable.
    But iam facing proble while uploding data to DFF ,Error--SQL exception occurred during PL/SQL upload.
    Thanks for the Support-
    Sowmya.
    Edited by: user13419037 on Aug 11, 2011 11:53 PM
    Edited by: user13419037 on Aug 12, 2011 12:03 AM
    Edited by: user13419037 on Aug 12, 2011 3:45 AM

Maybe you are looking for

  • Macbook (mid 2012, 9,2) has very poor performance since the day I bought it (less than 2 months ago)

    Problem description: My macbook is extremely slow since the day I bought it (which was less than 2 months ago)…Came preinstalled with Mavericks and 4GB of RAM. Upgraded it to 16GB hoping that would help, but that did very little…then upgraded to Yose

  • Query from multiple data blocks

    Hello professionals, I having difficulty in finding solutions to query data from multiple data blocks. By the way I'm using Oracle Forms 10g I have 4 data blocks and all items are database items Below are the blocks, 1. student_main (columns : studen

  • Absolute links - help - am going NUTS!

    This is crazy and is probably really simple but I have been going round in circles allday.... I am trying to hyperlink to an external web site. I set up the hyperlink with the absolute address however when I publish the site it appears as a link to m

  • Problems with the sound - headphones in Macbook!!

    Hi! I have one of the lastest Macbook, with Core 2 Duo 2,16 Ghz, and I have the first problem (hope the last one ) . I usually use the headphones out to connect the music to large speakers and listen to the music louder, but when I go out and use the

  • Using iDVD 6 favourite themes in idvd 4

    I have saved several themes in iDVD 6 on my Mac Mini and due to problems with compatability I have to use iDVd 4 on my Mac G4. Is it possible to use themes created with iDVD 6 within iDVD 4 and how? Thanks in advance.