Representing booleans in Databases

I have a question about how a boolean attribute should be represented in a database table. I have found that a value of false is equal to 0 and a value of true is equal to 1, so therefore, it is my contention that the corresponding column in the database table should be defined as a number rather than CHAR(1). For example, if I have an Employee class with a boolean attribute named isActive, I feel that the isActive column in the database should be defined as a Decimal(1,0) instead of a CHAR(1) to avoid having to write needless data conversion code. Anyway, before I try to defend my position to our Data Analysts, I wanted to get a feel for what the industry thinks on this issue. If you have any opinions, references, or documentation on this subject, I would greatly appreciate it. I would really like to have some good solid information on how this should be done. Thank you very much for your help.

I might nit-pick a little and say that the value true was first, and is most commonly represented by a bit being turned on, and the value false was first and is most commonly represented by the bit being turned off.
I honestly don't know how the various programming languages actually store this on/off information, it may be as bits, or int's. I would doubt there are any implementations that would store on/off using a fixed or variable character string.
Many databases actually include a boolean data type, so for those databases this question is moot. For those that don't, I would suggest that you should consider a couple of issues when making your decision.
1) The efficiency of storage in the database. For example when using varchar2 in Oracle there is overhead to hold the variable string size information. I have seen some people store the words 'false' and 'true' for boolean use (because it's an easy transformation in Java). But it's a poor choice from a database perspective. Overall storage is probably the #1 concern that will be expressed when using your scheme on a large database.
2) The efficiency of retrieving from the database. Really an issue with the count and access frequency of the boolean values. This can be very hard to discern without having intimate knowledge of the database engine, and the application. So while it is a consideration, you may have to dig some to get the information you need.
3) Be consistent. Often times people will do something quite different for a small, or throw away application, then they would for a large terabyte implementation. Not being consistent can waste hours of programming and user time trying to figure something out based on incorrect assumptions. I can't say this strongly enough.
4) Whatever you choose, make sure that it works with all databases that you currently use, or that you might use in the future. Again, you want to be consistent across all databases. If there is a cool way to do this in Informix but it doesn't work in Oracle, then skip it and find something that works well in both. I would make sure it works at least with Oracle, Informix, DB2, DB2/UDB and SQL Server.
Just some thoughts on the topic. Sorry I don't have a specific requirement that I can hand you. Good luck in your discussions.
Joel

Similar Messages

  • Boolean in databases

    Can ayone tell me what's the easiest way to store 'boolean' values into a
    database?
    Most of the database types described in the data conversion tables of
    chapter 4 of "Accessing Databases" can only be selected into or inserted
    from a boolean value, but not both!
    TIA.
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

    Can ayone tell me what's the easiest way to store 'boolean' values into a
    database?convert the boolean value to an integer value an write it as
    a smallint (e.g.
    for ODBC) into the database.
    smallint is only 16 bit but you don't get a problem with the
    integerdata type
    because it's range is between 0 and 1
    e.g.
    convertBooleanToInteger(BooleanValue:boolean) : integer
    If BooleanValue then
    return(1);
    else
    return(0);
    end if;
    and
    convertIntegerToBoolean(IntegerValue:integer) : boolean
    If IntegerValue = 1 then
    return(TRUE);
    else
    return(FALSE);
    end if;There should be no need to convert it between an integer and a boolean.
    We read/write the boolean directly from/to the database. The database
    side is SMALLINT DEFAULT 0 NOT NULL and the forte attribute is boolean.
    Forte handles the conversion.
    Cheers
    David
    Lumley Technology
    ++61 9248 1356
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

  • Pros and Cons - Representation of boolean attributes

    A coworker and I are discussing the different ways to represent boolean attributes in a new schema.
    So far, there are three options we came up with and were wondering what the pros, cons, and opinions were. There are many attributes that work like the following examples:
    Addresses - A person may have multiple addresses
    Shipping Address - One and only one address is the shipping address for a person
    1) shipping is a boolean attrbiute of the Addresses table represented by a char(3) datatype than can be "yes" and "no"
    2) A seperate shipping address table contains a primary key made up of the primary key from the People table and the primary key from the Addresses table.
    3) One intermediate table is made for all the boolean value associated with the address entity, creating a many to many relationship between Addresses and "boolean attributes".
    I prefer 1, he prefers 2 and suggested 3.
    I like 1, because
    It enforces the relationship that a person can only have one shipping address, since the key is composed of a person and an address, and is unique.
    It is also easy to add too or drop when clients change their minds as much as they do. I can also associate extra data with it if the users decide to start asking for more (they often do)
    I dislike 2, because I have to actually compare text to get a boolean value. It also leaves room for people to make typos or put something besides yes or no. I don't mind 2 of an entity happens to have bunches of boolean attributes as I don't want to create 25 seperate tables...I guees it depends on what the data is.
    We've got attributes that work like this all over the place. Shipping addresses, billing addresses, primary phone number, primary email address. Courses that are 'advanced" courses, active vs non active, etc.
    I see his argument for long queries or too many tables, if an entity has many boolean attributes and I start making tables for all of them, but when there are 1-4 I think it makes more sense to make a seperate table for groupings of things. I see it more as a subset than an attribute...Give me all the addresses that are shipping addresses or give me all the courses that are not in the active course table.
    What are your thoughts?
    Edited by: brekehan on Apr 16, 2010 11:12 AM

    user12999515 wrote:
    This is the coworker trying to clarify the question. There is a distinct possibility that an entity represented in a database may have Boolean attributes. So the question is what is the best way to represent them. The first answer is to make them a column of a table. But let's think about it. What if we are going to search by these attributes.
    A solution is to have a separate table for each Boolean attribute pointing to the primary key of the addresses table. In this case shipping address and billing address.Sure you could do that, but then you introduce a few complexities, and i'm not sure i see where the tangible benefit is. With the example provided by your colleague you would have.
    Entity = address (pk_value, <other_columns>)
         where pk_value = person_id, some incremented ID for address
    Entity = shipping address (pk_value)
         where pk_value = person_idSo this takes care of the business rule that a person can have at most 1 shipping address (that's good), but when you want to know ALL the address information for a given person on file you need to query
    select
       a.*,
       case when sa.person_id is null then 'NO' else 'YES' end as shipping_address
    from addresses a, shipping_address sa
    where a.person_id = :person_id
    and a.person_id = sa.person_id (+)As opposed to
    Entity = address (pk_value, shipping_address, <other_columns>)
         where pk_value = person_id, some incremented ID for address
         shipping_address = 0 or 1
         with a check constraint on shipping_address ( in (0,1) )
         with a unique index to enforce the rule that a person can have at most one shipping address .. which would look something like
    drop table addresses;
    create table addresses
         person_id number,
         address_id number,
         shipping_address     number(1),
         constraint addresses_pk primary key (person_id, address_id),
         constraint addresses_c1 check (shipping_address in (0,1))
    create unique index addresses_u01 on addresses (case when shipping_address = 1 then person_id else null end);
    --shows the unique index enforcing the business rule that 1person can have at most 1 shipping address
    insert into addresses values (1, 1, 0);
    insert into addresses values (1, 2, 0);
    insert into addresses values (1, 3, 1);
    --take a break, add someone else's info
    insert into addresses values (2, 2, 0);
    insert into addresses values (2, 3, 1);
    --back to person 1, add another shipping address (which will raise an error because of our index)
    insert into addresses values (1, 4, 1);And when querying this table we have a simple
    select
       a.*
    from addresses a
    where a.person_id = :person_id
    --if you need to, decode(shipping_address, 0, 'NO', 'YES')When you start getting into adding tables to represent a 1 – 1 relationship, you're really adding overhead. In this case, instead of adding a single column (with a number(1) datatype) you'll be adding a table with a number(x) where x is the length of your person_id. So the storage goes up (i won't argue this is a big deal as we're in the year 2010 :) however when you need to query you now have 2 tables to grab data from which means more IO (you have data blocks for the address table, and data blocks for the shipping_address table).
    Unless you have a situation like the following
    http://www.oracle.com/technology/oramag/oracle/09-mar/o29asktom.html “Wide Load Storage” i would recommend staying away from modelling 1 – 1 relationships.

  • Passing of BOOLEAN parameters to PL/SQL stored procedures

    Hi ,
    How i can pass BOOLEAN parameter to store Procedure or do i need to pass it as Integer?
    waiting for quick reply
    Thanks in advance ,
    Pramod

    Disclaimer: I work for the company that makes the product mentioned below.
    Procedures that take boolean parameters can be called using JDBC without having to modify them or write additional 'wrapper' procedures. The secret is to write an anonymous block that accepts a numeric parameter and sets a boolean PL/SQL variable with it before calling the procedure.
    [url http://www.orindasoft.com/]OrindaBuild is a utilty made by my employer that does this along with a bunch of other stuff. If you open
    [url http://www.orindasoft.com/public/Java2HTML/com/orindasoft/demo/generated/plsql/simpleExamplesDirectFlightAvailable.java.html]this URL and scroll to the bottom you'll see an example of this technique in use for a BOOLEAN OUT parameter. The relevent code is:
    public String getProcCallStatement()                                            
    236    {                                                             
    237    return("DECLARE \n"
    238          +"/* Generated By OrindaBuild 4.0.1919 */ \n"
    239          +"/* Which can be obtained at www.orindasoft.com */ \n"
    240          +"p_fromcity VARCHAR2(32767) := ?; \n"
    241          +"p_tocity VARCHAR2(32767) := ?; \n"
    242          +"p_direct BOOLEAN := null; \n"
    243          +"p_direct_SN SIGNTYPE := null; \n"
    244          +"BEGIN  \n"
    245          +"SIMPLE_EXAMPLES.DIRECT_FLIGHT_AVAILABLE(p_fromcity,p_tocity,p_direct); \n"
    246          +"  \n"
    247          +"IF p_direct IS NULL THEN  \n"
    248          +"  p_direct_SN := 0;  \n"
    249          +"ELSIF p_direct = FALSE THEN  \n"
    250          +"  p_direct_SN := -1;  \n"
    251          +"ELSIF p_direct = TRUE THEN  \n"
    252          +"  p_direct_SN := 1;  \n"
    253          +"END IF;  \n"
    254          +"? := p_direct_SN; \n"
    255          +"END; ");
    256    }     'p_direct' is a boolean variable we use to capture the result of the stored procedure.
    'p_direct_SN' is a variable of SIGNTYPE, a numeric datatype that can have the values -1, 0, or 1. This makes it ideal for representing booleans. The IF statement afte the procedure call sets p_direct_SN based on the value of p_direct. The magic code is in line 254:
    ? := p_direct_sn;
    If you bind '?' as a numeric out parameter you get -1, 0 or 1 back when you run call the stored procedure.
    This technique allows you to call PL/SQL procedures that have boolean parameters without having to write additional PL/SQL code. The only drawback is that you have to work with -1,0 and 1 on the Java side.
    David Rolfe
    Orinda Software
    Dublin, Ireland
    David Rolfe
    Dublin, Ireland

  • Task Total Slack Calculated values mismatching with the values in reporting database

    Hi,
    We require 'Task Total Slack' as one of the items in a report for Project Server 2010. We're developing the reports using SSRS wherein the SQL Queries are fired on the reporting database of Project Server 2010.
    We've come across a situation wherein the total slack values from reporting database for tasks are mismatching with the values that are seen in either PWA or Project Professional for total slack field. We also could not find a consistent factor by which
    the slack is multiplied for reflecting in the database in case the Slack in days was being converted into Hours in reporting databse.
    Is there a definite way that these values are being represented in reporting database which is quite different from the way these values are seen in Project Professional? Please help resolving this issue.

    Hi Abhijit PS,
    Can you give an example of the mismatch? Also you could tell us if this is happening for all tasks and all projects. Your concern may be seen from 2 different points of view:
    Either this is indeed a bug with a slack of 2 days for example in Project Pro and 4 days in your report from the reporting DB. In this case, you should check if the projects have been published correctly and if the Reporting DB is correctly sync'ed with
    the draft DB.
    Or it could be the normal behavior and it is just a matter of finding why. For example, the durations are stored in the DB in minutes, meaning that a 1day duration might be stored as 480 if you have 8 working hours in a day (8*60).
    Hope this helps,
    Guillaume Rouyre, MBA, MVP, P-Seller |

  • Boolean representation in RFC xml

    Hello, I have problems with representing boolean values in an RFC xml call using XI towards SAP. Using 'X' as a value for true does not seem to work. The BAPI I am calling through RFC xml is BAPI_CHARACT_CREATE and I am trying to set the parameter INTERVAL_ALLOWED. Anyone have a clue? Thanks

    Hi,
    Boolean functions return as an output either string true or false. As an true value they interpret either 1 or true (not case sensitive). Rest values are interpreted as false.
    In your case RFC data type is: ATXFE with value range: 'X' for true and ' ' for false then you can solved such case with simple message mapping:
    In mapping to RFC field use: boolean function "If" that returns either 'X' or ' '.
    In mapping from RFC field use: text function "equalsS" that check "X" and returns "true".
    Regards,
    Jakub

  • How to add source database

    On source database server have 4 instances.
    I already install Oracle Audit Vault Agent on that server.
    And when I add source user on source DB, I can't found all DV role(ex. DV_ACCTMGR)
    My step is
    On Server1(Audit Vault Server)
    - Install Oracle Audit Vault Server to Server1
    - addagent on Server1 "avca add_agent -agentname HOLTUU1 -agenthost 192.0.66.87"
    On Server2(Audit Vault Agent)
    - on this server have 4 instances
    - Create OS user "oaudit", Create ORACLE_BASE, ORACLE_HOME
    - Install Oracle Audit Vault Agent
    may be I mistaked one or more step.
    please suggest me

    Hi:
    From your post, it appears you've managed to successfully install the AV Server (please specify the version - is it 10.2.3.0.0?).
    It also appears that you are trying to install an agent on another machine, but you are getting an error asking you to use another ORACLE_HOME. For 10.2.3.0.0, this error is expected if the directory you are specifying already exists. Simply unset all ORACLE-specific environment variables (ORACLE_BASE, ORACLE_HOME, TNS_ADMIN, TWO_TASK, etc.), and start the installer. When asked which directory to install into, provide a directory that does not exist. The install should proceed just fine. After the install, you should set the environment variable ORACLE_HOME to this directory.
    Regarding the DV_ACCTMGR role issue, I am assuming you are logging into the Audit Vault Server as SYS, and trying to create a user that would represent the source database. Please let me know if I am wrong. If I am right, I would recommend that you first upgrade the Audit Vault Server to the 10.2.3.2.0 patch set. You should also upgrade the agent. The 10.2.3.2.0 Administration Guide has been updated to indicate that you don't really need to create this user at all; the command 'avorcldb add_source...' will do the job for you.
    You need to know that the Audit Vault Server uses Oracle Database Vault to protect the audit data. What this means is that the SYS user on the Audit Vault Server can not create a user. When you installed the Server, you were asked to specify a user that will be granted the Database Vault Account Manager (DV_ACCTMGR) role. Only that user can create other users on the Audit Vault Server, so you need to log in as that user. If you do not know the name of that user, or you used the Basic Install option (not Advanced Install), you can query the ALL_USERS table for a list. Typically, in Basic Install, the DV_ACCTMGR role is given to a user with the name <avadmin>dva, where <avadmin> is the user name you picked for the Audit Vault Administrator, and his password is the same as that of the Audit Vault Administrator's.
    Hope this helps.

  • Why does DataOutputStream write Boolean as 1 Byte?

    Im trying to conserve space in a file storing booleans.
    why does dataoutputstream write booleans as a byte?
    is there a way to write a bit only?
    thanks!

    Hi,
    A boolean does even allocate at least 8 bits when it is declared in the code.
    From the VM spec:
    "3.2.4 There Is No boolean Type
    Although Java defines a boolean type, the Java Virtual Machine does not
    have instructions dedicated to operations on boolean values. Instead, a
    Java expression that operates on boolean values is compiled to use the int
    data type to represent boolean variables.
    Although the Java Virtual Machine has support for the creation of arrays of
    type boolean (see the description of the newarray instruction), it does not
    have dedicated support for accessing and modifying elements of boolean
    arrays. Arrays of type boolean are accessed and modified using the byte
    array instructions.1
    For more information on the treatment of boolean values in the Java Virtual
    Machine, see Chapter 7, "Compiling for the Java Virtual Machine.""http://java.sun.com/docs/books/vmspec/html/Overview.doc.html#22909
    /Kaj

  • Boolean return value & security aspect

    Again in the JCOP specification I read these lines:
    In case the Java Card API method returns the boolean value, it should be immediately transferred to a short representation. Now I am having this part of the code:
    boolean status = false;
              status = pin.check(buffer, (short) OFFSET_CDATA, (byte) lc);
              crypto.updateCIAPinByP2(p2, pin);
              if (!status) {
                   ISOException.throwIt((short) (ISO7816Ext.SW_PIN_INCORRECT_TRIES_LEFT | pin
                             .getTriesRemaining()));
              }Is this optimal regarding to the lines at the beginning of the post. Do I need to do this:
              boolean ret = pin.check(buffer, (short) OFFSET_CDATA, (byte) lc);
              short status = ret ? (short) 0xA5A5; (short) 0x5A5A
              crypto.updateCIAPinByP2(p2, pin);
              if (status == (short) 0x5A5A) {
                   ISOException.throwIt((short) (ISO7816Ext.SW_PIN_INCORRECT_TRIES_LEFT | pin
                             .getTriesRemaining()));
              }Also, the specification says that to ensure the security of the system, variables of type Boolean should not be used for storing security relevant data. Instead a short value should be used and a constant for True and a constant for the False. Should be defined and used. It is also said that these short values, representing Boolean values, shall be checked for the integrity in any kind of branching which would have an impact on security function. My question why is that so? Regarding to this text, do I need to modify anything in the first code because the returned variable is the local which value is stored in RAM?

    In the code from the first post, in order to have the most secure code, I believe that I need to implement double check of PIN value:
    public static final short TRUE = (short) 0xA5A5;
    public static final short FALSE = (short) 0x5A5A;
    status = pin.check(buffer, (short) dataOffset, (byte) lc) == true ? IASECCUtil.TRUE : IASECCUtil.FALSE;
    if(status == IASECCUtil.TRUE) {
         status = pin.check(buffer, (short) dataOffset, (byte) lc) == true ? IASECCUtil.TRUE : IASECCUtil.FALSE;
    }In this example, if at the first line, the result of the method check() is false but the fault occurs on the bus (transient fault) between the RAM and CPU register, then the program flow will be able to reach the second line that contains the check. The double check will not be affected by a second fault because the time to charge the laser is much larger. Is this correct?

  • Designing a well defined database access javabean

    Hi All
    Can you please help me with the basic layout of how
    a well defined javabean accessing the database should look like?
    thread safe too..
    It should have the following basc methods
    JavaClass get(String id)
    JavaClass[] getAll()
    void save ()
    void delete()hope that gives you an idea

    Hi Jos
    Lets say we have a bussiness class named Car then basically the Car class would
    be represented in the database as
    carId
    carName
    carModel etc..
    I Know how to get this data into a javabean but i do not know if it is correct
    Example
    public class Car
          private Connection conn
          private String carID
          private String carName
          private String carModel
          /* getters and setters .....*/
          public Car get(String id) throws Exception {
                String sql = "SELECT * FROM Car WHERE carID = " + this.carID;
          //and so forth with deleting a car saving it etc...What i would like to know is what is a good standard of coding such a class to be thread safe
    and use minimal resources?
    the parameter would be in this as it would be the current class used by lots of clients
    Edited by: -epoch- on Oct 28, 2008 5:33 AM

  • ER - Database related facilities in Database Diagrams (procedures/objects)?

    I am having a look at JDeveloper 11g Preview (11.1.1.0.0).
    Our environment is (still) very much a relational environment using Oracle Forms/Reports (and Designer for analysis/design, not generation).
    I am pleased to note, that materialized views can be "copied online" from a database, which was not possible in JDeveloper 10. But materialized views cannot be represented on a database diagram.
    The Database Diagram tool resembles the Server Model Diagram (SMD) tool in Designer, and it is fine when comparing the two tools. What I could have found useful in Designer, in the SMD tool or otherwise, is to be able to add database functions, procedures and packages to the database diagram.
    Also, representation of database types on the database diagram would be useful. This sort of "dropped out" in Designer :-}
    Taking this thought at step further, it would be useful to have a diagramming tool that could represent dependencies among database objects graphically.
    So, on the whole, a strengthening of the database related diagramming facilities would be appreciated.
    Regards
    Thomas Kirchhoff.

    Hi Thomas,
    Thanks for your feedback.
    In the next technology preview of 11g (TP3) you will be able to represent materialized views on the diagram.
    Unfortunately we cannot add functions, procedures and packages etc to the diagram.. But feedback from users like yourself is useful for future planning. When you talk of 'representation of database types' are you talking PL/SQL or the specific database (aag, XE...)
    What kinds of dependencies would you like to see? We have things like view usages and we are conscious of making diagrams 'too busy'. However, we do provide the diagram annotations: attachment, dependency, link and note for you to annotate your diagrams.
    rgds
    Susan

  • Wrong number or types of arguments in call to 'P_RETRIEVE_OPPTY_ORDER_STATU

    I have been strucK at a point in invoking the procedure which has a boolean parameter which when called from java program get error saying that "wrong number or types of arguments in call to 'P_RETRIEVE_OPPTY_ORDER_STATUS'". the procedure is given below along with the calling java code , and the Errors.
    If i change the parameter data type to VARCHAR2 (the parameter hilighted in red) in the in the procedure and invoke it with the same method it works fine, even if i change the "callableStatement.setBoolean(1, true); to callableStatement.setInt(1, 1); it works fine.When i call it with setting the boolean to the procedure from my java i get a error. Im really confused whether is this a issue with oracle? or with java code.
    Please can any body suggest me any kind of solution! to over come this scenario.
    ///// java code
    public void testThePackage() throws ClassNotFoundException { Connection connection = null; connection = (Connection) getConnection(); CallableStatement callableStatement = null; try { callableStatement = connection .prepareCall("{call L_test.p_retrieve_oppty_order_status(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}"); callableStatement.setBoolean(1, true); // callableStatement.setString(1, "YES"); // callableStatement.setInt(1, 1); // callableStatement.setLong(1, 1L); callableStatement.setString(2, "SFA"); callableStatement.setString(3, "123421"); callableStatement.setLong(4, 1L); callableStatement.setLong(5, 123L); callableStatement.setLong(6, 345L); callableStatement.setInt(7, 10); callableStatement.setInt(8, 2435); callableStatement.setInt(9, 5675); callableStatement.registerOutParameter(10, Types.NUMERIC); // on_return_status callableStatement.registerOutParameter(11, Types.VARCHAR); // os_duns_no callableStatement.registerOutParameter(12, Types.VARCHAR); // os_hq_duns_no callableStatement.registerOutParameter(13, Types.NUMERIC); // on_approval_id callableStatement.registerOutParameter(14, Types.NUMERIC); // on_approval_amt callableStatement.registerOutParameter(15, Types.VARCHAR); // os_message callableStatement.registerOutParameter(16, Types.VARCHAR); // os_approval_cd callableStatement.registerOutParameter(17, Types.VARCHAR); // os_security_term_cd callableStatement.registerOutParameter(18, Types.VARCHAR); // action // code callableStatement.registerOutParameter(19, Types.VARCHAR); // action // message // txt callableStatement.execute(); connection.commit(); } catch (SQLException e) { System.out.println(e.getMessage()); } } [/code] /////procedure  CREATE OR REPLACE PACKAGE BODY cust.L_test IS  PROCEDURE p_retrieve_oppty_order_status          (isNonAttilaAttempt boolean          , is_system_cd VARCHAR2          , is_order_id VARCHAR2          , in_oppty_id NUMBER          , in_company_id VARCHAR2          , in_acct_id NUMBER          ,in_local_rev NUMBER          ,in_switched_rev NUMBER          ,in_dedicated_rev NUMBER          , on_return_status  OUT NUMBER          , os_duns_no OUT VARCHAR2          , os_hq_duns_no OUT VARCHAR2          , on_approval_id OUT NUMBER          , on_credit_balance OUT NUMBER            , os_message OUT VARCHAR2      , os_approval_cd OUT VARCHAR2      , os_security_term_cd OUT VARCHAR2      ,os_action_cd  OUT VARCHAR2      ,os_action_txt_msg OUT VARCHAR2) IS      io_return l_cdt_util.return_data_t;            action_cd VARCHAR2(20):= NULL;      flag boolean:=false;  BEGIN  if isNonAttilaAttempt =[color=red]true[/color]  then --'YES'  true  flag:=true;  end if;  insert into example (id,data,deleted) values(1,'Test','YES');        END p_retrieve_oppty_order_status;    END cust.L_test;      CREATE OR REPLACE PACKAGE BODY cust.L_test IS PROCEDURE p_retrieve_oppty_order_status         (isNonAttilaAttempt boolean         , is_system_cd VARCHAR2         , is_order_id VARCHAR2         , in_oppty_id NUMBER         , in_company_id VARCHAR2         , in_acct_id NUMBER         ,in_local_rev NUMBER         ,in_switched_rev NUMBER         ,in_dedicated_rev NUMBER         , on_return_status  OUT NUMBER         , os_duns_no OUT VARCHAR2         , os_hq_duns_no OUT VARCHAR2         , on_approval_id OUT NUMBER         , on_credit_balance OUT NUMBER         , os_message OUT VARCHAR2     , os_approval_cd OUT VARCHAR2     , os_security_term_cd OUT VARCHAR2     ,os_action_cd  OUT VARCHAR2     ,os_action_txt_msg OUT VARCHAR2) IS     io_return l_cdt_util.return_data_t;        action_cd VARCHAR2(20):= NULL;     flag boolean:=false; BEGIN if isNonAttilaAttempt =[color=red]true[/color]  then --'YES'  true flag:=true; end if; insert into example (id,data,deleted) values(1,'Test','YES');       END p_retrieve_oppty_order_status; END cust.L_test;    /////error ORA-06550: line 1, column 7:  wrong number or types of arguments in call to 'P_RETRIEVE_OPPTY_ORDER_STATUS'  line 1, column 7:  PL/SQL: Statement ignored                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Hi YoungWinston,
    I realy appriciate your comments on the standard of the code , i also accept procedure and code may not be readable,
    but the problem is not because of bloated call its just beacause of the Boolean parameter being passed throught the java code, and where as the SQL/PL does not allow BOOLEAN as paramater, please refer the below link for justification.
    what am expecting is , is there any solution to this problem (not a work arround solution).
    Please provide me with some sort of solution/hints or suggestions in achieving this solution,
    I would realy your effort
    Thanks
    ud
    http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28370/datatypes.htm#CJACJGBG
    Predefined PL/SQL BOOLEAN Data Type
    The BOOLEAN data type stores logical values, which you can use in logical operations. The logical values are the Boolean values TRUE and FALSE and the value NULL.
    The syntax for specifying an BOOLEAN data item is:
    BOOLEAN
    SQL has no data type equivalent to BOOLEAN; therefore you cannot use BOOLEAN variables or parameters in the following:
    SQL statements
    Built-in SQL functions (such as TO_CHAR)
    PL/SQL functions invoked from SQL statements
    You cannot insert the value TRUE or FALSE into a database column. You cannot retrieve the value of a database column into a BOOLEAN variable.
    To represent BOOLEAN values in output, use IF-THEN or CASE constructs to translate BOOLEAN values into another type (for example, 0 or 1, 'Y' or 'N', 'true' or 'false').

  • How to implement custom field renderer?

    I'm trying to create a custom field renderer that will render certain database fields as checkboxes in HTML. I'm using the Data Web Beans/JSP approach. In my view object I have added a "Boolean" property to the attributes that represent boolean type fields (e.g., field Warranty to indicate if an asset is under warranty). I have created a CheckBoxField() class similar to the TextField() class, and call it if the attribute is a boolean, but I can't figure out how to set the custom field renderer. When the program runs, it still uses the TextField renderer. The JDeveloper online documentation doesn't say anything about it. Is there a sample program or some other documentation that implements a custom field renderer?

    Hi,
    this document in addition
    http://www.oracle.com/technology/products/jdev/howtos/10g/jaassec/index.htm
    has a list of LoginModules, one that authenticates against physical database users
    Frank

  • CHAR(1) = Not available to edit

    I created a table with a couple of CHAR(1) columns to represent Boolean (True/False/Yes/No) data. Unfortunately on attempt to edit (via Object Browser), these fields simply display "Not available to edit" in place of a text box. I can use a VARCHAR2(1) easily enough, but wondered how others represent this kind of data in Oracle?

    Robert,
    There is no limitation of using the CHAR datatype with Application Express (nee HTML DB) applications.
    Since HTML DB 2.0 was released, there has been this inability to directly edit columns of CHAR datatype in the Data view of the Object Browser. That will be corrected for our next release. Thank you for reporting this.
    In general, I would discourage someone from using CHAR datatype if they can use VARCHAR2 instead. Column values of CHAR datatype are padded with blanks to their maximum length, VARCHAR2 columns are not. If you were to insert the value 'Joel' into a column of type CHAR(10), the actual value stored in the database would be:
    'Joel      'without the quotes, obviously.
    Joel

  • Advanced:   How to traverse a tree representation in PL/SQL (procedure)?

    I am looking to write a method that will create a collection of records, each of which represents a node in a tree.
    TYPE t_all_folders IS TABLE OF get_all_folders%ROWTYPE INDEX BY PLS_INTEGER;
    v_all_folders t_all_folders;
    so first need help in figuring out what the cursor 'get_all_folders' would look like
    I have a folder structure represented in a database that is used basically to show visually
    (with a front end app) a folder structure (much like a folder structure in a file system).
    So each row has an entry in the 'folders' table like do:
    table folder:
         column           column
         folder_id          name
         1                    folder1               <= say this is a root folder
         2                    folder2               <= say this is a root folder
         3                    folder3               <= say this is a root folder
         4                    folder1a          <= all below are child folders..
         5                    folder1b
         6                    folder1c
         7                    folder1aa
         8                    folder1ab
         There is nothing in this table that indicates a hiearchy.
    The hiearchy is represented by another single table with two columns
    (I cannot change this, it is what it is)
    There is no left node or right node (not like a tree), just imagine sub folders.
    table: parent_child
         column          column
         parent_id     child_id
    such that visually when the tables are queried and the UI uses a folder icon to
    represent each row:
    it would look like this:
         folder1                              1
              - folder1a                         2
                   -folder1aa                    3
                   - folder1ab                    4
              - folder1b                         5
                   - folder1ba                    6
                   - folder1bb                    7
              - folder1c                         8
         folder2                              9
         folder3                              10
    I am attempting to create a query that will add to a collection folder records in the
    order above (1..10)
    In other words traverse the tree depth first going from:
              folder1 -> folder1a -> folder1aa -> folder1ab ->(back out to next level) folder1b -> folder1ba -> folder1bb -> folder1c
              then add folder2 (and traverse down that hiearch if needed)
              and then add folder3 to the colleciton and traverse down that hiearchy if there is one
              and continue adn so on.
              The requirement is to have them added to the collection in that order and when I iterate through the collection,
              they would of course need to be pulled out in that order (so use vararray with a counter to iterate through
              after the collection has been created.
    After the collection has been created, I have to iterate in that specific order to create records in another table where there is a column that requires an integer value that is the 1... order they come out of the collection
    and then have to iterate again and do something else in that order (and then other things - all the while needing in that order).
    Edited by: user12200443 on Nov 19, 2012 11:49 AM

    awesome, thanks for the help.
    put this in 'schema.sql' and run to create a reference schema and data for the example
    drop sequence seq_folders;
    CREATE SEQUENCE seq_folders
    INCREMENT BY 1
    MINVALUE 1
    START WITH 1
    CACHE 1000;
    drop table folders;
    create table folders (
         folder_id number not null,
         name varchar2(20) not null
    drop table parent_child;
    create table parent_child (
         parent_id number not null,
         child_id number not null);
    -- creation order (in order to have parent)
    -- folder1
    -- folder2
    -- folder3
    -- folder1a
    -- folder1b
    -- folder1c
    -- folder1aa
    -- folder1ab
    -- folder1ac
    -- folder1aaa
    -- folder1aba
    -- folder1aab
    -- folder1abb
    -- folder1aac
    -- folder1abc
    -- Visual hiearchy
    -- folder1                              1
    --      folder1a                         2
    --           folder1aa               3
    --                folder1aaa          4
    --                folder1aab          5
    --                folder1aac          6
    --           folder1ab               7
    --                folder1aba          8
    --                folder1abb          9
    --           folder1ac               10
    --      folder1b                         11
    --      folder1c                         12
    -- folder2                              13
    -- folder3                              14
    --- insert folders
    insert into folders(folder_id, name) values(seq_folders.nextval, 'folder1');
    insert into folders(folder_id, name) values(seq_folders.nextval, 'folder2');
    insert into folders(folder_id, name) values(seq_folders.nextval, 'folder3');
    insert into folders(folder_id, name) values(seq_folders.nextval, 'folder1a');
    insert into folders(folder_id, name) values(seq_folders.nextval, 'folder1b');
    insert into folders(folder_id, name) values(seq_folders.nextval, 'folder1c');
    insert into folders(folder_id, name) values(seq_folders.nextval, 'folder1aa');
    insert into folders(folder_id, name) values(seq_folders.nextval, 'folder1ab');
    insert into folders(folder_id, name) values(seq_folders.nextval, 'folder1ac');
    insert into folders(folder_id, name) values(seq_folders.nextval, 'folder1aaa');
    insert into folders(folder_id, name) values(seq_folders.nextval, 'folder1aba');
    insert into folders(folder_id, name) values(seq_folders.nextval, 'folder1aab');
    insert into folders(folder_id, name) values(seq_folders.nextval, 'folder1abb');
    insert into folders(folder_id, name) values(seq_folders.nextval, 'folder1aac');
    insert into folders(folder_id, name) values(seq_folders.nextval, 'folder1abc');
    commit;
    -- setup hiearchy
    insert into parent_child(parent_id, child_id) values (0, (select folder_id from folders where name = 'folder1'));
    insert into parent_child(parent_id, child_id) values (0, (select folder_id from folders where name = 'folder2'));
    insert into parent_child(parent_id, child_id) values (0, (select folder_id from folders where name = 'folder3'));
    -- 1a,1b,1c
    insert into parent_child(parent_id, child_id) values ((select folder_id from folders where name ='folder1'), (select folder_id from folders where name = 'folder1a'));
    insert into parent_child(parent_id, child_id) values ((select folder_id from folders where name ='folder1'), (select folder_id from folders where name = 'folder1b'));
    insert into parent_child(parent_id, child_id) values ((select folder_id from folders where name ='folder1'), (select folder_id from folders where name = 'folder1c'));
    -- aa,ab,ac
    insert into parent_child(parent_id, child_id) values ((select folder_id from folders where name ='folder1a'), (select folder_id from folders where name = 'folder1aa'));
    insert into parent_child(parent_id, child_id) values ((select folder_id from folders where name ='folder1a'), (select folder_id from folders where name = 'folder1ab'));
    insert into parent_child(parent_id, child_id) values ((select folder_id from folders where name ='folder1a'), (select folder_id from folders where name = 'folder1ac'));
    -- aaa,aba,aab
    insert into parent_child(parent_id, child_id) values ((select folder_id from folders where name ='folder1aa'), (select folder_id from folders where name = 'folder1aaa'));
    insert into parent_child(parent_id, child_id) values ((select folder_id from folders where name ='folder1aa'), (select folder_id from folders where name = 'folder1aab'));
    insert into parent_child(parent_id, child_id) values ((select folder_id from folders where name ='folder1aa'), (select folder_id from folders where name = 'folder1aac'));
    -- aba,abb,abc
    insert into parent_child(parent_id, child_id) values ((select folder_id from folders where name ='folder1ab'), (select folder_id from folders where name = 'folder1aba'));
    insert into parent_child(parent_id, child_id) values ((select folder_id from folders where name ='folder1ab'), (select folder_id from folders where name = 'folder1abb'));
    insert into parent_child(parent_id, child_id) values ((select folder_id from folders where name ='folder1ab'), (select folder_id from folders where name = 'folder1abc'));
    commit;
    then run this to get the error message
    WITH joined_data     AS
         SELECT     f.folder_id,     f.name,     pc.parent_id
         FROM     folders     f
         JOIN     parent_child     pc ON pc.child_id = f.folder_id
    SELECT     j.*,     ROWNUM     
    AS r_num
    FROM joined_data     j
    START WITH     parent_id =0
    CONNECT BY     parent_id= PRIOR child_id
    ORDER SIBLINGS BY     name;
    thanks for the help, hopefully I can find a way to read the rows/record into a data structure (does not have to be a single sql statement - can be anything I can do in PL/SQL.
    Edited by: user12200443 on Nov 19, 2012 5:55 PM

Maybe you are looking for

  • Strange behaviour - any ideas?

    Strange behaviour began when i was unable to open a new page in photoshop. The next day i was unable to print from word or photoshop or emails. However i could print from freehand and excel! I used disk 1 to verify and repair disk. this did not solve

  • Running clock on a jsp page

    Hi , I hav to set a clock on a jsp page which is dynamic can sumbody help me to do that ....... plz its urgent

  • Add field in 'Subsequent Outbound Delivery Split' subscreen in VT01N tcode

    Hi, My Requirement: Add field STFAK in the report in  'Subsequent Outbound Delivery Split' subscreen in VT01N transaction. This field is to be added in Structure LEDSPD_LIST_ITEM, and value in it is to be mapped from MARA-STFAK. Steps to the Subscree

  • Report Generator has failed, please send the following information to your

    Hi I am trying to generate a report from Designer. I am getting the following error Report Generator has failed, please send the following information to your support person Assertion failure at crrma_bld_orapp at crrm.cpp:459 What should I do to get

  • Very Slow Save for Web in CS3 Mac

    I have Photoshop CS3 Extended 10.0.1 running on a 2.16GHz Intel MacBook running 10.4.11 with 2Gb of installed RAM and around 30% free hard disk space. Regardless of file size or dimension, Save For Web is painfully slow to load and to save out. Optim