Testing of value in SQL

Hi,
  Is there anything within SQL that allows me to check the value of a combination of dimensions, because it seems to me that "*when is" and "endwhen" are only used to test whether a dimension carries a certain member.
  To cite an example, what would you do in SQL if you want to test whether account = "sales" is larger than account = "cost"?
  Thanks for your help in advance.
Cheers

Hi Lip,
*WHEN , *IS AND *ENDWHEN in combination with GET() or LOOKUP() function can be used to compare the value of combination of dimensions.
For example, you can try the below
*LOOKUP
*DIM CompSales:Account = "SALES"
*DIM CompCost:Account="COST"
*ENDLOOKUP
*WHEN LOOKUP(COMPSALES)
*IS > LOOKUP(COMPCOST)
//REQUIRED INSTRUCTIONS
*ENDWHEN
Regards,
Kranthi

Similar Messages

  • Unable to insert values thru SQL driver

    Hi , I am having problem regarding inserting the values in SQL server,but an exception is generated.i.e..SQLException.I hav mentioned below the code,plz look over it if there is any mistake as values not being to inserted thru url statement .
    If  any changes to be made plz mention it.
    Try
    mgr.reportWarning("starting.....");
      mgr.raiseException("ur herer",false);
         String drivername="com.sap.portal.jdbc.sqlserver.SQLServerDriver";
         Class.forName(drivername);          
    mgr.reportWarning("Driver loaded");               
    mgr.raiseException("Driver loaded",false);
          String url="jdbc:sap:sqlserver:// ... / *:*;DatabaseName=dbname";
       conn=DriverManager.getConnection(url,"username","password");
         mgr.reportSuccess("you r here");     
      Statement stmt=conn.createStatement();
      String stmt1="insert into tablename(col)".concat("values('"wdContext.currentSurveyElement().getQuestion1()"')");                                           
      //PreparedStatement pstmt=conn.prepareStatement(stmt1);
           ResultSet rs=stmt.executeQuery("insert into test""(Column1)" "values('wdContext.currentSurveyElement().getQuestion1()')");
         stmt.close();
         conn.close();
    Regards:
    hanif

    HI,
    use drivername:
    com.microsoft.sqlserver.jdbc.SQLServerDriver
    Connectiion object:
    jdbc:sqlserver://<serverhost which has the sqldriver>
    SQLEXPRESS:1433;database=<databaseName>;user=<usedname>;password=<password>
    try with this details.
    regards,
    Kathiresan R

  • Get positive values from sql

    I have balance column and i need to pick only positive values from sql query.
    Balance
    200
    -20
    -220
    100
    Expected
    Balance
    200
    100

    Hi Frank,
    Sorry i think i am not clear.
    below is my function get_total.
    one billing_key is nothing but one billing period-each period has 6 programkeys.
    by following function i will get 6 records by passing 6 programkeys and one biling key
    now i need to get over all balance of all periods per program. condition is i need to take only +ve amounts from the below function and sum it up
    expected out. i am just giving an example of output.
    actual
    programkey get_total
    a 100
    a -50
    a -50
    b 200
    c 300
    c -200
    d -100
    d -25
    d 400
    e 500
    e -10
    f 600
    f -200
    we are taking only +ve amounts from the above.
    How can i write a procedure or script to acheive program_key and balance as below.
    programkey balance
    a 100
    b 200
    c 300
    d 400
    e 500
    f 600
    create or replace FUNCTION GET_TOTAL (p_bill_key IN varchar2,
    p_prog_key IN varchar2) RETURN NUMBER AS
    l_total NUMBER;
    l_dum_bill NUMBER;
    p_count NUMBER:=0;
    BEGIN
    BEGIN
    SELECT count(*) into p_count
    FROM billing_adjust b where b.billing_key = p_bill_key ;
    if p_count < 1 then
    SELECT NVL(surch_amount,0) + NVL(adjust_amount,0)
    INTO l_total
    FROM mv_billing a, mv_prog_surch b
    WHERE a.billing_key = b.billing_key and
    a.billing_key = p_bill_key and
    b.program_key = p_prog_key;
    return l_total ;
    end if;
    SELECT NVL(surch_amount,0) + NVL(adjust_amount,0)
    INTO l_total
    FROM billing_adjust b, prog_surch_adjust c
    WHERE b.billing_adjust_key = c.billing_adjust_key and
    b.billing_key = p_bill_key and
    c.program_key = p_prog_key;
    return l_total;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    null;
    End;
    RETURN 0;
    END GET_TOTAL;
    This is what i have started writing to acheive expected output need help on this.
    Create or replace function balance(p_company_id) return number as
    v_total_due number:=0;
    v_total number:=0;
    CURSOR p_idn IS
    SELECT PROGRAM_KEY,PROGRAM_NAME FROM MV_PROGRAM_DICT where CURRENT_YN = 'Y' order by PROGRAM_NAME_ID;
    cursor p_billkey_idn is
    select biling_key from billing where company_id=p_company_id;
    Begin
    for v_idn in p_idn loop
    for v_billkey in p_billkey loop
    SELECT sum(get_total(v_billkey.billing_key,v_idn.program_key)) into balance
    FROM dual
    WHERE get_total(v_billkey.billing_key,v_idn.program_key)>0;
    END LOOP;
    END loop;

  • Pass value from SQL agent job step

    Hi 
    I have created one SSIS package and I am scheduling the same using SQL Agent job. Now I want to pass one value from SQL job agent and want to use that value in SSIS package and then run that package.  Can someone point to the solution.
    Aniruddha http://aniruddhathengadi.blogspot.com/

    I have created one parameter on SSIS package named strValue and assigned a empty value "". After that I have created one SQL job and step wherein I have set the value to "Nike" for parameter under Parameters tab.
    Now I am expecting Nike value which I have set on SQL job step should get reflected on SSIS package when I am running my job. Am I doing anything wrong ?
    Aniruddha http://aniruddhathengadi.blogspot.com/
    Not sure what's going wrong but you can have quick look at below step by step tutorial:
    Parameterizing Connections and Values at Runtime Using SSIS Environment Variables (via SQL Agent)
    Cheers,
    Vaibhav Chaudhari

  • Default form value using sql with bind variable

    I wish to create a form based upon a table with a foreign key. I wish to add a field to the form that is an uneditable text field with a default value using sql of 'select name from other_table where other_table_id = ?' where ? is a bind variable defined by a hidden field which is the value of the foreign key identified at runtime. How can this be done?
    null

    I don't think that will work. I have multiple people accessing the Portal at the same time with the same login (or lack of as public will be the most common user). I could set it easily enough as the value is passed to the form by a link object, so I could add it to the before page plsql block and set the value. But I am uncertain how it will behave in a multi-user mutlitasking environment.
    Maybe I should describe what I am looking to accomplish. I want to create a display above a form that will list static details from other tables (i.e. when editing a user's phone number, which is in one table, you want the user to see the person's name, which is in another table, and the form is based upon the phone table) ...
    Just as I am thinking about it, I thought of an idea. I could put some specific code in the before displaying page plsql section to query the database and use htp to output the information for data not in the table the form is based upon. I will try this and see how it works. It would have been nice to have just created a field that is not editable and had a default value, but this should work as well.
    Let me know if you see any problem with this or if you have any better suggestions.
    Thanks for the fast response.

  • Ident_Current('TableName') not giving last inserted identity Value in SQL Server 2012

    Hi ,
    Ident_Current('TableName') is not giving last inserted identity Value in SQL Server 2012. 
    Latest Value of ID and Ident_Current is differing for that particular table.  
    Why its happening? Ident_Current value is greater than last inserted ID.
    Please guide me why its happening?

    Here is one example:
    CREATE DATABASE PMCtest ON (NAME = 'PMCtest', FILENAME = 'B:\ProdDB-Unzipped\PMCtest.mdf', SIZE = 25GB )
    LOG ON (NAME = 'PMCtest_log', FILENAME = 'B:\ProdDB-Unzipped\PMCtest.ldf', SIZE = 2GB)
    CREATE TABLE identity_crisis (a int IDENTITY NOT NULL PRIMARY KEY,
                                  b sysname NOT NULL CHECK (b <> 'sysschobjs'))
    go
    INSERT identity_crisis (b) VALUES ('First name')
    INSERT identity_crisis SELECT name FROM sys.objects
    go
    SELECT MAX(a), ident_current('identity_crisis')
    FROM  identity_crisis
    go
    DROP TABLE identity_crisis
    Because the second INSERT statement fails, the identity values from 2 to 12 are lost. This is a very intentional design to promote high concurrency. If you don't want gaps, you should not use IDENTITY, but roll your own.
    Also, beware that ident_current returns database-wide value, so if you insert one row, and another process inserts another row before you interrogate ident_current, you will get the id for the row of the other process.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Bit value in sql-server

    hello frnds,
    i want to insert bit value into sql-server 2000... using hibernate
    what is the datatype for java bean.... ?
    and how it is mappend in mapping xml....?
    if any one has idea then please help me...
    thanx in advance..
    regards
    PanDev84

    The WPF MediaElement (unlike Silverlight's) doesn't support setting the Source to a Stream directly. You could try any of the workarounds suggested here:
    http://stackoverflow.com/questions/7117589/using-mediaelement-to-play-video-from-stream
    Othwerwise you could select the data (bytes) from the database into a byte[]:
    http://stackoverflow.com/questions/13952261/insert-and-retrieve-bytearray-from-sql-server-in-c-sharp
    ...and then save the data to a temporary physical file and play this one as usual:
    byte[] data = ...; //select from db
    System.IO.File.WriteAllBytes("temp.wav", data);
    var mediaPlayer = new MediaPlayer();
    mediaPlayer.Open(new Uri("temp.wav", UriKind.Relative));
    mediaPlayer.Play();
    The MediaPlayer.Open method will read the file via a stream automatically.
    Hope that helps.
    Please remember to close your threads by marking helpful posts as answer and please start a new thread if you have a new question.

  • Transaction "test run" value

    Hello,
    Does anyone know (is that even possible) how to get the "test run" value (checked/unchecked) of a standard transaction like CJ44 into a Z-program...I'm using the CALL TRANSACTION statement
    thx
    petr

    Hi,
        i tried using following code for 'detail lists' for cj44 tcode checkbox as my test run check box comes default checkd.and this code is working fine.
    DATA: it_bdcdata  TYPE STANDARD TABLE OF bdcdata,
          wa_bdcdata  TYPE bdcdata.
      wa_bdcdata-program = 'SAPLKAZB'.
      wa_bdcdata-dynpro = '1000'.
      wa_bdcdata-dynbegin = 'X'.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR: wa_bdcdata.
      wa_bdcdata-fnam = 'RKAUF-LIST'.
      wa_bdcdata-fval = 'X'.
      APPEND wa_bdcdata TO it_bdcdata.
      CALL TRANSACTION 'CJ44' USING it_bdcdata
           mode 'E'.
    Regards,
    Twinkal.

  • How to test a simple PL SQL function from another PL SQL script

    Hi,
    I have created a function. Now i need to test that whether it is returning the correct values or not.
    For that, i have written anothe pl sql script and trying to call this function. Im passing all the IN parameters in that function. I assume here that OUT parameters will provide me the result. Im trying to display the OUT parameter one by one to see my result.
    I'm using toad as sql client here connected with oracle.
    pl sql script:-
    DECLARE
    BEGIN
         DBMS_OUTPUT.PUT_LINE('$$$$$$$ VINOD KUMAR NAIR $$$$$$$');
         FETCH_ORDER_PRODUCT_DATA(320171302, 1006, 6999,
    ODNumber OUT VARCHAR2, Line_Number OUT VARCHAR2,
    ServiceID OUT VARCHAR2, BilltoNumber OUT VARCHAR2,
    AnnualPrice OUT NUMBER, CoverageCode OUT VARCHAR2)
    DBMS_OUTPUT.PUT_LINE('HERE IS THE RESULT ' | ODNumber );
    DBMS_OUTPUT.PUT_LINE('HERE IS THE RESULT ' | Line_Number );
    DBMS_OUTPUT.PUT_LINE('HERE IS THE RESULT ' | ServiceID );
    DBMS_OUTPUT.PUT_LINE('HERE IS THE RESULT ' | BilltoNumber );
    DBMS_OUTPUT.PUT_LINE('HERE IS THE RESULT ' | AnnualPrice );
    DBMS_OUTPUT.PUT_LINE('HERE IS THE RESULT ' | CoverageCode );
    END;
    Function:-
    Program Name : SPOT_Order_Product_Data_For_CFS.sql
    Description : Function to Validate parameters from CFS
    By : Vinod Kumar
    Date : 08/19/2011
    Modification History
    By When TAR Description
    CREATE OR REPLACE FUNCTION FETCH_ORDER_PRODUCT_DATA(orderNumber IN VARCHAR2, customerNumber IN VARCHAR2,
    productLine IN VARCHAR2, ODNumber OUT VARCHAR2,
    Line_Number OUT VARCHAR2, ServiceID OUT VARCHAR2,
    BilltoNumber OUT VARCHAR2, AnnualPrice OUT NUMBER,
    CoverageCode OUT VARCHAR2)
    RETURN VARCHAR2 IS
    lv_err_msg VARCHAR2(100) := '';
    lv_bucket_id VARCHAR2(14);
    lv_bill_number VARCHAR2(30);
    lv_anual_price NUMBER;
    lv_coverage_code VARCHAR2(8);
    lv_quote_num NUMBER(10) := NULL;
    lv_line_num NUMBER(5) := 0;
    lv_customer_number VARCHAR2(30) := customerNumber;
    lv_product_id VARCHAR2(14) := productLine;
    lv_count_quote NUMBER := 0;
    lv_quote_status VARCHAR2(5);
    lv_quote_version NUMBER(2):=0;
    BEGIN
    IF INSTR(orderNumber, '-') = 0 THEN
    lv_quote_num := orderNumber;
    ELSE
    lv_quote_num := SPT_Delimiter(orderNumber, 1, '-');
    lv_line_num := SPT_Delimiter(orderNumber, 2, '-');
    END IF;
    --Check status of the quote COM, APP
    SELECT COUNT(*) INTO lv_count_quote FROM sot_order_header WHERE ORDER_NUMBER=lv_quote_num
    AND ORDER_STATUS IN ('APP', 'COM') AND CUSTOMER_NUMBER = lv_customer_number;
    IF lv_count_quote = 0 THEN
    lv_err_msg := 'Invalid Order number';
    RETURN lv_err_msg;
    END IF;
    -- Fetch the latest version on SPOT quote
    SELECT MAX(VERSION_NUMBER) INTO lv_quote_version FROM SPT_QUOTE_HEADER WHERE QUOTE_NUMBER = lv_quote_num
    AND CUSTOMER_NUMBER = lv_customer_number;
    -- If quote is valid fetch the data in OUT parameters
    IF lv_line_num = 0 THEN
    BEGIN
    SELECT a.CUSTOMER_BILLTO_NUMBER,
    b.LINE_NUMBER, b.BUCKET_ID,
    b.ANNUAL_REF_RATE_USD, b.COVERAGE_CODE
    INTO lv_bill_number,lv_line_num,lv_bucket_id,lv_anual_price,lv_coverage_code
    FROM SPT_QUOTE_HEADER a, SPT_QUOTE_LINE b
    WHERE a.QUOTE_NUMBER = lv_quote_num
    AND a.CUSTOMER_NUMBER = lv_customer_number
    AND a.VERSION_NUMBER = lv_quote_version
    AND a.QUOTE_NUMBER = b.QUOTE_NUMBER
    AND a.VERSION_NUMBER = b.VERSION_NUMBER
    AND b.PRODUCT_ID = lv_product_id;
    ODNumber := lv_quote_num;
    BilltoNumber := lv_bill_number;
    Line_Number := lv_line_num;
    ServiceID := lv_bucket_id;
    AnnualPrice := lv_anual_price;
    CoverageCode := lv_coverage_code;
    RETURN '';
    EXCEPTION WHEN OTHERS THEN
    lv_err_msg := 'Multiple PIDs existing in the SPOT order, please provide the SPOT order + line number as input data';
    RETURN lv_err_msg;
    END;
    ELSE
    BEGIN
    SELECT a.CUSTOMER_BILLTO_NUMBER,
    b.BUCKET_ID, b.ANNUAL_REF_RATE_USD,
    b.COVERAGE_CODE
    INTO lv_bill_number,lv_bucket_id,lv_anual_price,lv_coverage_code
    FROM SPT_QUOTE_HEADER a, SPT_QUOTE_LINE b
    WHERE a.QUOTE_NUMBER = lv_quote_num
    AND a.CUSTOMER_NUMBER = lv_customer_number
    AND a.VERSION_NUMBER = lv_quote_version
    AND a.QUOTE_NUMBER = b.QUOTE_NUMBER
    AND a.VERSION_NUMBER = b.VERSION_NUMBER
    AND b.PRODUCT_ID = lv_product_id
    AND b.LINE_NUMBER = lv_line_num;
    ODNumber := lv_quote_num;
    BilltoNumber := lv_bill_number;
    Line_Number := lv_line_num;
    ServiceID := lv_bucket_id;
    AnnualPrice := lv_anual_price;
    CoverageCode := lv_coverage_code;
    RETURN '';
    EXCEPTION WHEN OTHERS THEN
              lv_err_msg := 'Multiple SPOT lines exist with same parameter';
              RETURN lv_err_msg;
    END;
    END IF;
    EXCEPTION
    WHEN OTHERS THEN
    lv_err_msg := '@@@ EXCEPTION THROWN @@@ '|| SUBSTR(SQLERRM,1,120);
    RETURN lv_err_msg ;
    END;
    Don't look at the function, it might have errors but my primary concern is how to test this function. Once I start doing its testing then only i can understand any bugs(if any).
    My pl sql is not so good. Im still learning. I don't understand IN and OUT parameters are.
    I just know that IN parameters r those whick we pass in to the function wen we call it and OUT parameters are those through which we get the result.
    Thanks in advance
    Vinod Kumar Nair

    20100511 wrote:
    I wondered how I could test the output of the function from within TOAD?I usually create the following function in my developer schema:
    create or replace function BoolToChar( b boolean ) return varchar2 is
    begin
      if b then
        return( 'TRUE' );
      else
        return( 'FALSE' );
      end if;
    end;To test a function like yours, the following will do in SQL*Plus/TOAD/etc:
    begin
      DBMS_OUTPUT.put_line(
        BoolToChar( XCCC_PO_APPROVALLIST_S1.does_cpa_exist(1017934)  )
    end;
    I'm probably doing 101 things wrong here, but thought I'd ask anyway and risk being shouted at.Shout at? You reckon? I thought people risked being beaten with a lead pipe, or pelted with beer cans and stale pretzels - which makes being shouted at a really safe and viable alternative. {noformat};-){noformat}

  • SQL Developer Unit Testing - Validation with PL/SQL

    Hi,
    I am trying to create Unit tests using SQL Developer UT framework.
    But when i am creating validation using User PL/SQL code option.
    Then how can i check value returned by l_count in code snippet below:
    -- Please raise an exception if the validation fails.
    -- For example:
    DECLARE
    l_count NUMBER;
    wrong_count EXCEPTION;
    BEGIN
    SELECT count(*) into l_count
    FROM test_recon
    WHERE
    match_num = 99836936
    AND Stg_status_flag <> 'E';
    IF l_count = 0
    THEN
    RAISE wrong_count;
    END IF;
    END;
    Also, can someone please refer me to few more demo examples (apart from oracle docs) to implement good test cases with SQL developer.
    I appreciate your help.
    Regards
    Dipali

    Probably not the answer you're looking for, but back when I was playing around with the Unit Test stuff, I didn't have sys privs, and the DBAs were a little busy at the time to set a up a repository for me. Rather than wait, I installed Oracle XE on my machine and created a small dev schema and deployed unit test to that. It's so much easier to perform quick proof of concepts when you have full control.

  • Hardcode value in sql statement

    Hi,
    This may be a simple thing which I'm missing.
    I'm trying to hardcode numeric value in my SQL statement
    '1.0000' AS NUMBER (10,4) - It returns value as 1 instead of 1.0000
    '1.1255' AS NUMBER(10,4) - returns 1.1255
    I need my o/p to be as 1.0000 not as 1.Is there anyway I can get the result as I'm looking for
    Thanks in advance

    Hi,
    847750 wrote:
    Hi,
    This may be a simple thing which I'm missing.
    I'm trying to hardcode numeric value in my SQL statement
    '1.0000' AS NUMBER (10,4) - It returns value as 1 instead of 1.0000
    '1.1255' AS NUMBER(10,4) - returns 1.1255
    I need my o/p to be as 1.0000 not as 1.Is there anyway I can get the result as I'm looking for
    Thanks in advance
    It's hard to tell what you really want to do from such a tiny code fragment.
    Whenever you have a question, post a complete test script that people can run to re-create the problem and test their ideas.
    The value 1 is exactly the same as the value 1.0000; there is no difference between those numbers.
    If you want to display a number in a certain format (e.g. '1.0000' instead of '1'), the front end is probably the best place to do that.
    If you're using SQL*Plus as the front end, you can set the display for the column called increase_pct like this:
    COLUMN  increase_pct  FORMAT 990.0000
    This will make it display the numbers in that column with at least 1 digit to the left of the decimal point, and exactly 4 digits to the right of the decimal point.
    Other front end tools have similar features.
    If you need to do the equivalent in SQL, use the TO_CHAR function, like this
    SELECT  ename
    ,       TO_CHAR (sal, '99999.00')   AS salary
    FROM    scott.emp
    If you really are hard-coding literals, you can hard code a string, such as '1.0000'.  Don't CAST it to a NUMBER..

  • Spaces value in sql loader

    Is there a way to load in spaces using Sql*Loader given that the table it is loading to has a not null column but has a default value. My data file has spaces for a number field instead of zeros. Since my table column is declared as not null, it's failing even if I have a default value of '0' in my column.

    You can tackle this in the control file. Here is a snippet from Oracle OnLine books - hopefully this will help out! Cheers.
    ==========================================
    Setting a Column to Null or Zero
    If you want all inserted values for a given column to be null, omit the column's specifications entirely. To set a column's values
    conditionally to null based on a test of some condition in the logical record, use the NULLIF clause; see NULLIF Keyword. To set a
    numeric column to zero instead of NULL, use the DEFAULTIF clause, described next.
    DEFAULTIF Clause
    Using DEFAULTIF on numeric data sets the column to zero when the specified field condition is true. Using DEFAULTIF on
    character (CHAR or DATE) data sets the column to null (compare with Numeric External Datatypes). See also Specifying Field
    Conditions for details on the conditional tests.
    DEFAULTIF field_condition
    A column may have both a NULLIF clause and a DEFAULTIF clause, although this often would be redundant.
    Note: The same effects can be achieved with the SQL string and the DECODE function. See Applying SQL Operators to
    Fields
    NULLIF Keyword
    Use the NULLIF keyword after the datatype and optional delimiter specification, followed by a condition. The condition has the same
    format as that specified for a WHEN clause. The column's value is set to null if the condition is true. Otherwise, the value remains
    unchanged.
    NULLIF field_condition
    The NULLIF clause may refer to the column that contains it, as in the following example:
    COLUMN1 POSITION(11:17) CHAR NULLIF (COLUMN1 = "unknown")
    This specification may be useful if you want certain data values to be replaced by nulls. The value for a column is first determined from
    the datafile. It is then set to null just before the insert takes place. Case 6: Loading Using the Direct Path Load Method provides
    examples of the NULLIF clause.
    Note: The same effect can be achieved with the SQL string and the NVL function. See Applying SQL Operators to Fields.
    Null Columns at the End of a Record
    When the control file specifies more fields for a record than are present in the record, SQL*Loader must determine whether the
    remaining (specified) columns should be considered null or whether an error should be generated. The TRAILING NULLCOLS
    clause, described in TRAILING NULLCOLS, explains how SQL*Loader proceeds in this case.
    ==========================================

  • Not sure how to test output of PL/SQL function

    I have a function in package ".XCCC_PO_APPROVALLIST_S1" called "does_cpa_exist":
       FUNCTION does_cpa_exist(
          p_document_id              IN       NUMBER
          RETURN BOOLEAN
       IS
          l_cpa_exists VARCHAR2(100);
       BEGIN
          SELECT 'Y'
            INTO l_cpa_exists
            FROM po.po_requisition_lines_all prla
               , ap.ap_suppliers pv
               , ap.ap_supplier_sites_all pvsa
           WHERE prla.vendor_id = pv.vendor_id
             AND prla.vendor_site_id = pvsa.vendor_site_id
             AND pv.vendor_id = pvsa.vendor_id
             AND prla.requisition_header_id = p_document_id
             AND EXISTS(
                    SELECT pha.vendor_id
                      FROM po.po_headers_all pha
                     WHERE pv.vendor_id = pha.vendor_id
                       AND pvsa.vendor_site_id = pha.vendor_site_id
                       AND pha.org_id = fnd_profile.VALUE('ORG_ID')
                       AND pha.type_lookup_code = 'CONTRACT'
                       AND pha.authorization_status = 'APPROVED');
          RETURN TRUE;
          IF (p_document_id IS NULL)
          THEN
             RETURN FALSE;
          END IF;
       EXCEPTION
          WHEN OTHERS
          THEN
             RETURN FALSE;
       END does_cpa_exist;The pl/sql validates and commits okay in TOAD.
    I have run the sql from within EBS, and the path the workflow took looks like the function returned a false.
    I pass the function a document_id.
    I wondered how I could test the output of the function from within TOAD?
    I tried:
    select XCCC_PO_APPROVALLIST_S1.does_cpa_exist(1017934) from dual;But get errors:
    ORA-06552: PL/SQL: Statement ignored
    ORA-06553: PLS-382: expression is of wrong typeI'm probably doing 101 things wrong here, but thought I'd ask anyway and risk being shouted at.
    Any advice much appreciated,
    Thanks

    20100511 wrote:
    I wondered how I could test the output of the function from within TOAD?I usually create the following function in my developer schema:
    create or replace function BoolToChar( b boolean ) return varchar2 is
    begin
      if b then
        return( 'TRUE' );
      else
        return( 'FALSE' );
      end if;
    end;To test a function like yours, the following will do in SQL*Plus/TOAD/etc:
    begin
      DBMS_OUTPUT.put_line(
        BoolToChar( XCCC_PO_APPROVALLIST_S1.does_cpa_exist(1017934)  )
    end;
    I'm probably doing 101 things wrong here, but thought I'd ask anyway and risk being shouted at.Shout at? You reckon? I thought people risked being beaten with a lead pipe, or pelted with beer cans and stale pretzels - which makes being shouted at a really safe and viable alternative. {noformat};-){noformat}

  • Unit Test exports between different SQL Developer versions

    Hi,
    I am having problems with trying to export and import unit test suites between SQL Developer versions. I can't find any documentation in this area. We have a number of unit test suites exported as XML files from version 2.1.1.64, and below are combinations of things I have tried:
    - I have tried to import a unit test suite into version 3.0.0.4 that was exported from version 2.1.1.64 and get the error "Import failed. unexpected null value". I expect that this is probably an unsupported action due to repository changes between the two versions - should I be able to do this?
    - I have upgraded the repository with unit tests in it. The unit tests run perfectly well in the upgraded repository. However, if I try to export any suites or individual tests, I get an error "Export failed.". A XML file is created but with what looks like only the header part of it.
    - I have created a new unit test suite in version 3.0.0.4 and this exports successfully.
    - I have gone into each test of a suite in the upgraded repository and made a change so that I can perform a commit. When I do an export, this does then work successfully.
    Therefore it appears that something is not carried out by default when the repository is upgraded, but this fixes itself if the test is amended and committed in the upgraded repository. Although this may be a workaround, we have 100's of tests and is not something I really want to do. Has anyone else experienced this and got any recommendations for this?
    Thanks, Pierre.

    Hi,
    I am having problems with trying to export and import unit test suites between SQL Developer versions. I can't find any documentation in this area. We have a number of unit test suites exported as XML files from version 2.1.1.64, and below are combinations of things I have tried:
    - I have tried to import a unit test suite into version 3.0.0.4 that was exported from version 2.1.1.64 and get the error "Import failed. unexpected null value". I expect that this is probably an unsupported action due to repository changes between the two versions - should I be able to do this?
    - I have upgraded the repository with unit tests in it. The unit tests run perfectly well in the upgraded repository. However, if I try to export any suites or individual tests, I get an error "Export failed.". A XML file is created but with what looks like only the header part of it.
    - I have created a new unit test suite in version 3.0.0.4 and this exports successfully.
    - I have gone into each test of a suite in the upgraded repository and made a change so that I can perform a commit. When I do an export, this does then work successfully.
    Therefore it appears that something is not carried out by default when the repository is upgraded, but this fixes itself if the test is amended and committed in the upgraded repository. Although this may be a workaround, we have 100's of tests and is not something I really want to do. Has anyone else experienced this and got any recommendations for this?
    Thanks, Pierre.

  • How to select a case sensitive value in SQL with C#

    Hello,
    I have an application that at the begining a user will login with a user name and password which is stored in the database. The SQL statement is as follows:
    "SELECT id_employee FROM employee WHERE employee_number='" + txtUserName.Text + "' AND passWord='" + txtPassword.Text + "'";
    For testing purposes I have set the password to the word test.   The problem is, if the user enters in TEST or TeSt or TESt  it will grant them access. How do I set it to force the correct case?
    I am using SQL 2005 for the database.
    Thanks!
    ~zero

    You can also set Collation while comparing strings:
    "SELECT id_employee FROM employee WHERE employee_number='" + txtUserName.Text + "' COLLATE Latin1_General_CS_AS AND passWord='" + txtPassword.Text + "'  COLLATE Latin1_General_CS_AS";
    All comments about not doing this type of quering using command string, instead of command with parameters, they are apsolutely right.
    Nevertheless i will have only username as a parameter in the command and password will be return value from procedure. I will check for equality of entered password and returned one from command in C# code, and C# is case sensitive. There is a good security model implemented for password in AdventureWorks sample database for SQL Server 2005, in table Person.Contact.
    That model use two fields for password, PasswordHash and PasswordSalt. PasswordSalt is randomly generated hash when password is modified and with that salt, password string is encrypted, which produce PasswordHash. So when you want to authenticate a user, execute a command that will return a row(PasswordHash and PasswordSalt) for entered username, and in application you will encrypt entered username with PasswordSalt. If generated string is equal with the one returned PasswordHash, then you have a valid login. If nothing is returned from command or they are not equal, you have invalid login.

Maybe you are looking for

  • How to create a group of cost element

    Hi, i want to integrate a group of cost element in KP06, but i don't know how to create it. please what is the transaction to do that ? Regards.

  • New to Macs..how to tell if you have a virus or not?

    I'm used to PCs which are virus ridden and sometimes you don't even know you have a virus on a PC. I was wondring if Macs have the same problem and if there is a way to tell if you have a virus or not. Anyone know?

  • Headphone jack light

    occaisionaly a red light comes from my headphone jack and no sound will come from the speakers. the longer i stay on my computer the less the red light comes on and stops whatever it is i'm listening to at the time. i assume it's a setting problem, b

  • Preference panel error

    I have an original 20" cinema display. I have a new Mac Pro & have the display hooked up with the new adapter. Regardless of the adpater & upgrade, I have had a problem. I often get the display preference window opening up on its own. Sometimes this

  • Best workflow to select all text in object

    I regularly copy text filled objects to reuse them and need to change the text within. Does anyone have a fast way to select all text? Currently I have to double click the text to get a cursor and then use a control+A to select all text in the box. I