Calculate w / Numeric or Decimal Data Types

Working in ASP VBscript, connected to a SQL Server 2000 database.

Trying to average values returned in a Recordset into a session variable, using the following:

< %
Dim VComm
Dim vResp
Dim vLead
Dim vQual
Dim vPack
Dim vTotal

vComm = rsQuality.Fields.Item ("Comm"). Value
vResp = rsQuality.Fields.Item ("Resp"). Value
vLead = rsQuality.Fields.Item ("Lead"). Value
vQual = rsQuality.Fields.Item ("Qual"). Value
vPack = rsQuality.Fields.Item ("Pack"). Value
% >

< % Session("AVG") = (vComm + vResp + vLead + vQual + vPack)/5.00% >)

It works fine as long as the data type for the columns of the source in the SQL Server database is "Integer", numbers of i.e.whole. When the data type is 'comma' or 'digital', the following error is generated when the page is served:

Error running Microsoft VBScript '800a000d '.

Type mismatch

Samples/pages/report_views/quattro_overview.asp, line 216

Part of what confuses me, is that the error only occurs when you try to calculate in expression... A test, I set the session variable = to each of the variables (with the decimal or numeric data type) indidually and the session variable dspilays fine, IE as a value(e.g.") 1.7 ") decimal. But when I try to calculate these decimal values, as shown in the expression above, I get the error message.

Any help is greatly appreciated.

Kind regards

Chris Robinson

18 Sep 2006 macromedia.dreamweaver.appdev, stratcat900 wrote:

> Part of what confuses me, is that the error only occurs when you try
> to calculate in expression... A test, I set the session
> variable = to each of the indidually of variables (with the data type as
(> decimal or numeric) and the session variable dspilays fine, as
> a decimal value (e.g." 1.7 "). But when I try to calculate these
> decimal values, as shown in the expression above, I get the error
> message.
>
> Any help is greatly appreciated.

Try their casting as Double (CDbl()):

vComm = CDbl (rsQuality.Fields.Item("Comm"). Value)
vResp = CDbl (rsQuality.Fields.Item("Resp"). Value)
vLead = CDbl (rsQuality.Fields.Item("Lead"). Value)
vQual = CDbl (rsQuality.Fields.Item("Qual"). Value)
vPack = CDbl (rsQuality.Fields.Item("Pack"). Value)

http://DevGuru.com/technologies/VBScript/13905.asp

--
Joe Makowiec
http://Makowiec.NET/
E-mail: http://makowiec.net/email.php

Tags: Dreamweaver

Similar Questions

  • Probable bug with decimal data type mapping in storage of XmlType relational object

    Hello

    I'm having a problem with what appears to be a bug me when Oracle creates the mapping object / relational schema for a data type "XSD: Decimal":

    I want to store geo codes 6 fractional digits, so I need to 3 digits to the left and 6 digits to the right of the decimal point.

    In the XSD data type restrictions, which would give me a 'fractionDigits' and a 'totalDigits' 9 6.

    Oracle must convert this number (9, 6).

    However, what Oracle made out that is a NUMBER (15.6)

    In order to get an Oracle to generate a NUMBER (9, 6), I need to qualify the 'totalDigits' 3, which is accepted by Oracle, but makes my schema invalid for virtually any other application XML, because it violates the official specs of XSD:

    http://www.w3.org/TR/xmlschema-2/#RF-fractionDigits:

    4.3.12.4 constraints on fractionDigits components of schema

    Schema component constraint: fractionDigits less than or equal to totalDigits

    It is an error for fractionDigits is greater than totalDigits.

    Is it possible to have the good totalDigits of 9 in my scheme and force the Oracle to translate that into NUMBER (9,6)?

    Maybe some attribute oraxdb I do not know yet?

    I'm surprised that this has not been found earlier.

    There was an announcement about this before, but he did not get the real answers:

    TotalDigits and fractionDigits to number conversion problem

    Here is my complete code example:

    -- Registering the schema
    BEGIN
    DBMS_XMLSCHEMA.REGISTERSCHEMA(
    'http://localhost/decimaltest.xsd',
    '<?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" xmlns:oraxdb="http://xmlns.oracle.com/xdb" oraxdb:storeVarrayAsTable="true" oraxdb:schemaURL="http://localhost/decimaltest.xsd">
      <xs:element name="dataTypeTests" oraxdb:SQLName="ZZZ_DATA_TYPE_TEST" oraxdb:SQLType="ZZZ_DATA_TYPE_TEST_TYPE" oraxdb:defaultTable="" oraxdb:tableProps="TABLESPACE CATALOG NOLOGGING" oraxdb:maintainDOM="false">
      <xs:complexType>
      <xs:sequence>
      <xs:element name="geoCode" type="geoCodeType" oraxdb:SQLName="GEO_CODE" oraxdb:maintainDOM="false"/>
      </xs:sequence>
      </xs:complexType>
      </xs:element>
      <xs:simpleType name="geoCodeType">
      <xs:restriction base="xs:decimal">
      <xs:totalDigits value="9"/>
      <xs:fractionDigits value="6"/>
      </xs:restriction>
      </xs:simpleType>
    </xs:schema>',
    gentables=>FALSE);
    end;
    /
      
      
    -- Display the auto-generated Oracle custom type
    describe ZZZ_DATA_TYPE_TEST_TYPE;
      
    -- Clean up
      
    begin
      DBMS_XMLSCHEMA.DELETESCHEMA(
      'http://localhost/decimaltest.xsd',
      DBMS_XMLSCHEMA.DELETE_CASCADE
      );
    end;
    /
    

    In the XSD data type restrictions, which would give me a 'fractionDigits' and a 'totalDigits' 9 6.

    Oracle must convert this number (9, 6).

    And that's where you're wrong.

    fractionDigits = 6 means at least 6 digits located to the right of the decimal point.

    This is different from the semantics of NUMBER (m, n), where n is exactly n fractional digits stored.

    123.456789 is a valid number by the XSD.

    123456789 is as valid a number, but of course it does not fit in a NUMBER (9.6).

    Oracle must create a NUMBER (15.6) to store any number of valid schema, it is a necessary condition.

    But this is not a sufficient condition: obviously, any number in a NUMBER (15.6) is not valid per the XSD, and this is where the schema validation occurs to enforce the constraints of two facets.

    Here are some examples:

    BEGIN

    DBMS_XMLSCHEMA. REGISTERSCHEMA)

    schemaURL-online "decimaltest.xsd."

    schemaDoc =>

    '

    http://www.w3.org/2001/XMLSchema"elementFormDefault ="qualified"xmlns:oraxdb ="http://xmlns.oracle.com/xdb"oraxdb:storeVarrayAsTable ="true"oraxdb:schemaURL ="http://localhost/decimaltest.xsd">" "

    '

    genTypes-online true

    genTables-online fake

    enableHierarchy-online dbms_xmlschema. ENABLE_HIERARCHY_NONE

    );

    end;

    /

    SQL > declare

    doc 2 xmltype: = xmltype)

    3'123456789"

    .createSchemaBasedXML('decimaltest.xsd') 4);

    5. start

    6 doc.schemaValidate ();

    7 end;

    8.

    PL/SQL procedure successfully completed.

    SQL > declare

    doc 2 xmltype: = xmltype)

    3'123456789.1'

    .createSchemaBasedXML('decimaltest.xsd') 4);

    5. start

    6 doc.schemaValidate ();

    7 end;

    8.

    declare

    *

    ERROR on line 1:

    ORA-31154: invalid XML document

    ORA-19202: an error has occurred in the processing of XML

    LSX-00215: value '123456789.1' whose total numbers exceed 9

    ORA-06512: at "SYS." XMLTYPE", line 354

    ORA-06512: at line 6

    SQL > declare

    doc 2 xmltype: = xmltype)

    3'12.3456789'

    .createSchemaBasedXML('decimaltest.xsd') 4);

    5. start

    6 doc.schemaValidate ();

    7 end;

    8.

    declare

    *

    ERROR on line 1:

    ORA-31154: invalid XML document

    ORA-19202: an error has occurred in the processing of XML

    LSX-00211: "12.3456789", including the fractional numbers exceeds 6

    ORA-06512: at "SYS." XMLTYPE", line 354

    ORA-06512: at line 6

  • Problem SQL Loader: load decimal data type

    I'm trying to load the following data to my oracle db using sqlldr.

    The DATA are
    ===============================================================
    10500158 919602961512 15014122109153571044261 BadSong_MessageSent sorry, we could not understand the song that you have recorded. Please place your phone near the music and try again. To listen to songs in your playlist, call the 578787 (Re.1 per minute) 2010-06-26 15:36:22 Rajasthan 9602961512_2010_06_26_15_35_57_IST_727298.wav 10.0227 geetweb 10839 songID is null raj 0.96 true 40,8225 0

    ===============================================================

    It is separated from the tab (although it appears so after validation)

    and my control file looks like this.
    ===============================================================
    load data
    INFILE ' / home/oracle/sonam/data/SCfilter_backend_dump.test.csv'
    TRUNCATE
    IN THE SCfilter_backend_dump TABLE
    FIELDS CANCEL BY X ' 09 "trailing nullcols)
    SERIALNO fill tank (20),
    UserID char(20),
    TxnId tank (45),
    SONGID char(20),
    vcode char(20),
    title char (100),
    album tank (100),
    status tank (45),
    MessageSent tank (4000).
    DateTime TIMESTAMP "yyyy-mm-dd hh24:mi:ss"
    circle char(20),
    name of file (100) tank.
    EXTERNAL DECIMAL FileLength
    Server char (20),
    EXTERNAL DECIMAL ResponseTime,
    error char (100),
    language char(20),
    DECIMAL EXTERNAL, speed
    signalquality DECIMAL EXTERNAL,
    BlankCount INTEGER (40),
    isfilevalid char (20))

    ===============================================================


    While my table of looks like this
    ===============================================================
    SQL > desc SCFILTER_BACKEND_DUMP;
    Name Null? Type
    ----------------------------------------- -------- ----------------------------
    USERID NOT NULL VARCHAR2 (20)
    TXNID NOT NULL VARCHAR2 (100)
    SONGID VARCHAR2 (20)
    VCODE VARCHAR2 (20)
    TITLE VARCHAR2 (100)
    ALBUM VARCHAR2 (100)
    STATUS VARCHAR2 (45)
    DATETIME NOT NULL TIMESTAMP (6)
    CIRCLE VARCHAR2 (45)
    FILENAME VARCHAR2 (100)
    FILELENGTH NUMBER (7.2)
    SERVER NOT NULL VARCHAR2 (20)
    RESPONSETIME NUMBER (7.2)
    ERROR VARCHAR2 (100)
    LANGUAGE VARCHAR2 (20)
    SPEED NOT NULL NUMBER (7.2)
    SIGNALQUALITY NUMBER (7.2)
    BLANKCOUNT NUMBER (38)
    ISFILEVALID VARCHAR2 (20)
    MESSAGESENT CLOB

    ===============================================================


    and I get the following error in my log file.

    =================================================================
    Table SCFILTER_BACKEND_DUMP, loaded from every logical record.
    Insert the option in effect for this table: TRUNCATE
    TRAILING NULLCOLS option in effect

    Column Position Len term Encl. Datatype name
    ------------------------------ ---------- ----- ---- ---- ---------------------
    SERIALNO FIRST 20 WHT CHARACTER
    (FIELD FILL)
    USER NAME THEN A CHARACTER 20 WHT
    TXNID WHT 45 CHARACTER FOLLOWING
    CHARACTER 20 WHT SONGID NEXT
    VCODE NEXT WHT 20 CHARACTERS
    NEXT CHARACTER WHT 100
    ALBUM NEXT WHT 100 CHARACTERS
    45 WHT CHARACTER DEPENDING ON STATUS
    CHARACTER OF 4000 WHT FOLLOWING MESSAGESENT
    DATETIME NEXT * WHT DATETIME yyyy-mm-dd hh24:mi:ss
    CIRCLE AND THEN A CHARACTER 20 WHT
    NAME OF THE FILE AND THEN CHARACTER WHT 100
    FILELENGTH NEXT * CHARACTER WHT
    CHARACTER NEXT 20 WHT SERVER
    RESPONSETIME NEXT * CHARACTER WHT
    ERROR FOLLOWS WHT 100 CHARACTERS
    LANGUAGE NEXT WHT 20 CHARACTERS
    THEN THE SPEED * CHARACTER WHT
    SIGNALQUALITY NEXT * CHARACTER WHT
    BLANKCOUNT INTEGER THEN 40
    ISFILEVALID WHT 20 CHARACTER FOLLOWING

    value used for the parameter LINES increased from 64 to 42
    Sheet 1: Rejected - error on the SCFILTER_BACKEND_DUMP table.
    ORA-01460: dead letter or unreasonable conversion requested


    Table SCFILTER_BACKEND_DUMP:
    0 rows successfully loaded.
    1 row not loaded due to data errors.
    0 rows not loading because all WHEN clauses were failed.
    0 rows not populated because all fields are null.


    The space allocated to bind table: 251580 bytes (42 lines)
    ===============================================================


    I'm not able to get the reason why this method is a failure for decimal data loading, while its mentioned in textbooks.
    What is the problem with the description of the control file. In fact WHOLE EXTERNAL works great for loading If integer data only.

    Thank you and best regards,
    Sonam

    I guess that your error is not because of the decimal specification, but rather because INTEGER (40) -it is not allowed. Integer means binary integer and you can only specify a length 1,2,4,8 (fullword). What you probably want to do - load a representation of an integer (as in "25") tank, so you need to specify

    blankcount  INTEGER EXTERNAL(40)
    

    Best regards

    Maxim

  • Decimal data type

    Hello

    I have a table in which a column's data type is number (13.5) if I store 35.99 it is recovered in the same way, but if I store 35.00 get it back that 35.

    Try your digital output, using TO_CHAR of formatting:

    SQL> create table t(num number(13,5));
    
    Table created.
    
    SQL> insert into t values (35.99);
    
    1 row created.
    
    SQL> insert into t values (35.00);
    
    1 row created.
    
    SQL> select num from t;
    
           NUM
    ----------
         35,99
            35
    
    2 rows selected.
    
    SQL> select to_char(num, '99D99') from t;
    
    TO_CHA
    ------
     35,99
     35,00
    
    2 rows selected.
    
    SQL> select to_char(num, '99D90') from t;
    
    TO_CHA
    ------
     35,99
     35,00
    
    2 rows selected.
    
    SQL> select to_char(num, '99D00') from t;
    
    TO_CHA
    ------
     35,99
     35,00
    
    2 rows selected.
    
  • How to handle the data type DECIMAL MySQL converted to DOUBLE in OBIEE 10 gR 3?

    Hi all

    I have a problem in OBIEE 10g to I use the MySQL database as datasource direct to the server of the OBI and I have a column in a MySQL table which was designed as the DECIMAL data type (18.0).
    This column is used to measure a length, and values are included in seconds (without decimals), in the form as:
    "1200"
    in the MySQL database.

    After the import of the MySQL table associated with the repository of the OBI, the OBIEE converts the DECIMAL data type column to the DOUBLE PRECISION data type automatically.

    My goal is to reach the values in this form, certainly in the sense of the term (not at the time!):
    hh mm ss

    In order to accomplish, I tried to change the format of column with the ROUND function:
    ROUND (db.table.column / * 3600 * 2)

    The problem is that it doesn't work well if values can be divided with no rest for example
    original value: 7200
    new value (ROUND): 2

    In the case of my example:
    original value: 1200
    new value (ROUND): 0
    It's false, because 1200 seconds are not equal to 0 hours, I want to see two hours of _0.33333_ OR I much prefer more _0 hour 20 m_

    Anyone have any ideas?
    I tried to make a view of database and importing that type of CHAR data in the database, but is not the solution too, because if I filter BI app or try to make a SUM the BI would drop errors...

    Kind regards
    Laszlo

    Hello
    SE refer to this link, it is exactly will meet your need.

    OBIEE 11 g - change seconds in the format hh: mm: DD
    OBIEE functions

    Share updates... :)

    check if useful/correct...

  • Dynamically find the Integer and the Data Type of a Decimal column

    Table: test (INTE number, DECISION number (7.2)) of the

    Try to dynamically determine the type of column.

    Use select user_tab_columns data_type. It returns only the NUMBER that does not indicate whether the column is an integer or a decimal data type.

    Is there a way to dynamically determine whether a column is around or type decimal?

    Thank you

    create table test (INTE, DECI number number (7.2));

    Select column_name, data_type, data_precision from dba_tab_columns where table_name = 'TEST '.

    COLUMN_NAME DATA_TYPE DATA_PRECISION
    ------------------------------ ---------------------------------------------------------------------------------------------------------- --------------
    NUMBER OF INTE
    DECI, NUMBER 7

  • convert the money data type in a decimal format 2.

    What is the best way to convert the money data type in a decimal 2 format in ms sql 2005 for use in my applications.

    This?

    CAST (tr.depositReceivedAmount AS decimal (10, 2))

    I respectfully disagree with the idea that you must change the query column a type of 'money' data to something else.

    In most database servers, "«argent» Silver" is a data type that is designed to provide a very homogeneous behaviour with regard to the arithmetic accuracy.  In Microsoft Access, the representation is a the whole scale.  MS SQL Server, it is obviously similar.  Ditto Oracle and others.

    You like that the money data type in the database for this clarification, because "hell has no fury like an accountant looking for a bad penny."   The column of database storage formats are designed to satisfy the accountants, and it's a good thing.

    Meanwhile, you also want to take care as to exactly how you are dealing with values.  There are several points where the district could take place.  You don't have available the strongest possible manipulation of the floating of the data types in ColdFusion.  You also are somewhat at the mercy of any interface software can be between you and that SQL server, you can use.  "It is correct to all about values , but not several times."

    I suggest to round the value just before the display and user input must be two decimals.

    Then, you may need to do some things at the end of SQL server.  For example, when you update a value in the table, you may need to use logical server to explicitly truncate the value to two decimal places, as well as an update of "$ 34,56" explicitly updates the column "$34,5600.."  (This kind of thing should happen in the context of SQL Server).  You know that the user entry has exactly two significant digits, but maybe (maybe not...)! SQL server may not know this.  You want to ensure that the stored server internally represents exactly two digits, when the origin of a user input value.

    Do not err on the side of "convenience" or "which seems." good on the screen  (If you do, get ready get telephone communications of the accountants, always at inappropriate times of the night.)

  • Convert or map Typedonnees decimal Transact-SQL for Oracle Number data type?

    MSSQL 2005
    Oracle 10.2 g

    In a MSSQL table, I have a column with the data type set on (decimal (1.0), null) with the values of line-1. (695 lines in total)

    In the Oracle table, the proposed mapped column is a number data type. When I import data, I received 695 errors with the message "invalid value for the field. How to properly convert or map Decimal (MSSQL) Transact-SQL for Oracle Number data type for a negative value?

    Thank you.

    How do you load data into Oracle? What tool or programming language you are using? Can you post something cause what you stated in your post should work, but there may be some ODBC, or other type of conversion factors to be taken into account.

     > create table t1 (field1  number(1,0));
    
    Table created.
    
     > insert into t1 values (-1);
    
    1 row created.
    
    UT1 > select * from t1;
    
        FIELD1
    ----------
            -1
    

    HTH - Mark D Powell.

  • Added properties (Group and channel) are not a numeric data type.

    I use a use to add two groups and channel custom properties. The properties are text and digital, double and whole.

    When I create a request in the browser, I selects the custom using the drop-down list property, but has only the drop operator "=" or "<>". "" The property is displayed in the data portal is a number of float. I had this problem when I was adding properties custom by using a script. I then tried "Navigatorinstallation / my Index DataFinder/Reset/Reset", then repopulated my search box, using the use on my raw data files. At this point, all the properties of my have only the "=" or "<>" choice of operator in the query.

    It seems that my properties are digital in the data portal, but the the query string of the browser.

    Thanks in advance,

    Hi Bill,

    You don't have to delete the files.  Choose the NAVIGATOR menu "settings > My DataFinder > reset... '. "can clilck on the UPPER part of the two buttons, one called"reset the index.  Which will remove all records in database and re-index all of your data files.  If you one of these properties have already optimized, set their State not optimized before resetting the index, otherwise the optimized property data types will persist.

    If this does not help, then the problem could be in the use that you use.

    Brad Turpin

    Tiara Product Support Engineer

    National Instruments

  • Size of the numeric data type

    Hello

    Please can anyone suggest what will be the size allocated for a NUMBER data type in a table.

    When we question user_tab_columns all the table illustrates data_length 22 with the NUMBER data type.

    So what is the importance of accuracy on the size it takes to store data on the storage device?

    Please suggest...

    I think it depends on the values that you actually store and you can find with VSIZE.

    Please take a look at this article:

    http://asktom.Oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:1856720300346322149

    Published by: hm on 29.09.2011 05:33

  • the number (use of space) data type

    Hi guys,.

    Just a query.

    I have a table with a data type of existing column - number (2).

    If I change it to number (8), it will take an extra space if the inserted values are from 2-digit?

    Any URL to reference?

    Thank you

    I have a table with a data type of existing column - number (2).

    If I change it to number (8), it will take an extra space if the inserted values are from 2-digit?

    Any URL to reference?

    No - the amount of space takes a NUMERIC value is based ONLY on the actual value you store.

    You can store 20 numbers that don't take no more space than would a number to two digits.

    Do not believe? Then just store values in a column NUMBER then question the values and the values of DUMP (myColumn) out and see how the actual duration and the internal representation. The value '12300000000000' will not take any space more than the value "123" since the number of SIGNIFICANT digits is the same.

    See my response in this thread of the year last for details and sample data.

    See the programmer's Guide of the OIC for details on how MANY values are stored internally.,.

    http://docs.Oracle.com/CD/E11882_01/AppDev.112/e10646/oci03typ.htm#sthref426

    Oracle database stores the values of the NUMBER data type in a variable length format. The first byte is the exponent and is followed by 1 to 20 mantissa bytes. The high bit of the exponent byte is the sign bit; It is defined for positive numbers, and it is cleared for negative numbers. The lower 7 bits represent the exponent, which is a number of base-100 with an offset of 65.

    To calculate the decimal exponent, add 65 to the exponent of base-100 and add another 128 if the number is positive. If the number is negative, do you the same thing, but eventually the bits are inverted. For example,-5 has an exponent of base-100 = 62 (0x3e). The decimal exponent is therefore (~ 0x3e)-128-65 = 0xc1-128-65 = 193-128-65 = 0.

    Each byte of the mantissa is a base-100 digit, in the 1,100 range. For positive numbers, the digit has 1 added to it. Thus, the number of mantissa for the value 5 is 6. For negative numbers, instead of adding 1, the digit is subtracted from 101. Thus, the digit of the mantissa of the number - 5 is 96 (101-5). Negative numbers have a byte containing 102 appended to the data bytes. However, negative numbers with 20 mantissa bytes do not have byte 102 end. Because the digits of the mantissa is stored in base 100, each byte can represent 2 decimal digits. The mantissa is normalized; zeros are not stored.

    Up to 20 data bytes can represent the mantissa. However, only 19 are guaranteed to be precise. 19 data bytes, each representing a base-100 digit, give a maximum precision of 38 digits for an Oracle NUMBER .

  • [8i] Case statement generates ORA-00932: inconsistent data types

    Note: I work with a 8i database (Yes, he's old enough) and in this case, I have to deal with the types of data (e.g. TANK), I gives me to work with.

    I am trying to calculate the amount of time product expected between manufacturing steps. As I found out though, sometimes I get a negative value then subtract the date the previous step ends the date of that ongoing stage begins. Since it is generally impossible to start a later stage before a previous step (imagine trying to screw a cap on a bottle that has no son Cup yet - it just may not happen), what I found is that sometimes two steps are started the same day and finished the same day (although not necessarily the day they started). This situation CAN occur when a person is two steps and connected to two steps at the same time, rather than log on to one, then the other. So what I need to do in these situations, is to replace the negative number by zero (I'll treat the stage as having no time-out).

    Some examples of data:
    (Note: the data set real is the result of a query and has about 200 K lines and columns more, but this should be representative enough to find a solution that works on my real application.)
    CREATE TABLE     steps
    (     item_id          CHAR(25)
    ,     ord_nbr          CHAR(10)
    ,     sub_nbr          CHAR(3)
    ,     step_nbr     CHAR(4)
    ,     start_date     DATE
    ,     finish_date     DATE
    );
    
    INSERT INTO steps
    VALUES ('A','0000000001','001','0010',TO_DATE('01/01/2011','mm/dd/yyyy'),TO_DATE('01/02/2011','mm/dd/yyyy'));
    INSERT INTO steps
    VALUES ('A','0000000001','001','0020',TO_DATE('01/01/2011','mm/dd/yyyy'),TO_DATE('01/02/2011','mm/dd/yyyy'));
    INSERT INTO steps
    VALUES ('A','0000000001','001','0030',TO_DATE('01/05/2011','mm/dd/yyyy'),TO_DATE('01/06/2011','mm/dd/yyyy'));
    INSERT INTO steps
    VALUES ('A','0000000001','002','0010',TO_DATE('01/01/2011','mm/dd/yyyy'),TO_DATE('01/02/2011','mm/dd/yyyy'));
    INSERT INTO steps
    VALUES ('A','0000000001','002','0020',TO_DATE('01/04/2011','mm/dd/yyyy'),TO_DATE('01/04/2011','mm/dd/yyyy'));
    INSERT INTO steps
    VALUES ('A','0000000001','002','0030',TO_DATE('01/06/2011','mm/dd/yyyy'),TO_DATE('01/07/2011','mm/dd/yyyy'));
    INSERT INTO steps
    VALUES ('B','0000000002','001','0005',TO_DATE('01/10/2011','mm/dd/yyyy'),TO_DATE('01/12/2011','mm/dd/yyyy'));
    INSERT INTO steps
    VALUES ('B','0000000002','001','0025',TO_DATE('01/10/2011','mm/dd/yyyy'),TO_DATE('01/12/2011','mm/dd/yyyy'));
    Here's the query I use that sometimes returns negative values:
    SELECT     item_id
    ,     ord_nbr
    ,     sub_nbr
    ,     step_nbr
    ,     start_date - last_step_finished
    FROM     (
         SELECT     s.*
         ,     LAG (s.finish_date)     OVER     (
                                  PARTITION BY     s.item_id
                                  ,          s.ord_nbr
                                  ,          s.sub_nbr
                                  ORDER BY     s.step_nbr
                                  )     AS last_step_finished
         FROM     steps s
         );
    
    Returns:
    
    ITEM_ID                   ORD_NBR    SUB STEP START_DATE-LAST_STEP_FINISHED
    ------------------------- ---------- --- ---- -----------------------------
    A                         0000000001 001 0010
    A                         0000000001 001 0020                        -1.000
    A                         0000000001 001 0030                         3.000
    A                         0000000001 002 0010
    A                         0000000001 002 0020                         2.000
    A                         0000000001 002 0030                         2.000
    B                         0000000002 001 0005
    B                         0000000002 001 0025                        -2.000
    These are the results I want to see:
    ITEM_ID                   ORD_NBR    SUB STEP START_DATE-LAST_STEP_FINISHED
    ------------------------- ---------- --- ---- -----------------------------
    A                         0000000001 001 0010
    A                         0000000001 001 0020                         0.000
    A                         0000000001 001 0030                         3.000
    A                         0000000001 002 0010
    A                         0000000001 002 0020                         2.000
    A                         0000000001 002 0030                         2.000
    B                         0000000002 001 0005
    B                         0000000002 001 0025                         0.000
    And that's what I tried to do to get these results (comment pointed out which line has generated the error):
    SELECT     item_id
    ,     ord_nbr
    ,     sub_nbr
    ,     step_nbr
    ,     CASE
              WHEN     start_dt - last_step_finished     < 0
              THEN     0
              ELSE     start_dt - last_step_finished  -- THIS LINE GENERATES THE ORA-00932 ERROR
         END                         AS days_in_queue
    FROM     (
         SELECT     s.*
         ,     LAG (s.finish_date)     OVER     ( PARTITION BY  s.item_id
                                    ,          s.ord_nbr
                                    ,          s.sub_nbr
                                    ORDER BY     s.step_nbr
                                  )     AS last_step_finished
         FROM     steps s
         );
    I know that I had errors in data type incompatible before with case statements in this particular 8i database, but I can't seem to understand why I'm getting one this time. I think it has something to do with the NULL value which may occur for last_step_finished. Also, if I change the case statement to:
    ,     CASE
              WHEN     start_dt - last_step_finished     < 0
              THEN     NULL
              ELSE     start_dt - last_step_finished  -- THIS LINE GENERATES THE ORA-00932 ERROR
         END     
    the query works fine. But, I'm not NULL, I 0. In the level of this request, I'll take the averages by item_id/step_nbr, and I want that 0 s to be included in the average. (NULL values, as far as I know, would be excluded. AVG(null,_1,_2) = AVG (1,2) = 1.5 NOT AVG (0,1,2) = 1).

    Thanks in advance!

    CASE requires that all expressions to be of the same type. Numeric data type code is 2, then that date produced different internal datatype 14:

    SQL> select dump(1) a,dump(sysdate) b,dump(sysdate - (sysdate - 1)) c from dual;
    
    A                  B                                   C
    ------------------ ----------------------------------- ------------------------------
    Typ=2 Len=2: 193,2 Typ=13 Len=8: 219,7,6,27,13,7,50,0  Typ=14 Len=8: 1,0,0,0,0,0,0,0
    
    SQL> 
    

    Case is supposed to process until the number, but it does not--a bug in some versions. Use explicit to_number:

    ,     CASE
              WHEN     start_dt - last_step_finished     < 0
              THEN     0
              ELSE     to_number(start_dt - last_step_finished)
         END                         AS days_in_queue
    

    SY.

  • Simulink Inport/Outport data types

    I searched for a while and I am unable to find documentation about what types of data I need to use the inports, outport, settings and in my Simulink models.

    Is there some specific types of data that are, or are not supported?  How VeriStand to determine how to coerce data to send the model?  Also, I was under heard VeriStand uses doubles for everything but then I saw a post that says he uses of I64.

    Any clarification would be much appreciated.

    VeriStand 2013 SP1 (probably upgraded to 2016 in next year if it's relevant)

    MATLAB 2010 b and MATLAB 2012 b (currently)

    > Are there types of specific data that are, or are not supported?

    I don't remember there being any limitation of types beyond what is stated in the considerations help document.

    Considerations relating to the integration of The MathWorks, Inc. Simulink® software models (model Interface T...

    The big hiccup I remember wasn't mainly with types of configurations and data bus.

    IIRC, you can choose any numeric type desired in Simulink. The structure of the model interface that uses VeriStand will handle any type and convert it to double so that it can be consumed by the VeriStand engine.

    > How VeriStand to determine how to coerce data to send the model?

    I think the way it works is that when VeriStand interacts with the Simulink model, it gets a list and information (pointer, data type) of inports, remote villages and settings. Thus, it can capture data from the model (because it has the pointer), and it can cast its data type (because he knows the type) duplicate. If you look at the example model model interface on line 212 it might help to make things more clear on how this could work.

    C:\VeriStand\2016\ModelInterface\custom\examples\template.c

    Double USER_GetValueByDataType (void * ptr, int32_t subindex, int32_t type)
    {
    switch (type)
    {
    case 0:
    {
    / * double * /.
    (double) return (((double *) ptr) [subindex]);
    }
    case 1:
    {
    / * only * /.
    (double) return (((float *) ptr) [subindex]);
    }
    }

    / * return NaN, ok for vxworks and pharlap * /.
    uint32_t nan [2] = {0xFFFFFFFF, 0xFFFFFFFF};
    return *(double*) nan;
    }

    I'm guessing that the full implementation of which uses VeriStand is much more complex, but I think that the idea is the same.

    > Also, I was under heard VeriStand uses doubles for everything but then I saw a post that says he uses of I64.

    VeriStand engine uses indeed of all double rooms.

    You happen to remember this post and you can share the link? I'd be curious to see where this is said and in what context.

  • To change the data type of control/led

    Is it possible to change the underlying data type of the indicator or a control?  I a VI that I want to use that accepts any type of data (essentially data varriant) and display it accordingly.  I have different controls selected to display data of different types in the sense of data vs decimal boolean data vs integer, but certain types of data will be of type uint32 vs int16 vs uint64 etc..  Is it possible to programmatically change the data type, so I need to have all the combinations of indicators?

    The short answer is no. The long answer is that LabVIEW has not 'generic' controls that allow you to display any type of data (apart from the variant of course). There are several ways to address this problem, but all require you as the programmer to manage explicitly each type of data you could possibly meet. Here are some possibilities (in no particular order), please let me know if you would like to help a particular implementation of these.

    1. Force incoming data to variant, use the info option to determine the data type of the original data in a case structure (open G can do this VERY easy), have an indicator on the front panel for each type of data you want and hide those unused
    2. Use a sub-group of experts on the front panel and sub - vi call of to view specific types (that lends itself very well to encapsulate your data in a class and you leave OOP allows to expand into different types of data)
    3. Use a tab with the variant (similar to option 1) control put each kind of data in its own tab, enable only the current
    4. Do a Control-X to accept a Variant option 1 under the hood
    5. Just as a string of format and use a string indicator

    That's all I can think of right now, once again, let me know if you need more information/help on the options.

  • Change the Data Type to node e/s on PXI-7841R FPGA

    I would like to change the data type for the node FPGA of e/s on my card FPGA 7841R (simulation). So far, I have raw data (I16). I want to test something with the calibrated data (FXP).

    The cRIO, you usually go to the properties of module to change the calibration mode...

    I searched 7841R documentation and could not do any weather information this calibration mode was also available on this map.

    Any tips?

    Vincent

    The new maps in the series R offer node fixed point IO (for example, the SMU-7858R), but as mentioned all the old PXI based cards R-series offer only modes of measurement I16.

    Page 22 manual R series is about how to do this conversion: http://www.ni.com/pdf/manuals/370489g.pdf#page=22

    Specifically, it notes that you can calculate the voltage by (output Code I16) * 10.0V / (32 768).

    Even if this can use FPGA resources, it records the host do the same conversions. RT old target with slow processors doing the conversion of I16 or FXP to SGL on the FPGA has saved a lot of time CPU

Maybe you are looking for

  • How do I know when a submissive app has been approved by firefox os market?

    Presented an application on the market of firefox as a developer, I don't know if it was still approved. How will I know when it will be approved?

  • Re: Driver D: is missing (endangered) on Tecra A series und Vista

    How are you all?I have a problem, I installed a program then after installation the PC gave me an error (memory reference error) then I rebooted my PCAnd after that only he had the bad surprise, the D drive disappeared.I tried to use the restore CD t

  • Problem of Toshiba Satellite P10 laptop!

    Hello! I have a laptop TOSHIBA Satellite P10, Windows XP. This is a new computer, not second hand!The problem is that it stops when I connect it to the power adapter. The only way I can work is it charge when turned off and then use it on battery. Th

  • Toshiba 1 TB external HARD drive

    I purchesed one of these comments amonth ago, to the day where I plugged the machine a turned on nothing happened. I left for about an hour and tried again, again, nothing happens, what could be the problem and how would approach I solve this. Congra

  • retaining clips or spring clips HELP plastic

    I have Touchsmart IQ770 and wanted to replace the video card, but taking the heatsink, I broke 3 plastic clips that hold the sink down through the graphics card on the motherboard. As these clips cannot be found anywhere, how you connect the sink on