Calculating values from row to row with pure sql?

Hello,
I'm searching for a way to calculate values from row to row with pure sql. I need to create an amortisation table. How should it work:
Known values at start: (they can be derived with an ordinary sql-statement)
- redemption amount RA
- number of payment terms NT
- annuity P (is constant in every month)
- interest rate IR
What has to be calculated:
First row:
RA1 = RA - P
Z1 = (RA1 * (IR/100/12))
T1 = P - Z1
2nd row
RA2 = RA1 - T1
Z2 = (RA2 * (IR/100/12))
T2 = P - Z2
and so on until NT has reached.
It should look like
NT
P
Tn
Zn
RAn
1
372,17
262,9
109,27
22224,83
2
372,17
264,19
107,98
21961,93
3
372,17
265,49
106,68
21697,74
4
372,17
266,8
105,38
21432,25
5
372,17
268,11
104,06
21165,45
6
372,17
269,43
102,75
20897,34
7
372,17
270,75
101,42
20627,91
8
372,17
272,09
100,09
20357,16
9
372,17
273,42
98,75
20085,07
10
372,17
274,77
97,41
19811,65
11
372,17
276,12
96,06
19536,88
12
372,17
277,48
94,7
19260,76
13
372,17
278,84
93,33
18983,28
14
372,17
280,21
91,96
18704,44
15
372,17
281,59
90,59
18424,23
16
372,17
282,97
89,2
18142,64
17
372,17
284,36
87,81
17859,67
18
372,17
285,76
86,41
17575,31
19
372,17
287,17
85,01
17289,55
20
372,17
288,58
83,59
17002,38
21
372,17
290
82,18
16713,8
22
372,17
291,42
80,75
16423,8
23
372,17
292,86
79,32
16132,38
24
372,17
294,3
77,88
15839,52
25
372,17
295,74
76,43
15545,22
26
372,17
297,2
74,98
15249,48
27
372,17
298,66
73,52
14952,28
28
372,17
300,13
72,05
14653,62
29
372,17
301,6
70,57
14353,49
30
372,17
303,09
69,09
14051,89
31
372,17
304,58
67,6
13748,8
32
372,17
306,07
66,1
13444,22
33
372,17
307,58
64,6
13138,15
34
372,17
309,09
63,08
12830,57
35
372,17
310,61
61,56
12521,48
36
372,17
312,14
60,04
12210,87
37
372,17
313,67
58,5
11898,73
38
372,17
315,21
56,96
11585,06
39
372,17
316,76
55,41
11269,85
40
372,17
318,32
53,85
10953,09
41
372,17
319,89
52,29
10634,77
42
372,17
321,46
50,71
10314,88
43
372,17
323,04
49,13
9993,42
44
372,17
324,63
47,55
9670,38
45
372,17
326,22
45,95
9345,75
46
372,17
327,83
44,35
9019,53
47
372,17
329,44
42,73
8691,7
48
372,17
331,06
41,11
8362,26
I would appreciate every help and idea to solve the problem solely with sql.
Thanks and regards
Carsten

It's using Model Clause and / or Recursive With (sometimes maybe both)
Regards
Etbin
with
rec_proc(nt,i,ra,p,ir,z,t) as
(select nt,i,ra - p,p,ir,round((ra - p) * 0.01 * ir / 12,2),p - round((ra - p) * 0.01 * ir / 12,2)
   from (select 48 nt,22597 ra,372.17 p,5.9 ir,0 z,0 t,1 i
           from dual
union all
select nt,i + 1,ra - t,p,ir,round((ra - t) * 0.01 * ir / 12,2),p - round((ra - t) * 0.01 * ir / 12,2)
   from rec_proc
  where i < nt
select * from rec_proc
try to adjust initial values and rounding please
NT
I
RA
P
IR
Z
T
48
1
22224.83
372.17
5.9
109.27
262.9
48
2
21961.93
372.17
5.9
107.98
264.19
48
3
21697.74
372.17
5.9
106.68
265.49
48
4
21432.25
372.17
5.9
105.38
266.79
48
5
21165.46
372.17
5.9
104.06
268.11
48
6
20897.35
372.17
5.9
102.75
269.42
48
7
20627.93
372.17
5.9
101.42
270.75
48
8
20357.18
372.17
5.9
100.09
272.08
48
9
20085.1
372.17
5.9
98.75
273.42
48
10
19811.68
372.17
5.9
97.41
274.76
48
11
19536.92
372.17
5.9
96.06
276.11
48
12
19260.81
372.17
5.9
94.7
277.47
48
13
18983.34
372.17
5.9
93.33
278.84
48
14
18704.5
372.17
5.9
91.96
280.21
48
15
18424.29
372.17
5.9
90.59
281.58
48
16
18142.71
372.17
5.9
89.2
282.97
48
17
17859.74
372.17
5.9
87.81
284.36
48
18
17575.38
372.17
5.9
86.41
285.76
48
19
17289.62
372.17
5.9
85.01
287.16
48
20
17002.46
372.17
5.9
83.6
288.57
48
21
16713.89
372.17
5.9
82.18
289.99
48
22
16423.9
372.17
5.9
80.75
291.42
48
23
16132.48
372.17
5.9
79.32
292.85
48
24
15839.63
372.17
5.9
77.88
294.29
48
25
15545.34
372.17
5.9
76.43
295.74
48
26
15249.6
372.17
5.9
74.98
297.19
48
27
14952.41
372.17
5.9
73.52
298.65
48
28
14653.76
372.17
5.9
72.05
300.12
48
29
14353.64
372.17
5.9
70.57
301.6
48
30

Similar Messages

  • How to paste calculated values from Numbers?

    When I copy calculated values from Numbers and paste into a table in Pages, I get an image like the one below.  Non calculated values paste fine.
    To get around this issue, I paste the calculated values into TextWrangler, then copy from there and paste into Pages.  Is there a way to go directly from Numbers to Pages with calculated values?

    Hi 4th Space,
    I you are pasting into a table in Pages, follow Jeffs instructions.
    I you are not pasting into a table, this works. Copy the cells in Numbers. Go to your Pages document and under the Edit Menu > Paste and Match Style. It works like Paste Values.
    Ian.

  • How to change a date value from "java.util.Date" to "java.sql.Date"?

    Hi all,
    How to change a date value from "java.util.Date" to "java.sql.Date"?
    I m still confusing what's the difference between them.....
    thanks
    Regards,
    Kin

    Thanks
    but my sql statement can only accept the format (yyyy-MM-dd)
    such as "select * from xx where somedate = '2004-12-31'
    but when i show it to screen, i want to show it as dd-MM-yyyy
    I m using the following to change the jave.util.Date to str and vice versa. But it cannot shows the dd-MM-yyyy. I tried to change the format from yyyy-MM-dd to dd-MM-yyyy, it shows the wrong date in my application.
         public String date2str(java.util.Date thisdate)     {
              if (thisdate != null)     {
                   java.sql.Date thissDate = new java.sql.Date(thisdate.getTime());
                   return date2str(thissDate);
              }     else     {
                   return "";
         public String date2str(java.sql.Date thisdate)     {
              if (thisdate != null)     {
                   SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                   return sdf.format(thisdate);
              }     else     {
                   return "";
         public java.util.Date str2date(String thisdate)     {
              String dateFormat = "yyyy-MM-dd"; // = 1998-12-31
              java.util.Date returndate = null;
              if (thisdate != null)     {
                   SimpleDateFormat dateFormatter = new SimpleDateFormat(dateFormat);
                   try {
                        returndate = dateFormatter.parse(thisdate);
                   } catch (ParseException pe) {
                        System.out.println (pe.getMessage());
              return returndate;
         }

  • Reading each value from spreadshee​t file with delay (multiple rows and columns)

    Hi,
    a) I want to read EACH VALUE from a spreadsheet file having multiple rows and columns WITH DELAY. I am attaching my VI and sample datalog file for reference (tempsensor.txt).I need to do so because as soon as I read put ON the Sensor button on front panel, LV reads all the values at one go. I need the values for each temperature to be displayed after a delay.
    b) Secondly, I would like to read another file containing the state of four antennas (deployed:1; undeployed:0). I am logging state of each antenna in each column of the file(magnet.txt) I need to have four LEDS on front panel to display state of the antennas. I dont know what I have done for antennas in my VI is right or wrong. I guess thats rhe wrong way to approach the problem. Please help!!!(column1: Antenna1 state ; Column2:Antenna2 state.. and so..on..)
    Any help would be greatly appreciated!!
    Thanks in advance,
    Ratnesh
    FYI: The first column in my datalog file represents timestamp(number of seconds elapsed), second column: reading for temperature sensor 1, third column: reading for temperature senosr 2, and so on. I am using approx. 11 temperature sensors.
    Also, I have generated the log files for the reference purpose only. They do not represent the actual values. They are far away from actual values.
    Attachments:
    01032005.zip ‏30 KB

    Look at this modified version of your VI. After looking at it, I determined that a shift reggister was not required in this case.
    Lynn
    Attachments:
    MultiSensors.2.vi ‏85 KB

  • Calculated value from multiple rows in selection set

    Consider this query
    SELECT WELL.UWI
    FROM geo_formation A, WELL
    WHERE ( (select min(top_depth)
    from geo_formation B
    where B.uwi = A.uwi
    and form_id = 'WDBD' )
    (select min(top_depth)
    from geo_formation C
    where C.uwi = A.uwi
    and form_id = 'VKNS' )
    ) > 10
    AND A.uwi = WELL.UWI
    AND A.FORM_ID IN ('WDBD','VKNS')
    ORDER BY WELL.UWI, A.FORM_ID
    The question asked by the query is
    Show me all the entities (entities are identified by WELL.UWI)
    where the distance between the geological formations (identified by WDBD and VKNS)
    is greater than 10
    The distance in question of course is calculated in the
    (select min(top_depth)
    from geo_formation B
    where B.uwi = A.uwi
    and form_id = 'WDBD' )
    (select min(top_depth)
    from geo_formation C
    where C.uwi = A.uwi
    and form_id = 'VKNS' )
    portion of the where clause.
    ** My question:
    Is there any way to get this calculated value to be part of the selection list
    ie.
    SELECT WELL.UWI, 'the calculated value in question'
    FROM geo_formation A, WELL ...

    Thanks Barbara; once again your solution to one of my problems works like a charm.
    On top of that, I learned something important; I did not know that one can essentially achieve the same results as creating a temporary table by including the appropriate (select ...) in the from clause.
    Thanks again.
    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Barbara Boehmer ([email protected]):
    SELECT a.uwi, (bmin - cmin) distance
    FROM well a,
    (SELECT uwi, MIN (top_depth) bmin
    FROM geo_formation
    WHERE form_id = 'WDBD'
    GROUP BY uwi) b,
    (SELECT uwi, MIN (top_depth) cmin
    FROM geo_formation
    WHERE form_id = 'VKNS'
    GROUP BY uwi) c
    WHERE b.uwi = a.uwi
    AND c.uwi = a.uwi
    AND bmin - cmin > 10
    ORDER BY a.uwi
    /<HR></BLOCKQUOTE>
    null

  • Calculating values from repeated fields.

    I have a subform that repeatable, how to i calculate a value from a fields from the repeated values?

    Hi,
    Try using the following FormCalc code on the "total" field which is outside of your repeating row/subform:
    total.rawValue = sum(form1.Page1.Row1[*].Amount[*]);
    Row1 - Repeating Row
    Amount - Column dedicated to Amount
    Hope this helps
    Thanks,
    VJ

  • Getting Return values from RFC function call with visual basic

    Hi,
    I am creating a sample app to connect to a SAP system which call its RFC functions created with ABAP. It was known that the function will return more than 1 return values.
       SAP Function name ==> "ZFMTP_RFC_GET_RESULT"
            Export parameters (to SAP):
                    - Student Name [char 10]         ==> "STUNAME"
                    - Student ID         [char 20]        ==> "STUID"
           Return values (From SAP):
                    - Results [char 10]        ==> "RESULT"
                    - Remarks [char 200]        ==> "REMARKS"
    i have managed to get sample codes for connecting and call a RFC function with vb but they only get a return value. How do i retrieve multiple return values like the above function "RESULT" and "REMARKS"?
    Here's my vb code to accessing the function
            Dim R3 As Object
            Dim FBFunc As Object
            Dim returnFunc As Boolean
            Dim connected As Boolean
            R3 = CreateObject("SAP.Functions")
            R3.Connection.Client = "000"
            R3.Connection.User = "BCUSER"
            R3.Connection.Password = "minisap"
            R3.Connection.Language = "DE"
            R3.Connection.System = "dtsystem"
            R3.Connection.Applicationserver = "xxx.xxx.xxx.xxx" 
            connected = R3.Connection.Logon(0, True)
            If connected <> True Then
                MsgBox("Unable to connect to SAP")
            End If
            FBFunc = R3.add("ZFMTP_RFC_GET_RESULT")
            FBFunc.exports("STUNAME") = "Jonny"
            FBFunc.exports("STUID") = "12345"
            returnFunc = FBFunc.Call() <<== How do i get the return value? or RESULT and REMARKS of the RFC Function?
    thanks alot.
    Edited by: Eugene Tan on Mar 4, 2008 7:17 AM

    Hi Gregor,
    Thanks for the link....i am having some doubts with the codes, hope you can clarify them for me if you know the codes..
    Below is the code snippet.
    Set impReturn = CHPASS_FN.Imports("RETURN")  <<=== is RETURN the standard keyword to get a                                                                                return object?
      expPassword.Value = currpass
      expNewPass.Value = newpass
      expFillRet.Value = "1"
    ''' Call change password function
      If CHPASS_FN.Call = True Then
        outFile.Write (", Called Function")
        Message = impReturn("MESSAGE") <<==== So if i have 3 return values..i just replace with the return                                                               value variable names?
        outFile.WriteLine " : " & Message
      Else
        outFile.Write (", Call to function failed")
      End If
    thanks alot...all your help is very appreciated.

  • Method all values from row

    Hi,
    Is there a method that get the all the values of a row? I've gone through the java api but didn't found one, but wanted to be sure.
    If not I'll have to do getValueAt for every column?
    Grtz

    Here is one possible implementation using RowTableModel (a self made class).
    To access a row, we can use this: Product product = (Product) model.getRow(rowIndex);
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.table.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import java.util.List;
    public class Tabel extends JPanel {
        private JTable table;
        private JTextField filterText;
        private TableRowSorter<MyTableModel> sorter;
        private String output;
        private final MyTableModel model;
        public Tabel() {
            //Create a table with a sorter.
            model = new MyTableModel();
            sorter = new TableRowSorter<MyTableModel>(model);
            table = new JTable(model);
            table.setRowSorter(sorter);
            table.setPreferredScrollableViewportSize(new Dimension(500, 200));
            table.setFillsViewportHeight(true);
            //Single selection
            table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
            //Making sure columns can't be dragged and dropped
            table.getTableHeader().setReorderingAllowed(false);
            //Double click event
            table.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent mouseEvent) {
                    if (mouseEvent.getClickCount() == 2) {
                        System.out.print(output);
            //Create the scroll pane and add the table to it.
            JScrollPane scrollPane = new JScrollPane(table);
            //Add the scroll pane to this panel.
            add(scrollPane);
            JPanel form = new JPanel();
            JLabel l1 = new JLabel("Filter Text:");
            form.add(l1);
            filterText = new JTextField(15);
            //Whenever filterText changes, invoke newFilter.
            filterText.getDocument().addDocumentListener(
                    new DocumentListener() {
                        public void changedUpdate(DocumentEvent e) {
                            newFilter();
                        public void insertUpdate(DocumentEvent e) {
                            newFilter();
                        public void removeUpdate(DocumentEvent e) {
                            newFilter();
            l1.setLabelFor(filterText);
            form.add(filterText);
            add(form);
         * Update the row filter regular expression from the expression in
         * the text box.
        private void newFilter() {
            RowFilter<MyTableModel, Object> rf = null;
            //If current expression doesn't parse, don't update.
            try {
                rf = RowFilter.regexFilter("(?i)" + filterText.getText(), 0); //"(?i)" => Zoeken gebeurd case-insensitive
            } catch (java.util.regex.PatternSyntaxException e) {
                return;
            sorter.setRowFilter(rf);
        class MyTableModel extends RowTableModel {
            private final List<Product> mData;
            private final List<String> cNames;
            public MyTableModel() {
                super(Product.class);
                mData = new ArrayList<Product>();
                mData.add(new Product("Frontline Small", 5, 1));
                mData.add(new Product("Frontline Medium", 10, 2));
                mData.add(new Product("Frontline Large", 15, 1));
                mData.add(new Product("Frontline Extra Large", 20, 2));
                mData.add(new Product("Frontline spuitbus", 7.5, 3));
                cNames = new ArrayList<String>();
                cNames.add("Product");
                cNames.add("Prijs");
                cNames.add("Aantal stuks beschikbaar");
                setDataAndColumnNames(mData, cNames);
                setColumnClass(0, String.class);
                setColumnClass(1, Double.class);
                setColumnClass(2, Integer.class);
            public Object getValueAt(final int rowIndex, final int columnIndex) {
                switch (columnIndex) {
                    case 0:
                        return mData.get(rowIndex).getDescriction();
                    case 1:
                        return mData.get(rowIndex).getPrice();
                    case 2:
                        return mData.get(rowIndex).getNumber();
                return null;
            @Override
            public Class getColumnClass(int column) {
                return super.getColumnClass(column);
        private static void createAndShowGUI() {
            //Create and set up the window.
            JFrame frame = new JFrame();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            //Create and set up the content pane.
            Tabel newContentPane = new Tabel();
            newContentPane.setOpaque(true); //content panes must be opaque
            frame.setContentPane(newContentPane);
            //Display the window.
            frame.pack();
            frame.setVisible(true);
        public static void main(final String[] args) {
            //Schedule a job for the event-dispatching thread:
            //creating and showing this application's GUI.
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    createAndShowGUI();
    class Product {
        private String descriction;
        private double price;
        private int number;
        Product(final String descriction, final double price, final int number) {
            this.descriction = descriction;
            this.price = price;
            this.number = number;
        public String getDescriction() {
            return descriction;
        public void setDescriction(final String descriction) {
            this.descriction = descriction;
        public int getNumber() {
            return number;
        public void setNumber(final int number) {
            this.number = number;
        public double getPrice() {
            return price;
        public void setPrice(final int price) {
            this.price = price;
        @Override
        public String toString() {
            return descriction + ", " + price + ", " + number;
    }

  • Direction Needed: Storing calculated values from datagrid column in order to call values into graph

    Hi all,
    I am new to Flex/Flash Builder, actionscript, and mxml, so please be kind.
    I have developed a small program that has a component that displays a datagrid fed with information out of a mysql db via a php data services connection. Within that same component (page), I have a graph that charts the dates via a plot chart. I am interested in adding a line series to the graph, but the data I want to use is a calculated field in the datagrid which I used a custom lable function to derive and display. Can someone steer me to the correct method to store such values and how to call them into a chart?
    Some addition information
    Custom label function:
      /* Custom label function for the Delta1 column. Calculates the number of days between the planting date and 10% flower. */
                                  private function calculateTo1stFlower(item:Object, column:GridColumn):String {
                                            var tempDate1:Date = new Date(item.dflower10 - item.dplanting);
                                            return Math.round((tempDate1.time / MS_PER_DAY) + 1).toString();
    /* Number of milliseconds in a day. (1000 milliseconds per second * 60 seconds per minute * 60 minutes per hour * 24 hours per day) */
                                  private const MS_PER_DAY:uint = 1000 * 60 * 60 * 24;
    Within my spark datagrid
    <s:GridColumn width="30" headerText="Δ1" labelFunction="calculateTo1stFlower" ></s:GridColumn>
    I assume I need to store the array of values for this column and then chart the saved values as the xField within the LineSeries. Should I use a class based model?
    The following link seemed like it may be an appropriate path; I am not sure though.
    http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7b51.html
    Thanks in advance for any support,
    Matthew

    Thanks for trying to post DDL, but you have no idea how to do a data model. You do not know that tables have to have keys, what ISO-11179 is, etc. 
    You have a table that is supposed to model companies. Your singular names says that there is only one company!  There is no company identifier (the industry standard is the DUNS). A customer is not a company. We do not use numeric data types for identifiers;
    do you do math on them? NO!  The attribute property comes after the attribute name (you never heard of ISO-11179). 
    Think about how silly VARCHAR(1) is. 
    CREATE TABLE Companies 
    (company_duns CHAR(9) NOT NULL PRIMARY KEY, 
     company_name VARCHAR(30)NOIT NULL, 
     margin_oil INTEGER NOT NULL, 
     margin_hangar INTEGER NOT NULL, 
     margin_cleaning INTEGER NOT NULL);
    INSERT INTO Companies
     VALUES (1, 'AviatKorea', 100, 125, 200), 
    (2, 'AXHollande', 50, 40, 30), 
    (3, 'BFXNorway', 60, 80, 600), 
    (4, 'EEEFrance', 10, 25, 60);
    CREATE TABLE Company_Tariffs
    (company_duns INTEGER NOT NULL
       REFERENCES Companies(company_duns), 
     tariff_type CHAR(1) NOT NULL
        CHECK (tariff_type IN ('A','B','C','D'),
     PRIMARY KEY (company_duns, tariff_type));
    INSERT INTO Company_Tariffs values (1, 'A'), (2, 'C'), (2, 'D'), (3, 'A'), (4, 'A'), (4, 'C'), (4, 'D')
    SELECT * -- do not use * in production code
      FROM Companies AS C,
           Company_Tariffs AS T 
     WHERE C.company_duns = T.company_duns;
    >> I would like something like with a computed column [ ] that retrieves the different contracts used: <<
    You might but a SQL programmer would not. This violated First Normal Form. It is a display report and is done in the presentation layers. 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Getting values from a stored procedure with no parameters

    Hi,
    I'm trying to get values out of a stored procedure that I created on SQL server. I'm trying to get XML values out of the database, but I'm not sure how to get any data out of it written to a file if the procedure doesn't have any parameters.
    So I'm just making a call:
    CallableStatement cs = conn.prepareCall("{call myproc}");
    cs.execute();How do I get values back from this stage?
    Thank you very much,
    Lior

    The short form answer, which assumes that the stored procedure is returning the XML as an out parameter would go something like this.
         public void build(String newUserID, String newPassword) throws SQLException {
              String sql = "{ call GET_ITEM_DETAIL(?, ?, ?, ?, ?, ?) }" ;
              try{
                   init(newUserID, newPassword) ;
                   setCallableStatement(getConnection().prepareCall(sql)) ;
                   getCallableStatement().setInt(1, getItemNumber()) ;
                   getCallableStatement().registerOutParameter(2, oracle.jdbc.driver.OracleTypes.CURSOR) ;
                   getCallableStatement().registerOutParameter(3, oracle.jdbc.driver.OracleTypes.INTEGER) ;
                   getCallableStatement().registerOutParameter(4, oracle.jdbc.driver.OracleTypes.VARCHAR);
                   getCallableStatement().registerOutParameter(5, oracle.jdbc.driver.OracleTypes.VARCHAR) ;
                   getCallableStatement().registerOutParameter(6, oracle.jdbc.driver.OracleTypes.VARCHAR) ;
                   getCallableStatement().execute() ;
                   setSqlResult(getCallableStatement().getInt(3)) ;
                   setSqlMessage(getCallableStatement().getString(4)) ;
                   if( getSqlResult() != 0 ){
                        throw new SQLException(getSqlMessage(), null, getSqlResult()) ;
                   setResultSet((java.sql.ResultSet) getCallableStatement().getObject(2)) ;
                   if( getResultSet() != null ){
                        while( getResultSet().next() ){
                             setItemType(getResultSet().getString("ITEM_TYPE")) ;
                             setItemValue(getResultSet().getString("ITEM_VAL")) ;
                             setDisplayType(getCallableStatement().getString(5)) ;
                             setDisplaySize(Integer.parseInt(getCallableStatement().getString(6))) ;
              catch(SQLException e){
                   java.util.Date now = new java.util.Date() ;
                   java.text.DateFormat format = java.text.DateFormat.getInstance() ;
                   setSqlMessage( e.getClass().getName() + " : " + format.format(now) + " : " + e.getMessage() + " : IN " + getClass().getName() ) ;
                   System.err.println(getSqlMessage()) ;
                   throw e ;
              finally{
                   closeResources() ;
         }The GET_ITEM_DETAIL stored procedure returns several out parameters of various types. The code registers them as out parameters along with an anticipated type and then calls the getXXX(n) method that corresponds with that data type in the appropriate position.
    As I mentioned in my other post, the onus of returning the XML is on the stored procedure, when you get it into Java it's going to be a java.lang.String that you can then parse by whatever means is appropriate to your situation.
    Regards,

  • How to extract Attribute Value from a DBC file with LabWindows and NI-XNET library

    Hi all,
    For my application, i would like to feed my LabWindows CVI Test program with data extracted from *.dbc file (created by another team under Vector CANdb++).
    These files contains all CAN frame definition
    and also some extra information added to :
    Message level,
    Signal level,
    Network Level
    These extra information are set by using specific ATTRIBUTE DEFINITIONS - FUNCTIONALITY  under Vector CANdb++
    The opening of the DataBase works under NI-XNET DataBase Editor as in LabWindows using: nxdbOpenDatabase ( ... )
    No attribute seems be displayable under the NI-XNET DataBase Editor (it's not a problem for me)
    Now, how, using the NI-XNET API and CVI, be able to extract these specially created attributes ?
    Thanks in advance.
    PS : In attached picture, a new attribute called Test_NI, connected to a message
    Attachments:
    EX1.jpg ‏36 KB

    Hi Damien, 
    To answer your question on whether the XNET API on LabWindows/CVI allows you to gain access to the custom attributes in a DBC file, this is not a supported feature. The DBC format is proprietary from Vector. Also, custom attributes are different for all customers and manufacturers. Those two put together make it really difficult for NI to access them with an API that will be standard and reliable.
    We do support common customer attributes for cyclic frames. This is from page 4-278 in the XNET Hardware and Software Manual : 
    "If you are using a CANdb (.dbc) database, this property is an optional attribute in the file. If NI-XNET finds an attribute named GenMsgSendType, that attribute is the default value of this property. If the GenMsgSendType attribute begins with cyclic, this property's default value is Cyclic Data; otherwise, it is Event Data. If the CANdb file does not use the GenMsgSendType attribute, this property uses a default value of Event Data, which you can change in your application. "
    Link to the manual : http://digital.ni.com/manuals.nsf/websearch/32FCF9A42CFD324E8625760E00625940
    Could you  explain us the goal of this attribute, and what you need it on your application.
    Thanks,
    Christophe S.
    FSE East of France І Certified LabVIEW Associate Developer І National Instruments France

  • How to combine multiple columns into one column and delete value the row (NULL) in sql server for my example ?

    My Example :
    Before:              
    Columns
    name               
    address          
                   jon                      DFG
                   has                     NULL
                   adil                      DER
    After:                  
    Column 
                                    Total   
                      name : jon , address : DFG
                      name : has
                      name : adil , address : DER

    Why not doing such reports on the client site?
    create table #t (name varchar(10),address varchar(20))
    insert into #t values ('jon','dfg'),('has',null),('adil','der')
    select n,case when right(n,1)=':' then replace(n,'address:','') else n end
    from
    select concat('name:',name, ' address:',address  ) n from #t
    ) as der
    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

  • Insert multiple rows with one sql statement in access

    Hi,
    I'm trying to copy a table into another. What I want to do is to use "Insert into table1 select * from table2 where field > val". Something like that. I know a lot of databases support it. I was wondering if ms access ODBC driver also supports it. I searched quite a bit and haven't found a definitive answer on this.
    Thank you

    Yes, M$ Access 2000 supports it. This is from their help:
    INSERT INTO Statement
    Adds a record or multiple records to a table. This is referred to as an append query.
    Syntax
    Multiple-record append query:
    INSERT INTO target [(field1[, field2[, ...]])] [IN externaldatabase]
    SELECT [source.]field1[, field2[, ...]
    FROM tableexpression
    Single-record append query:
    INSERT INTO target [(field1[, field2[, ...]])]
    VALUES (value1[, value2[, ...])
    The way you've written the INSERT, table1 and table2 have to have the same # of columns and the same types, of course.

  • Collecting values from multiple check boxes with same name

    Hi,
    I have a jsp-page with one form with several check boxes sharing the same
    name (but with different values).
    Can I collect the values in an array/list or something?
    /jsp-beginner and google ain't my friend in this case

    this answer not good enough for you?

  • How to select one row with such sql

    hi , everyone
    I got a headache about this sql:
    select * from E_VPN_pbxlink where ((SPILOTNUM ='1234' ) or (SPILOTNUM ='123')) order by SPILOTNUM desc ;
    it retruns 2 records.
    I need to get the record with SPILOTNUM ='1234' , how can I reform this sql
    tks

    Hi,
    I think I see:
    You want the longest spilotnum that starts with the same charachters as the parameter.
    You can do a Top-N Query like this:
    WITH  got_rnum     AS
         select  e.*
         ,     RANK () OVER (ORDER BY  LENGTH (spilotnum DESC)     AS rnum
         from      E_VPN_pbxlink
         where      '123456'     LIKE SPILOTNUM || '%'
    SELECT     *     -- or list all columns except rnum
    FROM     got_rnum
    WHERE     rnum     = 1
    ;There is a slightly simplerr way, using the ROWNUM pseudo-column, but its only slightly easier, and it won't help if, say, you want to pass two or more targets such as '123456' in the same query.

Maybe you are looking for

  • Itunes wont open- needs 2 create an itunes folder in "My music" but cant

    Has anyone ever encountered this problem. I had taken my music folder and put it in an external hard drive... could that be why now Itunes says it cant open or create the file? anyone have a clue? message "the folder "itunes" can not be found or crea

  • Overflow error in Hyperion Financial Reports

    Hi All, I'm using Hyperion Financial Reporting Studio version 9.3.1. Recently we are facing few issues with FR. When we try to copy a column, we are getting the "overflow" error. Can someone help on how to resolve this issue ? FYI. The no. of Rows in

  • Unknown error occurred (-19)

    I just finished updating my Iphone to the new software, and while trying to restore my previous back up data, i got an error message that reads: " Itunes could not restore the Iphone because an unkown error occurred (-19)".. i have back up data as ol

  • Pse 10 Organizer does not load

    This is what has been happening Pse 10 organizer NEVER works it continues to lock-up. I have tried to use the repair and optimizer tools with no luck they lock-up as they are running and do nothing. I have deleted the thumbnail catch and rebuilt it t

  • Why can't I advance a video frame-by-frame with the arrow keys?

    I am able to play a video, and to scrub through by clicking and dragging the play head, but when the video is paused, my arrow keys won't advance frame-by-frame.  Is there a place that I have to enable the arrow key function?  I've looked through the