Constraints on variables or types?

Anyone know the preferred method that Oracle uses to place constraints on variables or types?
For example, say I have a global variable in a package called v_MyValidTypes NUMBER but the only valid values are the numbers 1-9. Can I declare a type and place a constraint on that type or can I just place a constraint on a variable?

You want the RANGE predicate:
<pre>
DECLARE
SUBTYPE single_digit IS PLS_INTEGER RANGE 1..9;
x single_digit;
BEGIN
x := 7;
x := 77;
END;
</pre>
Scott

Similar Messages

  • How to get values from a stored package variable of type record ?

    Sir,
    In my JClient form, I need to get values from a database stored package variable of type record. And the values are retained in the JClient form for the whole session. The values are copied only once when the form is started.
    What is the best way to do that ?
    Thanks
    Stephen

    Stephen,
    not sure what your model is, but if it is Business Components, I think I would expose the properties as a client method on the application module. This way all JClient panels and frames will have access to it. You could use a HashMap to store the data in teh app module.
    If JDBC supports the record type, then you should be able to call it via a prepared SQL statement. If not, you may consider writing a PLSQL accessor to your stored procedure that returns something that can be handled.
    Steve Muench provides the following examples on his blog page
    http://otn.oracle.com/products/jdev/tips/muench/stprocnondbblock/PassUserEnteredValuesToStoredProc.zip
    http://otn.oracle.com/products/jdev/tips/muench/multilevelstproc/MultilevelStoredProcExample.zip
    Frank

  • Store a double into a variable of type int

    if I have a calculated value of type "double", and I would like to store it as an "int" in a variable of type "int".
    when i casted the double to int, seems it doesn't work.
    what should the command be?
    Thanks in advance!

    post your expression. I'd bet you aren't casting the value of assignment but rather a component of some computation.
    Something like this:
    double dub = 2.4;
    int returnvalue = (int)12/dub;as opposed to
    double dub=2.4;
    int returnvalue = (int)(12/dub);In the first entry, you would be casting 12 to an int and then dividing by a double and assigning the result to an int (returnvalue). Java will always try to expand precision to greatest common denominator, so the return value of the division will be a double (and hence the loss of precision assigning it to an int). The second entry properly casts the result of the whole expression as an int before assigning it to the int variable.

  • Mapping proc output to vars gets error extracting result into a variable of type (DBTYPE_UI2)

    Hi, we run std 2012.  I have a proc (sets nocount on) whose params r shown in the first block .   My execute ssis sql task mapping is shown in the block following that (same order as shown, the param sizes are all -1).  The variable
    characteristics and initial values are shown in the 3rd block.  The execute sql task command is
    exec usp_fileArrivalStatus ?,?,?,?,?,? output,? output,? output
    when I run the proc in ssms followed by a select on the output fields, I get stat 0, instance id -1 and file name empty string (aka tick tick aka '')
    The error is:
    [Execute SQL Task] Error: Executing the query "exec usp_fileArrivalStatus ?,?,?,?,?,? output,? ou..." failed with the following error:
    "An error occurred while extracting the result into a variable of type (DBTYPE_UI2)".
    Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
    Does anybody know what is wrong?
    CREATE PROCEDURE [dbo].[usp_fileArrivalStatus] @NewFilePattern varchar(500),
    @PkgName varchar (257),
    @appid int,
    @MsgHistCreateDate date,
    @messageFriendlyName varchar(500),
    @arrivalStatus int output,
    @instanceId bigint output,
    @fileName varchar(500) output
    VariableName Direction DataType ParamName
    User::TranFilePattern Input VARCHAR 0
    System::PackageName Input VARCHAR 1
    User::AppID Input SHORT 2
    User::todaysDate Input DATE 3
    User::TranFileArriveStatus OUTPUT SHORT 5
    User::TranFileInstanceId OUTPUT LARGE_INTEGER 6
    User::TranFileName OUTPUT VARCHAR 7
    User::TranFileFriendlyName Input VARCHAR 4
    User::TranFilePattern,string,tranfile05-Nov-2014
    User::fileDate,string,05-Nov-2014
    System::PackageName,
    User::AppID,int32,12
    User::todaysDate,DateTime, set by select getdate()
    User::TranFileArriveStatus,int32,0
    User::TranFileInstanceId,Int64,0
    User::TranFileName,string
    User::TranFileFriendlyName,string,Tran File

    I may have gotten past this.  The ui showed the first execution of that proc as the aborting component but when I looked at my error code (-1073548784), and component name in the
    message sent with notification email, I noticed the second component name.  It too executes that proc and still had ushort for appid in sql task mapping and long for instance id.  I changed these characteristics to match what I posted and got green
    on the seq container that runs both.
    I think I go thru this kind of adventure every time I try to map proc output to ssis vars.   

  • Why assigning a subclass instance to a variable of type of superclass ?

    Hi all,
    What is the significance of assigning an instance of a subclass to a variable whose type is a superclass's type.
    For eg. List list=new ArrayList();
    If I do so is it possible to execute the methods of the subclass ?
    regards
    Anto Paul.

    In addition, this is what polymorphism is all about:
    abstract class Animal {
      String name;
      Animal(String name) {
        this.name = name;
      public abstract void voice();
    class Dog extends Animal {
      Dog(String name) { super(name); }
      public void voice() {
        System.out.println(name+" barks");
    class Cat extends Animal {
      Cat(String name) { super(name); }
      public void voice() {
        System.out.println(name+" miaows");
    public class Polymorphism {
      public static void main(String args[]) {
        Animal[] animals = {
          new Dog("Fido"),
          new Cat("Felix")
        for (int i = 0; i < animals.length; i++) {
          animals.voice();
    Here, we are looping through an array of Animals. In fact, these are concrete subclasses of the abstract Animal class. In this simple example, you can see from the code that the animals array contains a dog and a cat. But we could even extend this to read in an arbitrary Animal object that had been serialized into a file. At compile time, the exact class of the serialized animal would not be known. But polymorphism occurs at runtime to ensure the correct voice() method is called.
    For the List, or Map example, conisder this:
    public SomeClass {
      public HashMap map1 = new HashMap();  // this ties you to hashmap
      public Map map2 = new HashMap();      // this allows you to change Map implementation
      public void process(HashMap map) {}   // this ties you to hashmap
      public void process(Map map) {}       // this allows you to change Map implementation
    }Suppose you use a HashMap for map2 to start with. But at some point in the future you would like to ensure your map is sorted. By specifying map2 to be a Map, you can change the implementation without having to modify each method call by simplying changing the initiliastion to be:
    Map map2 = new TreeMap();Hope some of this helps :) Cheers, Neil

  • How can I assign a hard coded value to a variable of type OBJECT.

    Hi,
       I have to call the following method
                                      lc_action_execute->get_ref_object(
                                                            exporting
                                                                  io_appl_object = io_appl_object
                                                            importing
                                                                   ev_guid_ref    = lv_guid_ref.
    Now I have to hard code the io_appl_object variable (of type OBJECT) to test my application for the time being. How can I assign a value to the variable? Is there any way to do that?

    I wouldn't use WDR_CONTEXT_ATTR_VALUE_LISTGEN.  Use wdr_context_attr_value_list instead:
    data l_topics type zpm_main_topic_tbl.
      l_topics = wd_assist->read_all_topics( ).
      data lt_valueset type wdr_context_attr_value_list.
      field-symbols <wa_topic> like line of l_topics.
      field-symbols <wa_vs>  like line of lt_valueset.
      loop at l_topics assigning <wa_topic>.
        append initial line to lt_valueset assigning <wa_vs>.
        <wa_vs>-value = <wa_topic>-main_topic.
        <wa_vs>-text  = <wa_topic>-main_topic_desc.
      endloop.
      data lo_nd_meeting type ref to if_wd_context_node.
    * navigate from <CONTEXT> to <MEETING> via lead selection
      lo_nd_meeting = wd_context->get_child_node( name = wd_this->wdctx_meeting ).
      data lo_node_info type ref to if_wd_context_node_info.
      lo_node_info = lo_nd_meeting->get_node_info( ).
      lo_node_info->set_attribute_value_set(
         name = 'MAIN_TOPIC'
         value_set = lt_valueset ).

  • Japanese characters alone are not passing correctly (passing like ??? or some unreadable characters) to Adobe application when we create input variable as XML data type. The same solution works fine if we change input variable data type to document type a

    Dear Team,
    Japanese characters alone are not passing correctly (passing like ??? or some unreadable characters) to Adobe application when we create input variable as XML data type. The same solution works fine if we change input variable data type to document type. Could you please do needful. Thank you

    Hello,
    most recent patches for IGS and kernel installed. Now it works.

  • Authorization check without using variable of type u0093Authorizationu0094

    In WEB-reporting we want to authorize on a navigational attribute without using the variable of type
    “ Authorization”. Why would we do this?
    1. In a lot of queries we have to replace the existing variable of type “User entry” to a variable of type “Authorization”. We would like to avoid this work.
    2. When the variable is not ready for input the Report will always include all the characteristic values for which the user is authorized. We don’s want this.
    3. When the variable is ready for input on the selection screen all the authorized values are displayed and the user is able to select / deselect the values he/she wants to report. In case of a lot of authorized characteristic values the screen does not appear user-friendly.
    What we want is a behavior like some parts of R/3. For example: Controlling Area X consists of the Costcenters C1000, C2000, C3000, C4000, C5000 and C6000. A particular user has authorization for Cost centers C1000, C3000 and C5000. When running a ABAP-report with Cosctcenters the user is able to select certain Costcenters. Three possibilities:
    1. The user selects Costcenter C1000, C3000 and / or C5000: the ABAP reports the selected Costcenters.
    2. The user selects Costcenter C2000, C4000 and / or C6000: the ABAP gives an error-message: “no authorization”.
    3. The user does not select any Costcenters: the ABAP reads all the Costcenters and reports – on the basis of the users authorization – only Costcenters C1000, C3000 and C5000.
    In term of BW: we would like to introduce authorizations for a specific InfoObject which is used as an navigational of an other InfoObject. In the queries a variable is used of the type “User entry”. The user can select one or more values on the selection screen; an authorization check is fulfilled. He may – however – choose to leave the selection field empty; in this case the OLAP processor should report only the authorized values (in our case the last situation results directly in an error-message “no authorization”).
    Anyone has a suggestion?
    Thx in advance,
    Henk

    If you change the variable to type exit, and user input enabled, you can then build your logic in the user exit.
    If users have entered unauthorised values, it will be checked (by the system??). If this assumption is correct then all you need to do in your exit is to continue with the values entered by the user; and in case user has entered no values, populate the variable with values valid for the user (by reading the user authorization and corresponding charactertistics values and moving these to the variable).
    --> Adding further
    Since the authorization will not be checked by the system (I missed that these are not of authorization type variables), user exit will need to do this check. The logic for doing authorization checks / error messages / restricting based on authorizations - will have to be done in the user-exit.
    cheers,
    Message was edited by: Ajay Das

  • Newbie how to define variable of type element?

    JDEV 10.1.3.1
    When I perform the following from BPEL designer in JDEV...
    variable new
    create variable
    Select element type
    Select a local file schema xsd
    Select element of choice
    Seems to define OK but fails to compile. Namespaces appear to include the namespace defined in the xsd.
    When I define variables of type message and browse to the appropriate wsdl and pick a message from there this seems to work / compile just fine.
    I am sure that since I am just getting started that this is a common error, please assist and thanks. Must all variables be defined as message types and reside in a WSDL?
    Thanks,
    John

    Hello John,
    I'm not sure whether it is possible to import a schema into a process directly. What I usually do is to import it into the wsdl-file describing the process interface. This is the file you use to define the client-partnerlink. If your schema is imported correctly, you can access the type-definition via the partner-links-node in the type chooser (this works at least in JDEV 10.1.3.3 and 10.1.3.4).
    To import your schema into the wsdl, you need to go to the structure-view in wsdl-editor and after a right-click on the types-node select "insert types". Inside types you insert XML-Schema, inside schema you need to insert an import-tag. The properties for this tag are the file-location and the target namespace used in the schema. The resulting XML-structure should look like this:
    <wsdl:definitions xmlns:plnk="http://schemas.xmlsoap.org/ws/2003/05/partner-link/" xmlns:tns="http://xmlns.oracle.com/Order_Booking___Shipment" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="Order_Processing_SystemPLT" targetNamespace="http://xmlns.oracle.com/Order_Booking___Shipment">
    <wsdl:types>
    <schema xmlns="http://www.w3.org/2001/XMLSchema">
    <import schemaLocation="Order_Booking___Shipment.xsd"
    namespace="http://xmlns.oracle.com/Order_Booking___Shipment"/>
    </schema>
    </wsdl:types>
    </wsdl:definitions>
    Greetings,
    Christoph

  • Modifying variables of type XML at runtime.

    Greetings,
    Here is the situation I am facing. A workflow is triggered by an incoming XML
    event. After some processing, a portion of the xml document that triggered the
    event must be modified and the newly modified document is then dumped onto a JMS
    queue.
    For the life of me, I cannot figure out how to modify part of the xml message
    once I have it in a variable of type xml. Any suggestions?
    Thanks in advance,
    -Matt

    ok I think I need the cast as out.println does not support printing of an object.
    Im sorry if it seems like a stupid question, using the reflection API is the most advanced thing I have done so far and this is my first year of work, I do find some of the concepts confusing.

  • Calculating with formula variables of type user exit

    I created the following query:
    Rows: Characteristic = Employee
    Column: KYF = Status
    Filter: Year, Month
    The KYF ist a formula containing a formula variable. This variable of type user exit should return a value recording to the value of employee and has to be read in a customizing (data-) table by the user exit.
    Is it possible to read the values of employee row by row from the internal table which contains the amount of data before processing to output screen and fill the 'Status'-KYF or should I create a virtual keyfigure for this case.
    Thanks for all your feedback,
    Angelika

    Hi,
    It seems like Status is master data of Employee.
    As per your process, if you do either formula variable or virtual keyfigure you will face query performance problem. More over you cant simply access record by record characteristic value in formula variable. It will be another complex process like you have to call the characteristic value via replacement path.
    You have the following choices:
    You mentioned master data is availabe in custom table. Try to pull the custom table master data into employee info object. Maintain  status as one of the attribute of the master data. Then you can display Status value simply in the report. This will be global access like you use this Status value n number of info providers which is having Employee as one of the info object in the info provider.
    If the previous way is not possible, include the Status in the info provider level and write a simple update routine to populate the values. This will be info provider level.
    I am not sure whether you are in development environment or productive. If developement, then you can choose simply any one of the above ways.
    Regards,
    Vivek

  • MDO Query errors in log -[Cannot fetch column 22, which has JDBC type DOUBLE, into a Java variable of type ]

    Hello,
    We are seeing a lot of log messages like the one below when an MDO select query is run. There is a message for every numeric column. There doesnt seem to be any issue with the queries working properly its just creating a lot of log messages. Has anyone else had this issue?
    Exception of type com.sap.sql.log.OpenSQLException caught:
    Cannot fetch column 22, which has JDBC type DOUBLE, into a Java variable of type
    float..
    [EXCEPTION]
    com.sap.sql.log.OpenSQLException: Cannot fetch
    column 22, which has JDBC type DOUBLE, into a Java variable of type float.
    at com.sap.sql.log.Syslog.createAndLogOpenSQLException(Syslog.java:83) ...

    Hi Christian,
    You are right. As in your case it is a select query it does not reflect the error automatically. In my case, I had an insert query so it failed then and there, which was easier to debug and fix.
    I have one question regarding your case. When you read the MDO using the query, what do you do with the output? Do you assign it to any local/transaction property in the output links of the query block or in a proceeding assignment block?
    Because, the error mentions that the assignment of float to double datatype fails. So, in theory there should be some assignment done with the output.
    Please check if you could figure out this part in your transaction.
    Regards,
    Saumya Govil

  • Variables & Processing Types

    Hi,
    I am looking for variables & Processing types.Could any one guide me on Variables & Processing types in BI 7.0.
    Thanks in advance!
    Regards,
    Vijji

    Hi Vijji,
    We have five types of variables in BI 7.0
    1) Characteristic value variables
    2) Text Variables
    3) Hierarchy variables
    4) Hierarchy node variables
    5) Formula variables
    we can pass the values to this variables using 5 processing types
    1) Manual Entry/ Default value
    2) Replacement path
    3) Authorizations
    4) Customer exits
    5) SAP Exit
    In the below link you can check which process type is varilable for which variable.
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/579b3c494d8e15e10000000a114084/frameset.htm
    Regards,
    Venkatesh

  • Good practice to initalize all instance variables with type String to emptr

    Is it a good practice to initalize all instance variables with
    type String to emptry string?
    #1 approach:
    public class A
    { private String name = "";
    private String address ="";
    //etc...
    rather than
    #2 approach:
    public class A
    { private String name;
    private String address;
    //etc...
    When I read Java books, the examples don't usually do #1 approach.
    The problem is if we don't initialize to empty string, when we call
    the getter method of that instance variable, it will return null.
    Please advise. Thanks!!

    Please advise. Thanks!!It depends on your coding style. If you can avoid lots of checks for null Strings in the rest of the code then why not initialize to "".
    You have the same situation when a method returns an array. If you under circumstances return a null array reference then you have to always check for this special case, but if you return a zero length array instead you have no special case. All loops will just run 0 iterations and everything will work fine.
    So in general I guess the return of zero objects instead of null references really boils down to whether it simplicates the rest of your code by removing lots of extra checks for the special null case. This usage is especially favourable in the zero length array case. See Effective Java by Bloch, item 27.

  • Log the local variables (string type) to the database (SQL Server)

    i have a customized PreUUT callback so that my own VI gets the information from barcode. it contains serial number as well as other information. i am collecting the information into local variables of the PreUUT callback.
    Now i want to log the local variables (string type) to the database (SQL Server).
    i have a successful connection to the database and i am using a generic recordset schema.
    can anyone help me how to do it?
    also shall i have to create the corrosponding fields (columns) in the database? or is there any option in TestStand4.0 to do it?

    Hello i like original,
    After re-reading your original message, I think I might have a better understanding of what you would like to do.  I have included a few links to Knowledge Base and Developer Zone articles that should be very useful for you.  I have included these links below:
    Logging a New UUT Property to a Database in TestStand
    Logging a New Step Property to a Database in TestStand
    Creating a TestStand Database Schema from Scratch
    Thanks,
    Jonathan C
    Staff Application Engineering Specialist | CTD | CLA
    National Instruments

Maybe you are looking for

  • HTTPS from JDK1.2.1 to JDK 1.4.1

    We are trying to connect application running on JDK1.2.1 to application in JDK 1.4.1. Both applications are in Oracle 9ias application server but with different JDK and different physical machines. We are getting following error while trying to acces

  • How do I set up a new user account that can use all my software?

    I set up a new user account on my 3 year old BTO iMac running OS 10.8.5. Unfortunately, when I tried to use it, the computer thought none of my software was registered, activated, licensed, etc. With 26 GB of applications on this machine, it will be

  • How can I transfer songs from two different itunes?

    I want to transfer songs from my brother's itunes library to my shuffle, but when I plug it in his computer, a message saying that his library is not linked to my library (or something to that extent) and whether I would like to replace the songs. If

  • Uploading classical music (large files)

    Hi everyone. I'm having trouble uploading classical music from my MacBook to the iphone via itunes. Uploads all contemporary music, but won't bring the larger classical music files across. I can see the classical music albums in my itunes playlists a

  • Credit card maintenance - performance

    The function CCARD_BP_SELECT is running a bad query and takes a long time for us to batch update customer card info. A trace reveals that this function is doing a full table scan for each card - I believe we are using the parameters correctly: - KUNN