Indices and constraints on XML Tables/Columns (with Schema)

I've read a lot of documents by know, but the more I read the more I got confused. So I hope you can help me.
Frist my Oracle Server Version: Oracle Database 11g Enterprise Edition Release - 64bit
I've manages to create a table with a column with the type SYS.XMLTYPE and the storage modle "Object Relational" with an XML Schema.
I can insert data and I can execute XQuery statements.
I can also create an XMLTYPE table with my Schema, althoug the tool SQL Developer keeps telling me, that the one column wich is generated within the table is of the type CLOB instead of object realtional (which is what I defined).
The query for that is:
That's where I am, now my questions:
1. What's the difference? I'm aware of the obviouse difference, that with the first way I can add relational columns as well, but apart from that? If I only want to store the xml data, is the second approach always better (especially in regard to my next question)?
2. My schema contains elements with attributes (which contain IDs), which have to be unique. So I tried to add a UNIQUE constraint, but failed. I found this (, but it just doesn't work.
Error: "ORA-01735: invalid ALTER TABLE option"
3. I didn't try yet, but I need to specifiy foreign keys within the XML as well (which is explained in the link at question 2). I guess the solution to question 2 will make this possible as well.
4. Since I can create a UNIQUE constaint for attributes (well, I can't yet, but I hope that this will change soon) I woundered if it would be possible to realize something like auto_increment. Although I see the problem with validating the xml input if the Ids are empty. Any suggestions on that problem? Do I have to query for the highest (free) id before I can insert the new documents?
Well, that's enough for today, I hope someone can help me!
Greetings, Florian

I've read through all the literature (again) and found out, that I did most of the stuff right in the first place. I just missinterpreted the generated tables for the types and wondered why they only contained one column. Well, at least one mistery solved.
But know to make it easier just one question, which might solve all problems I have:
How can I create UNIQUE constraints and FOREIGN KEYS when I have a table or column of the type XmlType with a schema using the object relational storage method?
I found a solution (Example 5-12), but it just does not work for me.
I removed the FOREIGN KEY and tried it again and the UNIQUE Key works.
So basically the question is how to retrieve the "AId" Attribute. "XMLDATA"."AId", "XMLDATA"."Attribute"."AId" and "XMLDATA"."Subject"."Attribute"."AId" all do not work.
I've added my schema declarations at the bottom (which I've already successfully registred and used without foreign keys and constraints, so they work).
After I've registered the two schema files 3 types and 11 tables where created. One type for the attribute, one for the study type and one probably to link the attributes to the study types. The tables are one for the attribute, 4 for the content*-elements, 2 for the study type (I don't really know why two) and 4 with strange names starting with "SYS_NT" and then some random numbers and letters (looks alot like some base64 encoded string).
The Query I try to use to create the table is: (The table "Attribute" already exists and contains a field "ID", which is it's PK.)
ELEMENT "StudyType.xsd#StudyType";
The error I get is:
Error starting at line 1 in command:
ELEMENT "StudyType.xsd#StudyType"
Error at Command Line:3 Column:37
Error report:
SQL Error: ORA-22809: nonexistent attribute
22809. 00000 - "nonexistent attribute"
Cause: An attempt was made to access a non-existent attribute of an
object type.
Action: Check the attribute reference to see if it is valid. Then retry
the operation.
Attribute-Schema (Attribute.xsd):
<xs:schema xmlns:xs="" elementFormDefault="qualified" attributeFormDefault="unqualified">
     <xs:attribute name="AId">
               <xs:restriction base="xs:integer">
                    <xs:minInclusive value="0" />
     <xs:attribute name="Name" type="xs:string" />
     <xs:element name="ContentString" type="xs:string" />
     <xs:element name="ContentInteger" type="xs:integer" />
     <xs:element name="ContentDouble" type="xs:decimal" />
     <xs:element name="ContentDate" type="xs:date" />
     <xs:element name="Attribute">
               <xs:choice minOccurs="0" maxOccurs="1">
                    <xs:element ref="ContentString" />
                    <xs:element ref="ContentInteger" />
                    <xs:element ref="ContentDouble" />
                    <xs:element ref="ContentDate" />
               <xs:attribute ref="AId" use="required" />
               <xs:attribute ref="Name" use="optional" />
Study Type Schema (StudyType.xsd):
<xs:schema xmlns:xs="" elementFormDefault="qualified" attributeFormDefault="unqualified">
     <xs:include schemaLocation="Attribute.xsd" />
     <xs:attribute name="STId">
               <xs:restriction base="xs:integer">
                    <xs:minInclusive value="0" />
     <xs:element name="StudyType">
                    <xs:element ref="Attribute" minOccurs="1" maxOccurs="unbounded" />
                    <xs:element ref="StudyType" minOccurs="0" maxOccurs="unbounded" />
               <xs:attribute ref="STId" use="required"/>
Edited by: alwaysspam on Sep 8, 2010 5:35 PM

Similar Messages

  • Hiding Table Columns with the Spry Element Selector

    I am trying to set up a toggle button that will show/hide
    rows >1 when clicked. I've used Adobe's
    Table Columns with the Spry Element Selector" example and it
    worked fine with an HTML list, until I linked to actual XML data.
    Now it works in reverse. What gives?
    Here's the example:

    That's what I started with. Same result:

  • Move Table Column with AppleScript in Microsoft Word

    Microsoft Word has a flaw (in my opinion) with tables in that it aligns the left and right text with the margins rather than aligning the table columns with the margins. This results in sloppy tables, because the left and right borderlines lie outside the margins.
    I would like to fix the word tables by
    calculating the left cell padding and right cell padding in points and setting them to variables {left_pad,right_pad} respectively
    move left column by left_pad to the right
    move right column by right_pad to the left
    The script I was working on does not work, but I will post it to show my thought process as I hone in on my solution.
    tell application "Microsoft Word"
        --595 points is width of A4 paper
        -- Set page margin in points to variables
        set {l_margin, r_margin, t_margin, b_margin} to {(get left margin of page setup of active document), get (right margin of page setup of active document), get (top margin of page setup of active document), get (bottom margin of page setup of active document)}
        get {l_margin, r_margin, t_margin, b_margin}
        -- Set specific Paragraph margins
        -- NOTE: If you select a table thinking you wish to drag just the left margin to the right, or the right margin to the left, this code does not accomplish this because each cell has its own paragraph formatting. This code will set the margin for every single cell, because each cell has its own margins! (separate from padding).
        set para_sel to paragraph format of selection
        set paragraph format left indent of para_sel to (centimeters to points centimeters 0.5)
        -- Aligning left and right columns of table with the margins
        -- NOTE: There is a command to set left row indent, but not right row indent (very stupid of Microsoft)
    end tell

    I have worked up something that seems to work (although I cannot promise it is the best way). Hope it helps anyone else who has this need.
    tell application "Microsoft Word"
    set findRange to find object of selection
    clear formatting findRange -- clear any previous formatting used in a find operation
    set forward of findRange to true -- find forward
    set style of findRange to "List Bullet" -- the style to look for
    tell findRange
    set gotIt to execute find find text "" -- do the search w/o matching any text
    end tell
    if gotIt is true then -- if a match was found
    copy object selection -- copy it to the clipboard
    set mySelection to (the clipboard) -- then put clipboard into a variable
    set myOffset to ¬
    (get selection information selection information type ¬
    (horizontal position relative to page)) -- now put selection info into a variable
    display dialog mySelection & return & (myOffset as text) -- then display it
    end if
    end tell

  • How to change the css behaviour of af:table column with rowheader

    Can we change the css look and feel of the af:column with rowheader attribute set true ? Currently I am getting a projected look with shades in the left side. I want it to be like normal af:column style. If there any specific styleClass I need to put please provide the details

    you can use skinning for this. The skin selectors are shown here:

  • Custom sort pivot table columns with Essbase as the data source

    Is it possible to sort columns in a pivot table according to an arbitrary value that I define when the data is coming from Essbase?
    For example, say I have a dimension called Soda, with values Coke, Diet Coke, Dr. Pepper and Diet Dr. Pepper. I create a report with a sales measure with the measure labels on the rows and the Soda dimension on the column. By default the columns will be sorted alphabetically:
    Coke Diet Coke Diet Dr. Pepper Dr. Pepper
    Sales 1M .5M .75M 1.25M
    I want to create a report that looks like this:
    Coke Diet Coke Diet Dr. Pepper Dr. Pepper
    I think I could do this if the source was relational just by creating bins or creating a custom column with a case statement that assigns each Soda an arbitrary value and then sort on this value. Everything I've tried with Essbase as the source, though, results in:
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 42043] An external aggregate is found in an outer query block. (HY000)
    Any ideas?

    1. You can try solve the 'An external aggregate is found in an outer query block' by changing aggregation rule for your measure both in physical and business layer.
    By default it's set to Aggr_External - change it to Sum
    In physical : Column properties->Aggregation rule
    In business model : Column properties->Aggregation tab -> Default aggregation rule.
    This may change the result - after changing check whether you still get correct values.
    2. Also, in case the desired order is the same as the order of members in the Essbase cube, and you want to leave Aggr_External, you can create a calculated column that will help you with the sort.
    Hope this helps,

  • SQL from Table Column with Dynamic URL Problem

    This is the SQL I'm attempting to save to a table column via the Object Browser;
    "a"."PBR_BRIEF_ID" "Brief ID",
    "a"."PROJECT_NUMBER" "Project",
    "b"."DESCRIPTION" "Description",
    "b"."ACTUAL_END_DATE" "Actual End",
    "b"."RFS_DATE" "RFS",
    "b"."LOCATION_CODE" "Location",
    ''||"b"."ESA_CODE"||'' "ESA",
    "b"."PROJECT_USER_STATUS" "Status",
    "b"."PROJECT_TRIGGER" "Trigger"
    [email protected] "a",
    [email protected] "b"
    "a"."PBR_BRIEF_ID" = :P3_BRIEF_ID and
    The intesting bit is the following, where a URL is return behind a particular column;
    ''||"b"."ESA_CODE"||'' "ESA",
    It's interesting because when I click on "Apply Changes" in the Object Browser, the text that appears in the column is as follows, i.e. with APP_ID and SESSION populated;
    ''||"b"."ESA_CODE"||'' "ESA",
    Why would that happen??
    The full SQL above is used in an application page with a SQL Query (PL/SQL function body returning SQL query). The basic SQL works OK but because of what the Object Browser is doing, the link does not.
    Message was edited by:
    Damian - apologies for lack of formatting!!
    Message was edited by:

    & lt;
    for your &lt; tags and then the message will appear in the proper format.
    If you are using dynamic sql to generate an url with APP_ID and SESSSION you could:
    a) create page items (P1_APP_ID and P1_SESSION)
    b) compute those page items to the actual APP_ID and SESSION_ID
    c) use the value of those items while generating your dynamic sql (instead of APP_ID and SESSION)
    Then, your links will show the right APP_ID and the right SESSION.
    Denes Kubicek

  • Impact of table columns with number datatype but has no precision in Forms

    Currently, I have table columns that have a data type of number but has no precision declared (e.g. AGREEMENT_CODE NUMBER). I would just like to ask if there's anyone out there who knows if this has a negative impact on Oracle's forms and reports...with the way buffer memories are allocated or other things on performance. I am still putting in maximum length values for base table items. I don't know if this will affect buffer memory allocation as well.
    Thank you.

    I don't know this for fact, but I would think that numbers with a large number of significant figures might affect buffer sizes, but I'll bet your example AGREEMENT_CODE values would never have a large number of figures. In fact, whether or not you limit the size of a number in the database or your form probably does not affect the way the actual data values are transmitted or stored.
    If someone is telling you to worry about this, I think they are barking up the wrong tree someplace way out in left field.
    There are so many other things that can seriously affect processing speed and data transfer speed, starting with query plans and index usage. I have never heard this one causing concern anywhere before.

  • How to make table column with formula

    Hi all..
    This is my class
    public class MyNumber{
         private int num;
         public int getNum(){
              return num;
         public void setNum( int num){
              this.num = num;
    }Consider I design a table with FXML editor ( Scene Builder in this case )
    and these are some of my codes
    private TableView tab;
    private TableColumn<MyNumber, Integer> tabColInput;
    private TableColumn tabColOutput;
    tabColInput.setCellValueFactory( new PropertyValueFactory<Person,Integer>("num") );
        new EventHandler<CellEditEvent<MyNumber, Integer>>() {
            public void handle(CellEditEvent<MyNumber, Integer> t) {
                ((MyNumber) t.getTableView().getItems().get(
    I want to make tabColOutput to always show the result for tabColInput times 2
    When I change a row in tabColInput to 10, tabColOutput will show 20
    When I change a row in tabColInput to 3, tabColOutput will show 6
    Could anyone advice me how to do this?
    Ps: I am not english native speaker, so I am sorry if I am saying it wrong ^^

    I just give it a try and it works like magic
    Here is how I do it (change a cell from a table by code)
    import java.util.ArrayList;
    import java.util.List;
    import javafx.application.Application;
    import javafx.collections.FXCollections;
    import javafx.collections.ObservableList;
    import javafx.geometry.Insets;
    import javafx.scene.Group;
    import javafx.scene.Scene;
    import javafx.scene.control.Label;
    import javafx.scene.control.TableColumn;
    import javafx.scene.control.TableView;
    import javafx.scene.control.cell.PropertyValueFactory;
    import javafx.scene.layout.VBox;
    import javafx.scene.text.Font;
    import javafx.stage.Stage;
    public class TableViewSample extends Application {
        public static final String Column1MapKey = "A";
        public static final String Column2MapKey = "B";
        public static void main(String[] args) {
        public void start(Stage stage) {
            List<MyTableData> listData = new ArrayList<MyTableData>();
            listData.add(new MyTableData("A", 21) );
            listData.add(new MyTableData("B", 24) );
            listData.add(new MyTableData("C", 23) );
            listData.add(new MyTableData("D", 21) );
            listData.add(new MyTableData("E", 22) );
            ObservableList<MyTableData> tableData = FXCollections.observableArrayList(listData);
            Scene scene = new Scene(new Group());
            stage.setTitle("Table View Sample");
            final Label label = new Label("Student IDs");
            label.setFont(new Font("Arial", 20));
            TableColumn<MyTableData, String> firstDataColumn = new TableColumn<MyTableData, String>("NAME");
            TableColumn<MyTableData, Integer> secondDataColumn = new TableColumn<MyTableData, Integer>("AGE");
            firstDataColumn.setCellValueFactory(new PropertyValueFactory<MyTableData, String>("name"));
    //        firstDataColumn.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<MyTableData, String>, ObservableValue<String>>(){
    //            @Override
    //            public ObservableValue<String> call(CellDataFeatures<MyTableData, String> p) {
    //                return p.getValue().nameProperty();
            secondDataColumn.setCellValueFactory(new PropertyValueFactory<MyTableData, Integer>("age"));
            TableView<MyTableData> table_view = new TableView<MyTableData>();
            table_view.getColumns().setAll(firstDataColumn, secondDataColumn);
            final VBox vbox = new VBox();
            vbox.setPadding(new Insets(10, 0, 0, 10));
            vbox.getChildren().addAll(label, table_view);
            ((Group) scene.getRoot()).getChildren().addAll(vbox);
            //(this is where I change my table content with code)
            tableData.get(0).setName("xx Gargoyle xx");
            System.out.println("Testing Done");
    public class MyTableData{
        private final SimpleStringProperty name;
        private int age;
        public MyTableData(String name, int age) {
   = new SimpleStringProperty(name);
            this.age = age;
        public String getName() {
            return name.get();
        public StringProperty nameProperty(){
            return name;
        public void setName(String name) {
        public int getAge() {
            return age;
        public void setAge(int age) {
            this.age = age;
    }And thank you very much

  • Workaround for ]] XML export bug with schema?

    It is a known issue that the ]]> sequence will not export properly to XML. If you are using a DTD, there is an entity-based workaround that is described here:
    The question... is there a workaround when using schema? I'm unable to figure it out.

    Hi Lynne,
    Thanks again for the thoughts. And by the way, I sympathize with your implicit complaint about how these forums work with respect to revised messages. I am accustomed to hitting Ctrl+S all the time, probably from my FM experience   Unfortunately, if you accidentally do it in the forum webpage, it submits the message. The system really needs to send revisions when they occur, because some people might just read the original email and think that's it.
    Anyway, I'm intrigued by some things you said. #1 is possible but not preferable, as schema was specifically chosen for the ability to validate attribute values. My level of attribute-based conditionalization is fairly heavy and the schema makes sure that an invalid value cannot be entered. I seem to remember back in the outset that a DTD couldn't do the level of validation I like, but I don't remember the exact reasoning. Note that I frequently assign lots of values to an attribute, tokenized with whitespace as customary.
    #3 is what I'm doing now, except with the fancy coverup tricks with spacing and back-end XSLT. I like your ideas.
    #4 is actually pure genious and it is the route I think I will go. Something you didn't know yet is that I have a script that automatically formats an XML instance like an XML editor does, incidentally by wrapping <ph> elements and setting color-formatting attributes. Thanks to ExtendScript, I was able to use regular expressions to parse out all the individual components and then create a "map" for the subsequent wrapping/formatting activities. It is quite lovely and gives me the best looking XML instances in town, with a click. Bragging aside, it would be elementary to modify that script slightly to insert another <ph> element as you suggest. Elegant and simple, but I would have never thought of that myself.
    Many thanks again,

  • Retrieving Checkbox Value and Displayong it in table column

    Hi Friends,
    It's an urgent query,please solve it asap
    I am having three colums which are having data(Country,State,City) and fourth column contains checkbox
    when i check the checkbox, i want all three values to be diplayed on th .jsp page in three different columns
    I will explain my problem further with the code
    In a .html page I am having a table with fields Country,State,City and Select
    Select colum contains checkbox
    my query is that when i click on submit button , all the values corresponding to the row on which checkbox has been clicked should to be diplayed in the jsp page
    in the .jsp City.jsp i want in a table to be displayed,in first columni want State,in scond column,City selected from .html page
    I am enclosing the City.htm and City.jsp
    It will be more clear if u have a look at City.jsp
    I tried many ways but somehow i m not able to get Country and State in different Columns
    In Column 'County' I want India and in Column State', i want
    sate of the city that i select in City.htm
    How to achieve this
    You can copy pste the code i have written to view how the code works.
    Please reply asap,it's urgent
    <form method="post" action="City.jsp">
    <table border=2><tr><td>Country</td><td>State</td><td>City</td><td>Select</td></tr>
    <tr><td>India</td><td>Karnataka</td><td>Bangalore</td><td><input type=checkbox name="city" value="Bangalore"></td></tr>
    <tr><td>India</td><td>Karnataka</td><td>Mysore</td><td><input type=checkbox name="city" value="Mysore"></td></tr>
    <tr><td>India</td><td>Karnataka</td><td>Belgaum</td><td><input type=checkbox name="city" value="Belgaum"></td></tr>
    <tr><td>India</td><td>Maharashtra</td><td>Mumbai</td><td><input type=checkbox name="city" value="Mumbai"></td></tr>
    <tr><td>India</td><td>Maharashtra</td><td>Pune</td><td><input type=checkbox name="city" value="Pune"></td></tr>
    <tr><td>India</td><td>Maharashtra</td><td>Nagpur</td><td><input type=checkbox name="city" value="Nagpur"></td></tr>
    <tr><td>India</td><td>Gujarat</td><td>Baroda</td><td><input type=checkbox name="city" value="Baroda"></td></tr>
    <tr><td>India</td><td>Gujarat</td><td>Ahmedabad</td><td><input type=checkbox name="city" value="Ahmedabad"></td></tr>
    <tr><input type=submit>
    <%@page import="java.util.*" %>
    out.println("<html><head><body><center><table border=1><tr><td><b>Country</b></td><td><b>State</b></td><td><b>City</b></td></tr>");
    Enumeration e=request.getParameterNames();
    String select=(String)e.nextElement();
    String value[]=request.getParameterValues(select);
    for(int i=0;i< value.length;i++)
    out.print("<tr><td><input type=text name=h1 size=5 maxlength=2></td>");
    out.print("<td><input type=text name=h2 size=5 maxlength=2></td>");
    }out.println("<tr><input type=submit name=submit value=\"Save Changes\"></tr></table></form></center></body></head></html>");

    from the previous city.htm, code for checking all checkbox
        <script language="javascript">
          function checkAll(){
              for(var x = 0; x < 8; x++){
              for(var x = 0; x < 8; x++){
          <form method="post" action="MyCities.jsp">
            <table border="2">
                <td>Select  <input type="checkbox" name="cities" onclick="checkAll()"/></td>
                  <input type="checkbox" name="city" value="[email protected]@Bangalore"/>
                  <input type="checkbox" name="city" value="[email protected]@Mysore"/>
                  <input type="checkbox" name="city" value="[email protected]@Belgaum"/>
                  <input type="checkbox" name="city" value="[email protected]@Mumbai"/>
                  <input type="checkbox" name="city" value="[email protected]@Pune"/>
                  <input type="checkbox" name="city" value="[email protected]@Nagpur"/>
                  <input type="checkbox" name="city" value="[email protected]@Baroda"/>
                  <input type="checkbox" name="city" value="[email protected]@Ahmedabad"/>
                <input type="submit"/>

  • Table structure and constraints in HTML table

    This script creates a html file (Structure.html) that contains structure of a specific table.
    When the following script is executed in sql * plus, it asks for the table name for which
    structure information is needed. after entering the table name, it writes the table structure
    into structure.html file.
    PROMPT Enter table name:
    -- Query ---
    A.DATA_LENGTH) || ')') AS "DATA TYPE",

    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...

  • Should I have a table column with total price?

    I have the following SQL Scheme:
    create table dbo.Baskets (
    Id int not null primary key clustered (Id),
    Name nvarchar (80) not null
    create table dbo.Products (
    Id int not null primary key clustered (Id),
    BasketId int not null,
    Price decimal (10, 2) not null,
    Name nvarchar (80) not null
    So one basket can have many products.
    I often need to find baskets in a specific price range.
    I know the basket price is the sum of its products prices.
    1. Should I add a column to Baskets with TotalPrice?
    2. Would this improve query performance a lot?
    3. Can this be done automatically when Products are updated?
    4. Should I index some column here?
    Thank You,

    1.It depends on the queries run against the table 
    2.May or may not, depends how would like to calculate it or you get already calculated value for the client or whatever
    3. Yes, but then you will have to write a trigger at least
    4. Depends on the queries and columns  that participate in WHERE clause
    Best Regards,Uri Dimant SQL Server MVP,
    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

  • How to populate a table column with marked text?

    I hate searching and typing so I was just wondering if there was a solution to the following problem.
    I have a document that contains 5-character defect codes in the body of the text (in numbered steps). At the end of the document I have a table which summarizes these codes: the codes make up one column and the other columns contain information related to these codes (page number, area, actions to be taken, criteria for defect etc.).
    Is there a way for me to mark the codes such that I could import all of them into the defect code column?
    I was leaning towards generating a list of some kind and then pasting it in the column but I can't seem to paste my generated list into multiple cells. FM will only allow me to paste the whole list in one cell. Am I using the wrong approach or maybe missing a step in between?

    Thank you! that was very helpful and it solves my problem to a great degree. I didn't think of converting the list to a table--now I just have to delete the page numbers, since they are included in the table, but in another column
    FYI, I couldn't use cross-reference markers because the defect code (according to the style guide.) is written at the end of the instruction, on the same line without a hard return. Cross referencing brought in all the text in that paragraph if I used a <paratext> building block to define my cross-reference format. I lack the knowledge to create a cross-reference format that would just give me the last five characters of the paragraph. These tables tend to be long and even if I could do that, for each row, I would have to click about seven or eight times per entry 
    Thanks again.

  • Update table column with same auto-increment value, via T-SQL stored procedure

    Good Evening to every one,
    I have a table 'Contracts' as we can see in the picture below (I exported my data on An Excel Spreadsheet). Table's primary key is 'ID' column.
    I am trying to create a stored procedure (i.e. updContractNum), through which I am going to update the 'Contract_Num' column, in every row where the values on Property_Code, Customer, Cust_Category and Amnt ARE EQUAL, as we can see in the schema above.
    The value of Contract_Num is a combination of varchar and auto_increment (integer). For example, the next value on 'Contract number' column will be 'CN0005' for the combination of 11032-14503-02-1450,00
    I' m trying to use CURSORS for this update but I am new in using cursors and I am stuck in whole process. I atttach my code below:
    CREATE PROCEDURE updContractNum
    --declare the variables
    DECLARE @CONTRACT_NUM VARCHAR(10); -- Contract Number. The value that will be updated on the table.
    DECLARE @CONTRACT INTEGER; -- Contract number, the auto increment section on contract number
    DECLARE @CONTR_ROW VARCHAR(200); -- Contract row. The row elements that will be using on cursor
    DECLARE CONTRACT_CURSOR CURSOR FOR -- Get the necessary fields from table
    OPEN CONTRACT_CURSOR -- open a cursor
    WHILE @@FETCH_STATUS = 0 -- execute the update, for every row of the tabl
    --update Contract_Num, using the format coding : contract_number = 'CN' + 0001
    SET CONTRACT_NUM = 'CN'[email protected]_NUM+1
    Thank you in advance!

    You dont need cursor
    You can simply use an update statement like this
    UPDATE t
    SET Contract_Num = 'CN' + RIGHT('00000' + CAST(Rnk AS varchar(5)),5)
    SELECT Contract_Num,
    DENSE_RANK() OVER (ORDER BY Property_Code,Customer,Cust_category,Amnt) AS Rnk
    FROM table
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Fill a table column with an empty value as the column is not existing in the data file

    I m new to SQL loader
    I have a table like this :
    CREATE table ListeEcriture
    ( "NUMERO" varchar2 (8 bytes)
    "dateEcr" varchar (10 byte)
    "CodeOp" Varchar2 (10 byte)
    "LibOp" varchar (32 byte)
    "CodeVal" varchar (12 byte)
    "NumCompte" varchar (8 bytes)
    This is my control file :
    load data
    infile 'C:\ReQ\FR00010303.txt'
    into table ListeEcriture
    fields terminated by ";"
    (numero, DateEcr, CodeOp, libOp, CodeVal "FR00010303", NumCompte)
    The problem is thataslo if possible to ignore the file header it would be really great

    You might be after SQL*Loader Control File Reference
    Check SQL*Loader Concepts for the big picture.

Maybe you are looking for

  • HT204406 playlists on iMac won't sync to iPhone and iPad correctly

    Half of the playlists as well as random songs won't transfer over to the iphone and ipad. longtime itunes account, only one user id ever, 7000+ songs; new imac, ipad 3 and iphone 4s. plenty of space, and all running latest iOS. I have tried updating

  • Why am I getting a -50 error when moving music to my iTouch?

    Why am I getting a -50 error when moving music to my iTouch?

  • Adobe Reader - Print Dialoge box is usable

    Yesterday I was running Reader ver. 10.1.3 on a Windows 2008 x64 Terminal Server.  All users Adobe Reader print dialoge boxes now open up very very large.  Any visible font is perhpas 10" tall (see screenshots below).  Drop down pick lists don't disp

  • UDO Error & ONNM table

    Hi All, Recently I have a problem using UDO.  I illustrate the situation as following steps: 1. Add a new record, but with unique key already exists in the database. 2. Try to save a record (System prompt error: unique key violation error) 3. Change

  • Airport express wont detect on G5 power PC but will on Macbook. Please help

    Hi, I seem to have a network problem with my Power PC G5 mac. Left the machine on sleep and went to wake the incumbent to go online. I then discovered the internet wouldnt work and the signal was down. At first I thought this was an ISP issue but mac