Database design: field to store percent value

I need to create a table T that holds field P which is going to store percentage values.
1. Should database store in field P value "3.5" or "0.035" if user enters on web page string "3,5%"? Which is wiser design- to store as values in range 0..1, or in range 0...100 for percentages?
2. How does enterprise products solve this? For example, "Oracle E-Business Suite" is there any field that holds percentage value? How it holds?
Thanks.

1. Should database store in field P value "3.5" or "0.035" if user enters on web page string "3,5%"?
Which is wiser design- to store as values in range 0..1, or in range 0...100 for percentages?I prefer storing percentages as numbers in the range 0...1.
To constrain the values on the db filed you can create a check constraint:
SQL> create table test (pct number(4,3));
Table created.
SQL> alter table test add constraint pct_chk
  2  check (pct between 0 and 1);
Table altered.
SQL> insert into test values (1.001);
insert into test values (1.001)
ERROR at line 1:
ORA-02290: check constraint (USER.PCT_CHK) violated
SQL> insert into test values (1);
1 row created.
SQL> insert into test values (0.001);
1 row created.
SQL> insert into test values (0);
1 row created.
SQL> insert into test values (-0.001);
insert into test values (-0.001)
ERROR at line 1:
ORA-02290: check constraint (USER.PCT_CHK) violated
2. How does enterprise products solve this? for example, Oracle Erp is there any field that holds percentage value?I don't know.
Max
[My Italian Oracle blog|http://oracleitalia.wordpress.com/2010/01/17/supporto-di-xml-schema-in-oracle-xmldb/]

Similar Messages

  • Looking for a value in a list stored in a database table field

    Hello,
    I have a field in a database table that contains a comma
    separated list on numbers. In my CFQUERY I am attempting to extract
    records from the database table where a parsed number is present in
    the comma separated list. I have tried the code below, but it is
    throwing an error.
    variables.publicationID is the number that I am looking for
    in the database table field.
    publicationList is the name of the database table field
    containing the comma separated list of numbers.
    where <cfqueryparam value="#variables.publicationID#"
    cfsqltype="cf_sql_integer"> in publicationList
    Can anybody help?
    Many thanks,
    smnbin

    The only way to do it with the data model you currently have
    is as follows:
    WHERE publicationList LIKE '#variables.publicationID#' OR
    publicationList LIKE '#variables.publicationID#,%' OR
    publicationList LIKE '%,#variables.publicationID#,%' OR
    publicationList LIKE '%,#variables.publicationID#'
    You need to check for 4 cases:
    it's the only ID in the list
    it's the first ID in the list
    it's in the middle of the list
    it's the last ID in the list.
    The better solution would be to replace this comma-delimited
    list with a mapping table, where each row in this mapping table
    contains a reference to the main table as well as a single
    publicationID.

  • Material master table/field that can store a value that indicates the sales

    Hello Gurus....
    My Client is looking for a material master table/field that can store a value that indicates the sales volume (quantity) of a material. If the sales volume of a material falls within the top 80% of the total sales volume, then the material will have an indicator of "A", 15% will be "B", bottom 5% will be "C". Business wants to use this field to drive the automatic putaway into different pick zones.
    We cannot use ABC Analysis field (MARC-MAABC) or CC phys.in.ind. (MARC-ABCIN) since they are used for ABC analysis and cycle count based on value, nor volume. Using these fields will limit our future use of the true SAP functionality.
    field in Purchasing view in the material master called Mfg Part Profile. However, this is also against the original functionality of the field.
    Other than, this any other field we can use it? or the only option is to do a custom field?
    Regards,
    Kumar

    Hi
    I think the only option is to have a custom field.
    Regards
    Prasad

  • Store the values in database

    can anyone let me know how to store the values when enter the button in mysql database by using java flex
    <?xml version="1.0" encoding="utf-8"?><mx:Application 
    xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
    <mx:Script>
    <![CDATA[
    import mx.rpc.events.ResultEvent; 
    import mx.controls.Alert; 
    import mx.managers.PopUpManager; 
    import mx.collections.ArrayCollection; 
    private function empLogin():void {lm.Login(txt_empid.text, txt_empname.text, txt_empadd.text);
    private function resLogin(event:ResultEvent):void { 
    var res:String = event.result as String;Alert.show(res);
    ]]>
    </mx:Script>
    <mx:RemoteObject id="lm" destination="logMod">
    <mx:method name="Login" result="resLogin(event)" />
    </mx:RemoteObject>
    <mx:Panel x="46" y="44" width="358" height="271" layout="absolute">
    <mx:title><![CDATA[ EMPLOYEE DETAILS]]></mx:title>
    <mx:Label x="10" y="25" text="Emp_Id" width="84" id="lbl_empid" enabled="true"/>
    <mx:TextInput x="151" y="23" id="txt_empid" displayAsPassword="false" editable="true" enabled="true"/>
    <mx:Label x="10" y="78" text="Emp_Name" width="98" id="lbl_empname" enabled="true"/>
    <mx:TextInput x="151" y="76" id="txt_empname" displayAsPassword="false" editable="true" enabled="true"/>
    <mx:Label x="10" y="134" text="Emp_Address" width="84" id="lbl_empadd" enabled="true"/>
    <mx:TextInput x="151" y="132" id="txt_empadd" displayAsPassword="false" editable="true" enabled="true"/>
    <mx:Button x="136" y="182" label="Submit" id="but_sub" enabled="true" click="empLogin()"/>
    </mx:Panel>
     </mx:Application> 
    thanks&regards
    sonu

    referr:
    http://www.adobe.com/devnet/flex/articles/flex_and_java.html
    http://www.adobe.com/devnet/livecycle/articles/blazeds_testdrive.html

  • Database design to support parameterised interface with MS Excel

    Hi, I am a novice user of SQL Server and would like some advice on how to solve a problem I have. (I hope I have chosen the correct forum to post this question)
    I have created a SQL Server 2012 database that comprises approx 10 base tables, with a further 40+ views that either summarise the base table data in various ways, or build upon other views to create more complex data sets (upto 4 levels of view).
    I then use EXCEL to create a dashboard that has multiple pivot table data connections to the various views.
    The users can then use standard excel features - slicers etc to interrogate the various metrics.
    The underlying database holds a single days worth of information, but I would like to extend this to cover multiple days worth of data, with the excel spreadsheet having a cell that defines the date for which information is to
    be retrieved.(The underlying data tables would need to be extended to have a date field)
    I can see how the excel connection string can be modified to filter the results such that a column value matches the date field,
    but how can this date value be passed down through all the views to ensure that information from base tables is restricted for the specied date, rather than the final results set being passed back to excel - I would rather not have the server resolve the views
    for the complete data set.
    I considered parameterisation of views, but I dont believe views support parameters, I also considered stored procedures, but I dont believe that stored procedures allow result sets to be used as pseudo tables.
    What other options do I have, or have I failed to grasp the way SQL server creates its execution plans and simply having the filter at the top level will ensure the result set is minimised at the lower level? (I dont really want the time taken for the dashboard
    refresh to increase - it currently takes approx 45 seconds following SQL Server Engine Tuning Advisor recommendations)
    As an example of 3 of the views, 
    Table A has a row per system event (30,000+ per day), each event having an identity, a TYPE eg Arrival or Departure, with a time of event, and a planned time for the event (a specified identity will have a sequence of Arrival and Departure events)
    View A compares seperate rows to determine how long between the Arrival and Departure events for an identity
    View B compares seperate rows to determine how long between planned Arrival and Departure events for an identity
    View C uses View A and view B to provide the variance between actual and planned
    Excel dashboard has graphs showing information retrieved from Views A, B and C. The dashboard is only likely to need to query a single days worth of information.
    Thanks for your time.

    You are posting in the database design forum but it seems to me that you have 2 separate but highly dependent issues - neither of which is really database design related at this point.  Rather you have an user interface issue and an database programmability
    issue.  Those I cannot really address since much of that discussion requires knowledge of your users, how they interface with the database, what they use the data for, etc.  In addition, it seems that Excel is the primary interface for your users
    - so it may be that you should post your question to an excel forum.
    However, I do have some comments.  First, views based on views is generally a bad approach.  Absent the intention of indexing (i.e., materializing) the views, the db engine does nothing different for a view than it does for any ad-hoc query. 
    Unfortunately, the additional layering of logic can impede the effectiveness of the optimizer.  The more complex your views become and the deeper the layering, the greater the chance that you befuddle the optimizer. 
    I would rather not have the server resolve the views for the complete data set
    I don't understand the above statement but it scares me.  IMO, you DO want the server to do as much work as possible since it is closest to the data and has (or should have) the resources to access and manipulate the data and generate the desired
    results.  You DON'T want to move all the raw data involved in a query over the network and into the client machine's storage (memory or disk) and then attempt to compute the desired values. 
    I considered parameterisation of views, but I dont believe views support parameters, I also considered stored procedures, but I dont believe that stored procedures allow result sets to be used as pseudo tables.
    Correct on the first point, though there is such a thing as a TVF which is similar in effect.  Before you go down that path, let's address the second statement.  I don't understand that last bit about "used as pseudo tables" but that sounds more
    like an Excel issue (or maybe an assumption).  You can execute a stored procedure and use/access the resultset of this procedure in Excel, so I'm not certain what your concern is.  User simplicity perhaps? Maybe just a terminology issue?  Stored
    procedures are something I would highly encourage for a number of reasons.  Since you refer to pivoting specifically, I'll point out that sql server natively supports that function (though perhaps not in the same way/degree Excel does).   It
    is rather complex tsql - and this is one reason to advocate for stored procedures.  Separate the structure of the raw data from the user.
    (I dont really want the time taken for the dashboard refresh to increase - it currently takes approx 45 seconds following SQL Server Engine Tuning Advisor recommendations)
    DTA has its limitations.  What it doesn't do is evaluate the "model" - which is where you might have more significant issues.  Tuning your queries and indexing your tables will only go so far to compensate for a poorly designed schema (not that
    yours is - just a generalization).  I did want to point out that your refresh process involves many factors - the time to generate a resultset in the server (including plan compilation, loading the data from disk, etc.), transmitting that data over the
    network, receiving and storing the resultset in the client application, manipulating the resultset into the desired form/format), and then updating the display.  Given that, you need to know how much time is spent in each part of that process - no sense
    wasting time optimizing the smallest time consumer. 
    So now to your sample table - Table A.  First, I'll give you my opinion of a flawed approach.  Your table records separate facts about an entity as multiple rows.  Such an approach is generally a schema issue for a number of reasons. 
    It requires that you outer join in some fashion to get all the information about one thing into a single row - that is why you have a view to compare rows and generate a time interval between arrival and departure.  I'll take this a step further and assume
    that your schema/code likely has an assumption built into it - specifically that a "thing" will have no more than 2 rows and that there will only be one row with type "arrival" and one row with type "departure". Violate that assumption and things begin to
    fall apart.  If you have control over this schema, then I suggest you consider changing it.  Store all the facts about a single entity in a single row.  Given the frequency that I see this pattern, I'll guess that you
    cannot.  So let's move on.
    30 thousand rows is tiny, so your current volume is negligible.  You still need to optimize your tables based on usage, so you need to address that first.  How is the data populated currently?  Is it done once as a batch?  Is it
    done throughout the day - and in what fashion (inserts vs updates vs deletes)?  You only store one day of data - so how do you accomplish that specifically?  Do you purge all data overnight and re-populate?   What indexes
    have you defined?  Do all tables have a clustered index or are some (most?) of them heaps?   OTOH, I'm going to guess that the database is at most a minimal issue now and that most of your concerns are better addressed at the user interface
    and how it accesses your database.  Perhaps now is a good time to step back and reconsider your approach to providing information to the users.  Perhaps there is a better solution - but that requires an understanding of your users, the skillset of
    everyone involved, what you have to work with, etc.  Maybe just some advanced excel training? I can't really say and it might be a better question for a different forum.   
    One last comment - "identity" has a special meaning in sql server (and most database engines I'm guessing).  So when you refer to identity, do you refer to an identity column or the logical identity (i.e., natural key) for the "thing" that Table A is
    attempting to model? 

  • Database design and pl/sql vs external procedures

    hi,
    My project involves predicting arrival time of a bus at a bus-stop, given statistical data of traffic patterns on the previous ‘n’(say 3) days, as well as the current location of the bus(latitude-longitude).
    Given current bus location, I derive my distance-until-destination bus-stop, which must be translated into time until arrival.
    Ive enlisted the triggers and procedures involved in making the prediction. Thse procedures especially the determination of perpendicular distances involve some complex trigonometric operations. I would like to know if my approach is correct and my database design is suited for the operations to b performed.
    Will it be more efficient to implement the procedures as external procedures or as pl/sql blocks
    This is my database design:
    LINKS ( a link is the road segment between adjacent bus-stops)
    LINK_ID                NUMBER      [PRIMARY-KEY]
    START_LATITUDE          NUMBER     
    START_LONGITUDE     NUMBER     
    START_STOP_ID          NUMBER
    END_LATITUDE          NUMBER
    END_LONGITUDE          NUMBER
    END_STOP_ID          NUMBER
    LINK_LENGTH          NUMBER
    BUS_ROUTE
    ROUTE_ID               NUMBER
    LINKS_ENROUTE          VARRAY(30) OF NUMBER
    STOPS_ENROOUTE          VARRAY(30) OF NUMBER
    TRACK(keeps track of current location of bus)
    BUS_ID           NUMBER          [PRIMARY-KEY]
    ROUTE          VARCHAR2(20)
    LATITUDE          NUMBER
    LONGITUDE          NUMBER
    TS               TIMESTAMP
    LINK_ID          NUMBER
    START_STOP     NUMBER
    END_STOP          NUMBER
    ARRIVAL_TIMES(actual arrival times of the bus, updated by track)
    BUS_ID           NUMBER     [PRIMARY-KEY]
    BUS_ROUTE          VARCHAR2(20)
    ARRIVAL          TIMESTAMP
    STOP_ID          NUMBER
    ETA (expected time of arrival)
    BUS_ID          NUMBER
    BUS_ROUTE          VARCHAR2(20)
    BUS_STOP_ID     NUMBER
    ARR_TIME          VARRAY(5) OF TIMESTAMP
    Triggers and procedures
    1)TRACK_TRIGGER
    On insert/update of track determine which link the us is currently on.
    Invoke a procedure that calculates perpendicular distance from current location to all links en-route (cursor on LINKS).
    Results are stored in a temporary table. Select the link-id of the tuple whose perpendicular distance is MINIMUM. This is the link the bus is currently on. Place link-id, start_stop_id and end_stop_id in corresponding row of TRACK.
    2)ARRIVAL_TRIGGER
    update ARRIVAL_TIMES.and store in ARRIVAL_TIMES that start-stop id with the time-stamp of the current track record.
    b)update ETA: Find the BUS-STOPS that come before the START_STOP of current track record. All these rows are deleted from the ETA tables, as the bus has already crossed these stops.
    3)Prediction Algorithm Procedure.
    Determine distance until destination for each STOP, 20 stops down from stop current location.
    Determine current avg. speed of the bus over a 2 hour window, by dividing total distance traveled by time taken.
    Calculate time-until arrival T1=current avg. speed * distance until destination
    From the records of previous ‘n’ days (say n=3) find those buses on the same route that were near the link the bus is currently on. Again determine avg speed over 2 hour window and calculate avg. speed.
    Calculate travel time T(i) = speed*distance until destination.     i.=2,3, 4…
    The final predicted arrival time is a weighted sum of all T(i).
    I hope Im not asking for too much, but the help would be greatly appreciated.
    Thankyou,
    Amina

    hello,
    actually i can manage ETA without a varray, since there will b a maxximum of 3 -4 values of expected arrival times at each stop. this can b done with separate columns.
    though i dont quite understand how lag() will help me...from what i understand lag() is to access values of previous rows. but in ETA table each element in the varray(if there is one) is going to be the expected arrival time of buses on a particular route at that particular stop, and is different from the arrival time at a previous stop(i.e.row).
    but for my other table BUS_ROUTE i have 2 varrays describing the links and stops enroute. in quite a few procedures i have to loop through these arrays and perform some calculations in every iteration is varray the best way 2 go, or nested tables?
    Thank you
    Amina
    As an aside, external procedures tend by their very
    nature to be slow - there's an overhead incurred
    each time we step outside the database. Therefore
    you really ought to avoid using a C extproc unless
    your calculations really cannot be done in PL/SQL or
    a Java Stored Procedure.
    Also, before you go down the VARRAY route you should
    consider the virues of analytic functions, notably
    [url=http://download-west.oracle.com/docs/cd/B1050
    1_01/server.920/a96540/functions56a.htm#83619]LAG()[/u
    rl]. I think you really ought to do some
    benchmarking of parformance before you start afdding
    denormalised columns like ETA. You may find the
    overhead in maintaining those columns exceeds their
    perceived benefits.
    Cheers, APC

  • How to store the value of sum of group in Crystal Report at the runtime!

    Hello all,
    I creates a Formula Field that hold the value of Sum of Group in Crystal Report. I would like to know how to store it in a variable and pass it to store procedure. Is it an option in Crystal report to do it. I knew that Crystal Report can cache the report for sharing. My detailed issue as following:
    - Created a Formula Field named TOTAL AMOUNT that calculated the complex expression. This TOTAL AMOUNT is dynamic based on group and variables.
    - I would like to store that value from TOTAL AMOUNT and pass it to the stored procedure parameter IN.
    Any helps are much appreciated. Thanks.

    I doubt that this is possible since it would only calculate this value once the report has data.  This sounds more like a report design question that should be asked over [here|SAP Crystal Reports;

  • Can we use BLOB fields (that store images) in Crystal Report ?

    I'm developing with ASP.NET, VS.NET 2003.
    Using Crystal Report for VS.NET
    DataBase: Oracle 10g
    I store a BLOB field in a table. This field store images, like jpg files.
    The Stored Procedure that I use to fill the report is:
    OPEN MyCursor FOR
    SELECT MyId , MyImg
    FROM MyTable
    MyImg is BLOB field
    However, when I try to use the stored procedure in Crystal Report at design mode, any field can be displayed and then drag and drop to the report, but MyImg is not possible.
    There is an error message:
    Details: ADO Error Code: 0x80004005
    Source: Microsoft OLE DB Provider for Oracle
    Description: Data type is not supported
    I'm afraid that is not so easy for me to change DB connector drivers.
    My question is:
    - Is it possible to use BLOB fields in Cyrstal Reports?
    - Or should I convert them previously to something, so they can be displayed in Crystal Report at desing mode ?
    - If I should change DB connector drivers, which one should I use and from where should I download it and then install it in my Web Server?
    Thank you very much!

    Hi,
    I dont know much at all about CR, but I do know Microsoft's OLEDB Provider for Oracle doesnt support Blob datatype.. http://support.microsoft.com/kb/q244661/
    Oracle's OLEDB provider does though, you can get it as part of the ODAC download on OTN.
    Hope that helps,
    Greg

  • Database Design/Application architecture question

    I'm working on a Java web app that includes creating a database from scratch. The UI needs to model a mostly static set of choices that led to other choices that lead to other choices..... I'm trying to figure out how to model this in a table or set of tables and how to design the UI and servlet interaction. Here's an example, in Petstore lingo:
    Do you need a dog house?
    For a small dog?
    Red?
    Blue?
    How many?
    For a big dog?
    Brown?
    Yellow?
    How many?
    Side windows?
    Do you need a bird cage?
    How many water dispensers?
    For big bird?
    This sort of multiple dependent options seems hard to model in a database. I'm trying to do this at the database level so that I can have a dynamic front end, in which I get the collection of options and then use JSTL to populate the UI with the chocies for whatever level or step I'm at. Any suggestions? I haven't had to solve a design problem precisely like this where some choices may have dependent choices, but others do not, and some have dependent choices which have very specific dependent choices that have very specific dependent choices. Thanks.
    Ken

    I'm working on a Java web app that includes creating
    a database from scratch. You mean the UI drives creating the database?
    Why?
    That is often driven by developer rather than business requirements and is often a bad idea. It is often done solely so the developer doesn't have to type as much. And not typing very much is solved by code generation while using meta data solutions for it is usually a bad maintainance idea.
    But if you need to then you create meta data.
    Table TheValues
    - Field: Value Id.
    - Field: Value Name
    - Field: Value Value
    Table: Collection
    - Field: Collection Id
    - Field: Collection Name
    Table: Link table
    - Field: Collection Id
    - Field: Id type
    - Field: Id (Collection or Value)
    Display values can be kept in another table or used directly.
    Notice that a collection can contain another connection.
    You can combine the first two tables as well.

  • SIMPLE Database Design Problem !

    Mapping is a big problem for many complex applications.
    So what happens if we put all the tables into one table called ENTITY?
    I have more than 300 attributeTypes.And there will be lots of null values in the records of that single table as every entityType uses the same table.
    Other than wasting space if I put a clustered index on my entityType coloumn in that table.What kind of performance penalties to I get?
    Definition of the table
    ENTITY
    EntityID > uniqueidentifier
    EntityType > Tells the entityTypeName
    Name >
    LastName >
    CompanyName > 300 attributeTypes
    OppurtunityPeriod >
    PS:There is also another table called RELATION that points the relations between entities.

    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    check the coloumn with WHERE _entityType='PERSON'
    as there is is clustered index on entityType...there
    is NO performance decrease.
    there is also a clustered index on RELATION table on
    relationType
    when we say WHERE _entityType ='PERSON' or
    WHERE relationType='CONTACTMECHANISM'.
    it scans the clustered index first.it acts like a
    table as it is physically ordered.I was thinking in terms of using several conditions in the same select, such as
    WHERE _entityType ='PERSON'
      AND LastName LIKE 'A%' In your case you have to use at least two indices, and since your clustered index comes first ...
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    Have you ever thought of using constraints in your
    modell? How would you realize those?
    ...in fact we did.We have arranged the generic object
    model in an object database.The knowledge information
    is held in the object database.So your relational database is used only as a "simple" storage, everything has go through your object database.
    But the data schema is held in the RDBMS with code
    generation that creates a schema to hold data.If you think that this approach makes sense, why not.
    But in able to have a efficent mapping and a good
    performance we have thought about building only one
    table.The problem is we know we are losing some space
    but the thing is harddisk is much cheaper than RAM
    and CPU.So our trade off concerated on the storage
    cost.But I still wonder if there is a point that I
    have missed in terms performance?Just test your approach by using sufficiently data - only you know how many records you have to store in your modell.
    PS: it is not wise effective using generic object
    models also in object databases as CPU cost is a lot
    when u are holding the data.I don't know if I'd have taken your approach - using two database systems to hold data and business logic.
    PS2: RDBMS is a value based system where object
    databases are identity based.we are trying to be in
    the gray area of both worlds.Like I wrote: if your approach works and scales to the required size, why not? I would assume that you did a load test with your approach.
    What I would question though is that your discussing a "SIMPLE Database Design" problem. I don't see anything simple in your approach when it comes to implementation.
    C.

  • Passing TestStand Variable to Database Options field

    I seem to be having an issue with a non-optimized database query possibly because of a TestStand limitation or my limited knowledge of TestStand, probably the latter. What is currently happening is a custom type logs its data through a statement setup in the Database Options. This statement has a primary key reference and grabs that primary key from a recordset returned by this query:
                  "SELECT id FROM step_result order by date_time desc limit 1".
    This query can take around 30 seconds or longer to run which is way too long for a database query returning 1 row.
    What I'd like to do is change that query, inside of the Database Options, to utilize a StationGlobals variable which will drastically speed this query up.
    I'm doing the same query, with proper WHERE clauses, in another place (as a work-around solution to this same problem, which may be reverted if I fix this problem) and it is laid out as followed:
    "SELECT id  FROM step_result where uut_result=\""+ StationGlobals.UUT_Result_ID +"\"  order by date_time desc limit 1"
    I need that query to be run, with that variable, in the database options statement. Is this possible to do in TestStand? The problem I've seen so far is that the "Command Text" entry for the "Get Value from Recordset" doesn't like variables and string concats. Am I missing something obvious?
    Thanks in advance for any help.

    The way our database is designed, this involves 3 different tables:
    step_result - ID Primary kefield
    meas_mul_numericlimit - ID primary key, foreign key of step_result ID field
    meas_mul_numericlimit_info - Primary and foreign key for step_result ID field
    A "parent" row is added into the step_result table, if the step type is of MultipleNumericLimitTest, a row is added into the m_m_n_i to hold graphing information and the actual data is inserted into the m_m_n table.
    The MNLT step type uses the query to get the ID of the last entered step_result for the m_m_n_i table to setup the proper relationship. The problem is we need a specific s_r ID for everything to work properly. Obviously the Type definition is a "post processing" method as it can get the current step's ID from the database. The problem is that query isn't optimized and sorting 500k rows is incredibly slow.
    The other problem, which I used a workaround on, dealt with a similar yet different situation.
    In our Main sequence file, we had a sequence which would establish graphing features for tests whose measurements are spread across different "parents"/steps. We would establish the m_m_n_i information and then associations for a graph_parent field. What I did in that case was, create the association, then using normal SQL steps, gather the ID field and then update the ID for the graph_parent. Since this process was done pre-tests/measurements, I had the luxury to be able to do these steps outside of the database options field. In the other case though, its mid-test and based on measurements so I can't do the same workaround.
    One thing I was wondering also is, in the processing of the custom type, is there a way to access the ID of the currently being processed step? If there was a variable for that, then I could just use the expression field.
    Does this help/explain this a little better?

  • Maximum length that a database table field can hold

    Hello All,
    I am creating a database table to store different values corresponding to a particular feature coming under different countries. Some of the values have to hold more than 700characters, which is basically like a paragraph. I have found that the maximum length a table field can hold is 255characters.
    Is there any way by which i can enter more than 500 characters.
    Thanks In Advance,
    Shino

    Hi,
    If the Max length that is required is 700 characters then:
    1) Isn't it possible in your case to divide the same into mutiple Fields of having 255 length each.
    2) In sap there are some tables which store whole Code like table for storing Code for reports in SAP is
        REPOSRC  But the whole code is first stored in Hexadecimal format and not in terms of direct characters.
    May be on same lines you can change the CHARACTER format and then store it and again convertt he same for further use.
    You can have look into the Table REPOSRC . May be it helps.
    Regards,
    Vishal

  • How to store the value in table

    Hi All,
    I ve a requirement where im adding a check box on a seeded supplier_create page via personalization. The seeded page contains only a root AM and a root controller.The table which stores the supplier details does not have a dff.so i have to store a yes or no value and a foreign key ref into a custom table to map both the tables. the rootAM is actually calling the underlying seededVO to create a row in the database.Now how can I insert the yes/no and the foreign key values into my custom table??
    Thanks.

    Isn't there any other column in the table which you can use?
    Anyway you can call a PLSQL API (to create a row in the Custom Table and store the value and also to make a foreign key join therein). This PLSQL can be called from the Controller (extend the standard Controller).
    Now when you come to the Page, either you substitute the standard VO, or easier still (since I assume checkbox is on the Page and not in the table), you can call a PLSQL function and get the value of the checkbox. May be you can also create a dymanic VO and get the value from the Custom table for the current standard table row.
    Please do a compete thinking on the idea above and do let me know where you forsee issues. The above solution focusses more on PLSQL API invocations and thus decreases the need for Substitutions.
    Thanks
    Sumit

  • What is the datatype to store the value of variable of  UTL_HTTP.resp

    Hello,
    I am using Oracle 11g R2 SOE.
    I have table Called SMS consists of two columns (TEXT , RESPONSE) to store the value of variable of type UTL_HTTP.resp
    the datatype of TEXT column is varchar2.
    What should be the datatype of the column RESPONSE that is supposed to store the value of a variable of type UTL_HTTP.resp ????
    Please see the following example if it was not clear;
    Declare
      l_url2 SMS.RESPONSE%TYPE;
      l_http_request2   UTL_HTTP.req;
      l_http_response2  UTL_HTTP.resp;
    begin
      l_http_request2  := UTL_HTTP.begin_request(l_url2);
      l_http_response2 := UTL_HTTP.get_response(l_http_request2);
      insert into SMS (text,response) values (l_url2,l_http_response2);
      UTL_HTTP.end_response(l_http_response2);
    end;Regards,
    Fateh

    Fateh wrote:
    Hello,
    I am using Oracle 11g R2 SOE.
    I have table Called SMS consists of two columns (TEXT , RESPONSE) to store the value of variable of type UTL_HTTP.resp
    the datatype of TEXT column is varchar2.
    What should be the datatype of the column RESPONSE that is supposed to store the value of a variable of type UTL_HTTP.resp ????
    Please see the following example if it was not clear;
    Declare
    l_url2 SMS.RESPONSE%TYPE;
    l_http_request2   UTL_HTTP.req;
    l_http_response2  UTL_HTTP.resp;
    begin
    l_http_request2  := UTL_HTTP.begin_request(l_url2);
    l_http_response2 := UTL_HTTP.get_response(l_http_request2);
    insert into SMS (text,response) values (l_url2,l_http_response2);
    UTL_HTTP.end_response(l_http_response2);
    end;Regards,
    Fatehutl_http.resp is a record type Its defined like this
    TYPE resp IS RECORD (
       status_code    PLS_INTEGER,
       reason_phrase  VARCHAR2(256),
       http_version   VARCHAR2(64));http://docs.oracle.com/cd/B19306_01/appdev.102/b14258/u_http.htm#i1012713
    I would suggest in your table you split the RESPONSE column into 3 different column and store the fields STATUS_CODE, REASON_PHARSE and HTTP_VERSION accordingly.

  • Downloading a file from Database [Blob field]

    I am trying to write an application which can upload and download files [Excel, Word etc.] to/from an Oracle 9i database Blob field. I am using Java/JSP for the same.
    The upload part works just fine. However, when I try to download the file that I uploaded, I get an error.
    A dialog box comes up asking me to Open/Save the file. However, when I try to save it, it says
    �Internet Explorer cannot download �..tion=download&planId= testplan from localhost
    Internet Explorer was not able to open this Internet Site. The requested site is either unavailable or cannot be found. Please try again later.�
    I am using IE 6.0. I tested the same with Firefox browser and was able to download the file.
    Can anyone help?
    Code:
    Following is the code I am using for the same.
    /* Code to retrieve from Blob field */
    String sqlString = "SELECT PLAN_DOCUMENT_NAME,PLAN_DOCUMENT FROM BRS_PLAN_DESCRIPTION WHERE PLAN_ID = ?";
    ps = con.prepareStatement(sqlString);
    ps.setString (1,planId);
    rs = ps.executeQuery();
    while (rs.next()) {
         fileBytes = rs.getBytes("PLAN_DOCUMENT");
         fileName = rs.getString("PLAN_DOCUMENT_NAME");
    brsPlanDocument.setPlanId(planId);
    brsPlanDocument.setFileName(fileName);
    brsPlanDocument.setFileBytes(fileBytes);
    /* Code for download */
    String fileName = brsPlanDocument.getFileName();
    String fileType = fileName.substring(fileName.indexOf(".")+1,fileName.length());
    if (fileType.trim().equalsIgnoreCase("txt"))
         response.setContentType( "text/plain" );
    else if (fileType.trim().equalsIgnoreCase("doc"))
         response.setContentType( "application/msword" );
    else if (fileType.trim().equalsIgnoreCase("xls"))
         response.setContentType( "application/vnd.ms-excel" );
    else if (fileType.trim().equalsIgnoreCase("pdf"))
         response.setContentType( "application/pdf" );
    else if (fileType.trim().equalsIgnoreCase("ppt"))
         response.setContentType( "application/ppt" );
    else
         response.setContentType( "application/octet-stream" );
    response.setHeader("Content-Disposition","attachment; filename=\""+fileName+"\"");
    response.setHeader("cache-control", "no-cache");
    byte[] fileBytes=brsPlanDocument.getFileBytes();
    ServletOutputStream outs = response.getOutputStream();
    outs.write(fileBytes);
    outs.flush();
    outs.close();

    Hi,
    is this problem solved for you, I am also writing the java code to store different files in blob fields in database(db2udb) and allow users to open them through jsp pages. Upload seems to be working fine.....My big problem is only excel files are opened properly in both IE and Firefox. Word files, image files are not getting opened. Any suggestion as what I could be doing wrong....my jsp is kind of similar to the above one...
    thanks in advace, please guide me
    long pmsId = new Long(request.getParameter("pmsId")).longValue();
    String fileName = request.getParameter("fileName");
    int fileSeq = new Integer(request.getParameter("fileSeq")).intValue();
    if(fileName.endsWith("txt")) {
    response.setContentType("text/plain");
    log.debug(" this is a text file");
    } else if(fileName.endsWith("xls")) {
    response.setContentType("application/vnd.ms-excel");
    log.debug(" this is a excel file");
    } else if(fileName.endsWith("gif")) {
    response.setContentType("image/gif");
    log.debug(" this is a image file");
    } else if(fileName.endsWith("doc")) {
    response.setContentType("application/msword");
    log.debug(" this is a doc file");
    } else if(fileName.endsWith("pdf")) {
    response.setContentType("application/pdf");
    log.debug(" this is a pdf file");
    } else if(fileName.endsWith("ppt")) {
    response.setContentType("application/ppt");
    log.debug(" this is a ppt file");
    } else {
    response.setContentType("application/everythingelse");     
    log.debug(" this is a unknown ile");
    response.setHeader("Content-Disposition", "attachment;filename="+fileName);
    OutputStream out1 = response.getOutputStream();
    Class.forName("com.ibm.db2.jcc.DB2Driver");
    db2Conn = DriverManager.getConnection("jdbc:db2:TESTDB","db2admin","db2fv1000");
    //log.debug("connection obtained");
    pstmt = db2Conn.prepareStatement(" SELECT * FROM UPLOADDOCS WHERE PMSID = ? AND DOCSEQ = ? ");
    //log.debug("statemenmt prepared");
    pstmt.setLong(1, pmsId);
    pstmt.setInt(2, fileSeq);
    rs = pstmt.executeQuery();
    int count = 0;
    if(rs.next()){
    InputStream is = rs.getBinaryStream("DOCUMENT"); //"is" is
    //now the binary data
    //of the file
    byte[] buf = new byte[4096];
    int len;
    while ((len = is.read(buf)) > 0)
         out1.write(buf, 0, len);
    out1.close();
    out1.flush();

Maybe you are looking for

  • PS Elements 6.0, Vista: Moving Files

    I need to move my massive set of files off of my computer and onto an external drive (I need the space on my computer hard drive for work). I have all the files backed up already on a third hard drive. Here is the problem. 1) In order to not lose the

  • How to make OAS use SSL

    I'm trying to install SSL under OAS 3.0.0. There's a note in a documentation, that I can generate a request for CA by <b>genreq</b> utility. I can't find it. Where's it placed and does it exist at all? Can i use request generators from other web serv

  • Photo count on itunes library won't go down HELP?!

    Whenever I sync my phone, the photo count won't change. It's keeps showing I have 764 when I only have 615 in my camera roll and I don't have any photos synced from my iPhoto onto my phone either. I have no idea how to fix it or what is going on.

  • Selecting Randoms from Query of Queries

    I can create a query that selects random records <cfquery....> select top 10 * from table order by newid() <!--- SQL Server ---> </cfquery> or <cfquery....> select top 10 * from table order by rand() limit 10 <!--- MySQL---> </cfquery> However, is th

  • PRE 9.0 or 0.9 take 2

    I posted this message some days ago, but I cannot find it anymore, so here is a second attempt. I recently bought PSE-9 and PRE-9. PSE is ok, but PRE gives me headaches. After two weeks of struggling two major problems stand out (apart from turtle sl