Question Intermediate table

Could someone please help:
     I have an application where I'm tracking safety injury information.  Each Injury incident has multiple fields pertaining to the a accident along with about 13 text questions that a user will need to fill out to complete the
incident.  Thus I have the following tables.  1. Incident 2.  IncidentNotes 3. Notes
Incident - will contain all the unique information pertaining to the injury.
IncidentNotes - I'm thinking will be the intermediate table.
Notes - holds each note. (contains a field 'Note' nvarchar(max))
Here's my issue.   At first I was thinking that the IncidentNotes would have a IncideintNotesID, IncidentID (FK), NoteID (FK).  That's great if Incident just had multiple notes.  But how do I keep track of which note refers to which question
in the incident?
Any Ideas would really be appreciated.  (Sorry if this is a newby question)

Please try this: 
CREATE DATABASE TEST
GO
USE TEST
GO
CREATE TABLE Incident
IncidentId INT PRIMARY KEY ,
field1 NVARCHAR(100) ,
field2 NVARCHAR(200)
GO
CREATE TABLE Question
QuestionId INT PRIMARY KEY ,
Title NVARCHAR(1000)
GO
CREATE TABLE IncidentNotes
IncidentId INT NOT NULL ,
QuestionId INT NOT NULL ,
Note NVARCHAR(1000)
GO
ALTER TABLE IncidentNotes
ADD CONSTRAINT pK_IncidentNotes PRIMARY KEY (IncidentId, QuestionId );
GO
ALTER TABLE dbo.IncidentNotes ADD CONSTRAINT
FK_IncidentNotes_Question FOREIGN KEY
QuestionId
) REFERENCES dbo.Question
QuestionId
GO
ALTER TABLE dbo.IncidentNotes ADD CONSTRAINT
FK_IncidentNotes_Incident FOREIGN KEY
IncidentId
) REFERENCES dbo.Incident
IncidentId
GO
T-SQL Articles
T-SQL e-book by TechNet Wiki Community
T-SQL blog

Similar Messages

  • JHeadstart and Intermediate Tables

    Howdy y'all,
    Here's the situation:
    I'm using Oracle JDeveloper with JHeadstart (Latest versions for 9i). I'm using the Struts/UIX option for building the web pages. I have three tables that are inter-related:
    REPORT: Maintains reports written by Inspectors (PK: REPORTID).
    INSPECTOR: Maintains ID information of Inspectors (PK: INSPECTORID).
    Many Reports are written/updated by one Inspector.
    Many Inspectors write on one report.
    This creates a many-to-many relationship. To fix this problem, I have an Intermediate Table called REPORT_INSPECTOR with a composite primary key composed of REPORTID and INSPECTORID. Both PKs are Foreign Keys in the intermediate table also.
    Now, here's the BIG question: How do I make that table a tabbed web page through JHeadstart? I want the inspectors to be able to select from a pull-down menu a list of inspectors to choose from. The REPORTID should be passed to the web page and just wait for an INSPECTORID to insert into the intermediate table. I'm thinking of using a table-form format for the tabbed page.
    Thanks in advance for any help/insight offered!
    Tracy-Paul Warrington

    Bump back to top.

  • Drop, create and insert data into few intermediate tables

    Hi All,
    I need to schedule a process to drop, create and insert data into few intermediate tables on a weekly basis. Here is what i need to do in the stored procedure, which can be scheduled weekly.
    DROP TABLE TABLE_NAME1;
    DROP TABLE TABLE_NAME2;
    DROP TABLE TABLE_NAME3;
    CREATE TABLE TABLE_NAME1
    CREATE TABLE TABLE_NAME2
    CREATE TABLE TABLE_NAME3
    INSERT INTO TABLE_NAME1 SELECT ....;
    INSERT INTO TABLE_NAME2 SELECT ....;
    INSERT INTO TABLE_NAME3 SELECT ....;
    Any suggestions, examples or code on how to accomplish this task would be very helpful. Any question pls let me know.
    Thanks in advance.

    I am using the intermediate tables in an extract process. The idea was that the table would be created prior to calling the extract procedure and once the data written to the intermediate table had been processed the table would be dropped. This would be repeated each time the extract process is run. From a DBA's point or view, would it be better to just leave the table on the database and truncate it after each run or is removing it entirely best?

  • Simple question about table structure and HR in BW

    i need to following data from HR:
    current FTE, employee number, cost place
    i dont think the current FTE is stored per employee. Therefor is would need a list that contains:
    mutation start date, mutation end date, FTE, employee, cost place
    i think cost place is a custom field.
    my question : what tables names and field names do i need?
    Thanks in advanced

    Hi,
    For Head Count you can use 0HR_PA_0 datasource and the other Employee details like start date and end date you can get them from employee master data and FTE can be calculated from the Emloyee Master Data and Head count data.
    Hope this helps...
    Thanks,

  • How can I create a matrix question? Specifically, I need a question in table format that allows each respondent to list a number of events and then data for each event (date, location, number of participants, topics covered, etc.

    How can I create a matrix question? Specifically, I need a question in table format that allows each respondent to list a number of events and then data for each event (date, location, number of participants, topics covered, etc.

    Hi,
    Sorry, we do not support a matrix-question field.   Please try the multilines text field (where your participant can enter multiple lines in the input text box) and see if it works for you.
    Thanks,
    Lucia

  • Design Question for table - related columns

    Hi,
    I have some design question about table I am working on.
    Here are the sample fields in the table,
    process_begin_date
    process_approved_by
    process_signed_by
    process_monitor
    process_communication
    the same way I have around 10 groups, for ex
    other_begin_date
    other_approved_by
    other_signed_by
    other_email
    other_something
    Question: Is good have all 50 fields in the same table? or any better idea?

    Hi,
    Number of columns should not be any issue, but, proper normalization may be better for your design and scalability. If you can explain what you are storing in this table, you might get help if you need to have more than 2 tables in this particular scenario.
    If all these fields are related to a single entity, probably this single table is already normalized and needs not to be replaced by two tables.
    Salman

  • Out-of-Line Storage: an Intermediate Table is not created

    Hi
    I'm trying to use the "Out-of-Line Storage: Using an Intermediate Table to Store the List of References" sample from "Oracle XML DB Developer’s Guide".
    Here are my schemas:
    oebs_content_organization.xsd
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:oebs="http://www.rosbank.ru/oebs"
    targetNamespace="http://www.rosbank.ru/oebs/content/organization"
    xmlns:appsxx_organization="http://www.ibm.com/xmlns/prod/websphere/j2ca/jdbc/appsxx_organization_v"
    elementFormDefault="qualified" xmlns:xdb="http://xmlns.oracle.com/xdb"
    xdb:storeVarrayAsTable="true">
    <xsd:import schemaLocation="oebs.xsd" namespace="http://www.rosbank.ru/oebs"/>
    <xsd:import namespace="http://www.ibm.com/xmlns/prod/websphere/j2ca/jdbc/appsxx_organization_v"
    schemaLocation="AppsXx_Organization_V.xsd"/>
    <xsd:complexType name="contentOrganizationType" xdb:SQLType="CONTENT_ORGANIZATION_T">
    <xsd:complexContent>
    <xsd:extension base="oebs:contentAbstractType">
    <xsd:sequence minOccurs="1" maxOccurs="1">
    <xsd:element name="organization" minOccurs="1" maxOccurs="unbounded" xdb:SQLInline="false"
    xdb:defaultTable="ORGANIZATION"
    type="appsxx_organization:AppsXx_Organization_V"/>
    </xsd:sequence>
    </xsd:extension>
    </xsd:complexContent>
    </xsd:complexType>
    </xsd:schema>
    oebs_content_organization_element.xsd
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:organization="http://www.rosbank.ru/oebs/content/organization"
    targetNamespace="http://www.rosbank.ru/oebs/content/organization"
    xmlns:oebs="http://www.rosbank.ru/oebs" elementFormDefault="qualified"
    xmlns:xdb="http://xmlns.oracle.com/xdb" xdb:storeVarrayAsTable="true">
    <xsd:include schemaLocation="oebs_content_organization.xsd"/>
    <xsd:import schemaLocation="oebs.xsd" namespace="http://www.rosbank.ru/oebs"/>
    <xsd:element name="content" type="organization:contentOrganizationType"
    substitutionGroup="oebs:contentAbstract" xdb:SQLName="CONTENT_ORGANIZATION"
    xdb:defaultTable=""/>
    </xsd:schema>
    I registered them.
    But I can't find an Intermediate Table which have to keep the List of References to the "organization" element because next select doesn't return any result:
    SELECT * FROM USER_NESTED_TABLES
    Can anybody give me suggestion where these references are stored and how to index them?
    Thanks
    Dmitry

    You appear to hitting bug 5979468 which is fixed in 11g..
    With the heavy usage of inheritance in your XML Schemas I would VERY STRONGLY recommend that you upgrade to 11g immediately...
    SQL*Plus: Release 11.1.0.6.0 - Production on Wed May 14 22:08:49 2008
    Copyright (c) 1982, 2007, Oracle.  All rights reserved.
    SQL> spool testcase.log
    SQL> --
    SQL> connect sys/ as sysdba
    Enter password:
    Connected.
    SQL> --
    SQL> set define on
    SQL> set timing on
    SQL> --
    SQL> define USERNAME = ROSBANK
    SQL> --
    SQL> def PASSWORD = ROSBANK
    SQL> --
    SQL> def USER_TABLESPACE = USERS
    SQL> --
    SQL> def TEMP_TABLESPACE = TEMP
    SQL> --
    SQL> def DIRECTORY_PATH = &1
    SQL> --
    SQL> drop user &USERNAME cascade
      2  /
    old   1: drop user &USERNAME cascade
    new   1: drop user ROSBANK cascade
    User dropped.
    Elapsed: 00:00:00.51
    SQL> grant create any directory, drop any directory, connect, resource, alter session, create view to &USERNAME identified by &PASSW
    ORD
      2  /
    old   1: grant create any directory, drop any directory, connect, resource, alter session, create view to &USERNAME identified by &P
    ASSWORD
    new   1: grant create any directory, drop any directory, connect, resource, alter session, create view to ROSBANK identified by ROSB
    ANK
    Grant succeeded.
    Elapsed: 00:00:00.20
    SQL> alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
      2  /
    old   1: alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
    new   1: alter user ROSBANK default tablespace USERS temporary tablespace TEMP
    User altered.
    Elapsed: 00:00:00.04
    SQL> connect &USERNAME/&PASSWORD
    Connected.
    SQL> --
    SQL> alter session set events ='19027 trace name context forever, level 0x800'
      2  /
    Session altered.
    Elapsed: 00:00:00.00
    SQL> call xdb_utilities.createHomeFolder()
      2  /
    Call completed.
    Elapsed: 00:00:00.21
    SQL> create or replace directory XMLDIR as '&DIRECTORY_PATH'
      2  /
    old   1: create or replace directory XMLDIR as '&DIRECTORY_PATH'
    new   1: create or replace directory XMLDIR as 'C:\xdb\customers\ROSBANK'
    Directory created.
    Elapsed: 00:00:00.56
    SQL> declare
      2    JDBC XMLType := XMLType(bfilename('XMLDIR','JDBCASI.xsd'),nls_charset_id('AL32UTF8'));
      3    APPS XMLType := XMLType(bfilename('XMLDIR','AppsXx_Organization_V.xsd'),nls_charset_id('AL32UTF8'));
      4    OEBS XMLType := XMLType(bfilename('XMLDIR','OEBS.xsd'),nls_charset_id('AL32UTF8'));
      5  begin
      6    dbms_xmlschema.registerSchema
      7    (
      8        schemaurl => 'JDBCASI.xsd'
      9       ,schemadoc => JDBC
    10       ,local     => TRUE
    11       ,genBean   => false
    12       ,genTypes  => TRUE
    13       ,genTables => TRUE
    14       ,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
    15    );
    16    dbms_xmlschema.registerSchema
    17    (
    18        schemaurl => 'AppsXx_Organization_V.xsd'
    19       ,schemadoc => Apps
    20       ,local     => TRUE
    21       ,genBean   => false
    22       ,genTypes  => TRUE
    23       ,genTables => TRUE
    24       ,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
    25    );
    26
    27    dbms_xmlschema.registerSchema
    28    (
    29        schemaurl => 'oebs.xsd'
    30       ,schemadoc => OEBS
    31       ,local     => TRUE
    32       ,genBean   => false
    33       ,genTypes  => TRUE
    34       ,genTables => TRUE
    35       ,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
    36    );
    37  end;
    38  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:01:13.70
    SQL> declare
      2    xmlSchema XMLType := XMLType(
      3  '<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:oebs="http://www.rosbank.ru/oebs" targetNamespace="http://www.r
    osbank.ru/oebs/content/organization" xmlns:appsxx_organization="http://www.ibm.com/xmlns/prod/websphere/j2ca/jdbc/appsxx_organizatio
    n_v" elementFormDefault="qualified" xmlns:xdb="http://xmlns.oracle.com/xdb" xdb:storeVarrayAsTable="true">
      4          <xsd:import schemaLocation="oebs.xsd" namespace="http://www.rosbank.ru/oebs"/>
      5          <xsd:import namespace="http://www.ibm.com/xmlns/prod/websphere/j2ca/jdbc/appsxx_organization_v" schemaLocation="AppsXx_
    Organization_V.xsd"/>
      6          <xsd:complexType name="contentOrganizationType" xdb:SQLType="CONTENT_ORGANIZATION_T">
      7                  <xsd:complexContent>
      8                          <xsd:extension base="oebs:contentAbstractType">
      9                                  <xsd:sequence minOccurs="1" maxOccurs="1">
    10                                          <xsd:element name="organization" minOccurs="1" maxOccurs="unbounded" xdb:SQLInline="fal
    se" xdb:defaultTable="ORGANIZATION" type="appsxx_organization:AppsXx_Organization_V"/>
    11                                  </xsd:sequence>
    12                          </xsd:extension>
    13                  </xsd:complexContent>
    14          </xsd:complexType>
    15  </xsd:schema>');
    16  begin
    17    DBMS_XMLSCHEMA.registerSchema(SCHEMAURL => 'oebs_content_organization.xsd', SCHEMADOC => xmlSchema, GENTABLES => TRUE);
    18  end;
    19  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:12.51
    SQL> set pages 0 lines 250
    SQL> --
    SQL> column table_name format A40
    SQL> column column_name format A40
    SQL> column parent_table_name format A40
    SQL> column parent_table_column format A40
    SQL> --
    SQL> select table_name
      2    from user_xml_tables
      3  /
    OEBS
    CONTENT
    ORGANIZATION
    Elapsed: 00:00:29.40
    SQL> select table_name, parent_table_name, parent_table_column
      2    from user_nested_tables
      3  /
    SYS_NTjt3LMhVVSJ6XnKEY8x7idQ==           CONTENT                                  TREAT("XMLDATA" AS "CONTENT_ORGANIZATION
                                                                                      _T")."organization"
    Elapsed: 00:00:00.00
    SQL> select table_name, column_name
      2    from user_refs
      3  /
    SYS_NTjt3LMhVVSJ6XnKEY8x7idQ==           COLUMN_VALUE
    OEBS                                     "XMLDATA"."contentAbstract"
    Elapsed: 00:00:00.67
    SQL>
    SQL>
    SQL>

  • SRM table CFF_CONT question : huge table, what is that table for ?

    Hello
    We are looking to have more details about table CFF_CONT on a SRM system
    The tolat size of DB is 344 GB
    and only for table CFF_CONT we do have 284 GB, compared to total size this is really huge
    the rest of the DB is only about 60 GB
    What is that table for ?
    Would it be normal to see that table on SRM growing much more than the others ?
    Is that table something that can be clean up ?
    Those questions are poping up becasue we are doing a system copy with sapisnt and R3load
    and we see that this table only is requiring a so huge amount of thime to be exported
    Regards

    By the way ...
    That CFF_CONT table belongs to cFolder components

  • Creating SAP QUERY - question about tables in buisness transactions.

    Hello.
    I am pretty new to SAP.
    I want to create a query, as i so far have successfully done by creating a join in transaction SQVI.
    I am useing several tables;
    CRMD_ORDERADM_H
    CRMD_ORDERADM_I
    CRMD_ORDER_INDEX
    I have two questions.
    1: I try to join CRMD_ORDER_INDEX-PARTNER_NO with BUT000-PARTNER, but it won't do the trick. After a join like this i would like to join BUT000 with ADRC . Can someone explain how i could do this?
    2: I want join CRMD_ORDERADM_I with all the partners for the specific Item. (sold-to-party, shipping-party and so on). Can anyone tell me which table(s) i can find this in, and what fields to join.
    I will appreciate any answer to this

    Hi,
    For the second question, enter your transaction number ( Object ID ) into <b>CRMD_ORDERADM_H</b>  table. Pass the guid to table <b>CRMD_LINK.</b>
    Take set guid from CRMD_LINK and pass it to <b>CRMD_PARTNER</b>.
    You will get all the partners in that transaction
    regards,
    Prashant
    <b>Kindly Reward the points if helpful !</b>

  • Question about table compression

    I administer several 10g databases, and have been asked to compress tables in several tablespaces. I am unfamiliar with using compression. I have read some Oracle documentation on the ALTER TABLE... MOVE COMPRESSION command, but still have several questions. Can anyone recommend a good white paper, or other documentation on how best to compress tables with existing data? Thank you in advance for your guidance!

    Basically, I have questions about how to select which tables will benefit from compression. I also read somewhere that, once a table has been compressed, new updates to the compressed data will not be compressed and so I will need to re-compress the tables periodically.
    I also needed to know if the ALTER TABLE statement will compress the existing data or just future inserted data. Through further research I found that by using the MOVE clause, it will compress the existing data. I will also need to rebuild the indexes once the ALTER TABLE statement is complete.
    Thank you for your help and encouragement!

  • Question about table partitioning...

    Hello, all.  I'm using SQL 2012 Enterprise.  I have 8 very large tables (the largest two having 227M and 118M records, and the others between 11M-44M records).  For performance reasons, I'm considering partitioning the tables across multiple
    files/filegroups.  For my largest table (227M records), the data is spread across years 2011, 2012, and 2013 with 2013 having 104M records.  So naturally I'm considering partitioning on a Date column.  My question is should I go with four partitions
    (2011, 2012, 2013 and 2014 for new data) and still end up with a very large aggregation of data on the 2013 partition (104M) or should I further breakdown the 2013 partition into months now having 12 partitions for 2013 alone, and then I'm OK with all
    of 2011 and 2012 on their own partitions.  Again, this is for one table.  I'd still like to partition the other 7 large tables.  In the end, I could end up with many, many partitions and hence many, many filegroups.  I'm interested in how
    others partition MULTIPLE large tables.  Can you share partition functions/schemes across tables?
    Any thoughts, your own personal experiences, etc would be greatly appreciated.  Also, can someone recommend a good book, article, blog, etc on partitioning large databases.
    Thanks much in advance.
    Roz

    If you query against more than one partition I have doubts  you will gain performance...
    -- Create partition functions
    CREATE PARTITION FUNCTION PF1(INT) AS RANGE RIGHT FOR VALUES (1, 2, 3);
    CREATE PARTITION FUNCTION PF2(INT) AS RANGE RIGHT FOR VALUES (1, 2);
    -- Create filegroups
    ALTER DATABASE testdb ADD FILEGROUP FG7;
    ALTER DATABASE testdb ADD FILEGROUP FG6;
    ALTER DATABASE testdb ADD FILEGROUP FG5;
    ALTER DATABASE testdb ADD FILEGROUP FG4;
    ALTER DATABASE testdb ADD FILEGROUP FG3;
    ALTER DATABASE testdb ADD FILEGROUP FG2;
    ALTER DATABASE testdb ADD FILEGROUP FG1;
    -- Create partition schemes
    CREATE PARTITION SCHEME PS1 AS PARTITION PF1
    TO (FG1, FG2, FG3, FG4);
    CREATE PARTITION SCHEME PS2 AS PARTITION PF2
    TO (FG5, FG6, FG7);
    CREATE VIEW [dbo].[partition_info] 
    AS
    SELECT
    DB_NAME() AS 'DatabaseName'
    ,OBJECT_NAME(p.OBJECT_ID) AS 'TableName'
    ,p.index_id AS 'IndexId'
    ,CASE
    WHEN p.index_id = 0 THEN 'HEAP'
    ELSE i.name
    END AS 'IndexName'
    ,p.partition_number AS 'PartitionNumber'
    ,prv_left.value AS 'LowerBoundary'
    ,prv_right.value AS 'UpperBoundary'
    ,ps.name as PartitionScheme
    ,pf.name as PartitionFunction
    ,CASE
    WHEN fg.name IS NULL THEN ds.name
    ELSE fg.name
    END AS 'FileGroupName'
    ,CAST(p.used_page_count * 0.0078125 AS NUMERIC(18,2)) AS 'UsedPages_MB'
    ,CAST(p.in_row_data_page_count * 0.0078125 AS NUMERIC(18,2)) AS 'DataPages_MB'
    ,CAST(p.reserved_page_count * 0.0078125 AS NUMERIC(18,2)) AS 'ReservedPages_MB'
    ,CASE
    WHEN p.index_id IN (0,1) THEN p.row_count
    ELSE 0
    END AS 'RowCount'
    ,CASE
    WHEN p.index_id IN (0,1) THEN 'data'
    ELSE 'index'
    END 'Type'
    FROM sys.dm_db_partition_stats p
    INNER JOIN sys.indexes i
    ON i.OBJECT_ID = p.OBJECT_ID AND i.index_id = p.index_id
    INNER JOIN sys.data_spaces ds
    ON ds.data_space_id = i.data_space_id
    LEFT OUTER JOIN sys.partition_schemes ps
    ON ps.data_space_id = i.data_space_id
    LEFT OUTER JOIN sys.partition_functions pf
    ON ps.function_id = pf.function_id
    LEFT OUTER JOIN sys.destination_data_spaces dds
    ON dds.partition_scheme_id = ps.data_space_id
    AND dds.destination_id = p.partition_number
    LEFT OUTER JOIN sys.filegroups fg
    ON fg.data_space_id = dds.data_space_id
    LEFT OUTER JOIN sys.partition_range_values prv_right
    ON prv_right.function_id = ps.function_id
    AND prv_right.boundary_id = p.partition_number
    LEFT OUTER JOIN sys.partition_range_values prv_left
    ON prv_left.function_id = ps.function_id
    AND prv_left.boundary_id = p.partition_number - 1
    WHERE
    OBJECTPROPERTY(p.OBJECT_ID, 'ISMSSHipped') = 0
    AND p.index_id IN (0,1)
    GO
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Question about table strucuture

    Hello Gurus,
           I have following two questions:
        (1) how can I know what is the key field for a table ?
        (2) in SE80, when I display the structure of a table, there are component type and data type , why does here have two different types? ( apparently, there values are differenct)
    thanks very much!

    Hi,
        1) Go to t.code 'SE11'
            enter the table name and display.
             there the key checkbox is enabled.this the primary key field.
            If the checkbox is not enabled then it is a non key field.
      2) In structure,
             Component type refers the data element.
              Datatype refers type of the field that is wheather it is char,int etc.,
    Thank u,
    Manjula Devi.D

  • UserDefined Type Question - Nested Table Attribute

    I have a question about some types I'm trying to create and whether or not it's even possible .....
    Here's the background ...
    I have the following type i created :
    create type asset_stat (
    stat_current varchar2(50),
    stat_change_date date,
    stat_change_user varchar2(30)
    All this type does is simply put a user and date/time stamp when constructed. I want to track status changes for historical tracking.
    Then I want to create a nested table type of the above type as follows:
    create type asset_stat_nt as table of asset_stat
    Then, I have another type i've created which will have the nested table type created above as an attribute.
    create type asset (
    asset_name varchar2(30),
    asset_type varchar2(3),
    asset_stat asset_stat_nt
    Now, the constructor for this asset type is defined like this: ( this is where i get lost)
    constructor function asset (
    asset_nm IN varchar2,
    asset_type_cd in varchar2,
    asset_stat_cd in varchar2 ) return self as result is
    begin
    self.asset_nm := asset_nm
    self.asset_type := asset_type_cd ;
    self.asset_stat := asset_stat_nt(asset_stat_cd);
    return;
    end;
    I just created a table of asset type and tried to do an insert and I'm getting an error related to the line where the nested type is being assigned. Is this possible? If so is my syntax completely off? I'm not quite sure how to set values for the nested type because i want to keep all records of change. Any help would be greatly appreciated.
    thanks

    the block of code shows that asset_stat_nt is the type assigned to asset_stat inside the type asset as shown below
    create type asset (
    asset_name varchar2(30),
    asset_type varchar2(3),
    asset_stat asset_stat_nt
    I guess for the following block of code, the line with the arrows should be given like shown below in bold letters
    constructor function asset (
    asset_nm IN varchar2,
    asset_type_cd in varchar2,
    asset_stat_cd in varchar2 ) return self as result is
    begin
    self.asset_nm := asset_nm
    self.asset_type := asset_type_cd ;
    self.asset_stat := asset_stat_nt(asset_stat_cd);return;
    end;
    [b][b]self.asset_stat := asset(asset_stat_nt(asset_stat_cd));
    I am not pretty sure.......try it anyway.....if it works....good to you

  • Question on table partition

    Hi Again OTN Peeps,
    I have a question about copying from one table to another table.
    The table that i need to copy is partitioned.
    I'm checking the internet on how to copy data of the table per partition. But I'm not able to see a better explanation.
    Can anyone help me and guide me on how to copy table data per partition?
    Thanks Again!

    Found a way :)
    Thanks all

  • Question On Table Locks

    Hello,
    I have a question on locks.
    USER A runs a batch job of insert statements have 100000 records and does a commit after every 1000 records.
    USER B is also running a batch job on similar tables and is blocked due to locks held by USER A
    I have identified that USER A is blocking USER B and now i need USER B to continue with the batch job. My question is that i need to kill the USER A's session without making him lose all the data he already inserted. In short as SYS can i commit his inserted transactions on his behalf.
    I assume if I kill his session he will lose all the INSERTS he performed since he hasnt commited until that point.
    Please Help.

    is there any way i could save the INSERTED transcations of USER A.No. User A commits or User A is killed and rolls back.
    i'm also confused about this type of lock i seeIf you supply details of what the sessions are waiting on / locks held, then this will clarify.
    do u suggest i commit every 500 records No. In general, you should commit at the end of a transaction - all or nothing. Committing every X is nasty.
    a lot of refrential constariants with other tables and this could be causing the lockYou can get locking problems with unindexed foreign keys.
    If you could provide more details of what's going on in both sessions / what they're waiting on this should clarify.

Maybe you are looking for

  • EDI Outbound855 Error code :AIP-50547

    In the B2B reports, i am getting this error -- Unable to identify the trading partner agreement from the given input values. Also verify agreement effectiveToDate. B2B logs 2007.08.02 at 05:30:43:216: Thread-214: B2B - (DEBUG) oracle.tip.adapter.b2b.

  • How to create YUV player?

    I want to create a video player, which get the input from yuv file. How can I do this? Please give me the code.

  • Item access inside tab

    Hi there Have a single page with with tabs and below the tabs one region. I want all users (incl. the non logged in) to see the page. But in the regions I want some access restictions. This works fine outside the tabs. In side the tabs, every users (

  • Using pure object-relational features for all

    Hi all, as a general hint I wonder if we can manage database contents and definitions in terms of pure objects. E.i. having always "create table x of y", instead of "create table x (...)", using refs instead of relations, querying on objects, and ali

  • Diablo 2 and/or Doom 3 on a MacBook, good idea?

    Well, these are the only games I'd play on the Macbook, D2 for sure Doom 3 might be changed for Prey, but anyways, I read somewhere that the MacBook can use up to 420something Mbs of ram for video, so can it run smoothly or will it crash and burn? Sh