Sqlcode and sql%rowcount as test conditions

I am translating a procedure from Ingres to oracle. I use the Oracle sqlcode and sql%rowcount
variables in place of Ingres's iierrornumber and iirowcount.
I replaced the ingres names with the oracle names, and now am wondering how how oracle uses these
values.
I am using DBMS_OUTPUT.PUT_LINE to display the contents of sqlcode and sql%rowcount.
What happens when I get "no rows selected". I run the same query in standalone command line
and get no rows selected .. and it's correct because I don't have data that matches).
But when I run it in the procedure, I don't get any values in sqlcode or sql%rowcount ... the
program just exits. The author was using the ingres code to test if there was data there and then
continue to do something else.
If you get no rows returned, does that mean, the sqlcode is 0 ? and the sql%rowcount is emtpy?
which is why my DBMS_OUTPUT.PUT_LINE doesn't display anything ?
my example........
before this section in the procedure ... after running a different select that returns data ...
I am using the DBMS to debug the values I have going in ...
DBMS_OUTPUT.Put_line ('BEFORE sqlcode is' || sqlcode);
DBMS_OUTPUT.Put_line ('BEFORE sqlrowcount is' || sql%rowcount);
Select value from table
where condition ='Y'; > this select will product "no rows return" and ignore the 2 DBMS_OUTPUTS beow ---
DBMS_OUTPUT.Put_line ('AFTER sqlcode is' || sqlcode);
DBMS_OUTPUT.Put_line ('AFTER sqlrowcount is' || sql%rowcount);
When i run the procedure... I get the DBMS BEFORE statements, and nothing afterwards ...
BEFORE sqlcode is 0
BEFORE sqlrowcount is 1 >>>> that is all that displays
Since I am getting the "no rows returned" ... how does oracle handle it to anyone's experience ?
Thank you. I am learning much from your comments and information.

Thanks to your answers .... The procedure is below. I've had to hand type it in, so typos are my mistakes.
The procedure compiles . When there is data to be found, I get the DBSM_OUTPUT lines of code ....
msg_read is Y
sql_error is 0
row_count is 1
p_vol_id is 880091
When I enter in a file name that does not return ANY rows back I will get the msg_read
DBMS_OUTPUT line
msg_read is Y
Call completed.
It doesn't show any 0 for sqlcode or sql%rowcount
The original author used the Ingres return codes as input to process the rest of the code...
It seems like oracle bounces the procedure once there are no rows to be found.
I just added this part ....
having an exception in the clause shows that Oracle is bouncing it to the WHEN OTHERS
exception ...
Any ideas of how to get Oracle not to do this ?
I am trying to keep things simple, and all I am testing for is if I get records back the code does things,
if not, I do something else
create or replace procedure userfile(vms_fil_name IN varchar2, msg_read IN Varchar2)
authid current_user
is
p_vms_file_name varchar2(255);
p_vol_id varchar2(255);
p_orig_id varchar2(255);
p_incoming_message varchar2(255);
sql_error number;
n_count number;
begin
p_vms_fil_nam :=vms_fil_nam;
DBMS_OUTPUT.PUT_LINE ('msg read is '|| msg_read); >> verify incoming parameter
IF (msg_read ='Y')
then
select vol_id,
orig_id,
incoming_message
into p_vol_id,
p_orig_id,
p_incoming_message
from
table one_table a
where
a.vms_fil_nam = p.vms_fil_nam
and incoming_msg ='I';
n_count :='sql%rowcount';
sql_error :='sqlcode;
DBMS_OUTPUT.PUT_LINE ('row count is '|| n_count);
DBMS_OUTPUT.PUT_LINE ('sql_error is '|| sql_error);
DBMS_OUTPUT.PUT_LINE ('p_vol_id is '|| p_vol_id);
end if;
exception >>>> just added this part as the last test....
when others
DBMS_OUTPUT.PUT_LINE ('other condition has been met');
end;
call userfile ('GEORGE','Y');

Similar Messages

  • Avoid procedure or function calls between a SQL operation and an implicit cursor test

    when i analyse this code with code expert

    atpidgeon wrote:
    when i analyse this code with code expert
                            UPDATE P_PM_CONTROL_COUNT
                            SET AVAIL_SEG = AVAIL_SEG -1,
                                ALLOCATION = ALLOCATION -1
                            WHERE PM_UNIT_TYPE_ID = vrectab(1)
                            AND USAGE_DATE = vrectab(2)
                            AND SEGMENT_CODE = vrectab(5)
                            AND ALLOCATION - UNITS_RESERVED > 0;
                            IF sql%rowcount = 0 then --Added block and exception to prevent invetory going negative when placing multi units in same unit type out of service.
                                vErrMsg := 'Could not process your out of service request because your selection for unit '|| vrectab(3) || ' at ' || pvPropertyId || ' for ' || vrectab(2) || ' would cause segment ' || vrectab(5) || ' to be over allocated.';
                                RAISE SegOverAllocated;
                            END IF;
    i get "Avoid procedure or function calls between a SQL operation and an implicit cursor test.",as far has i know
    iff you're doing a sql%rowcount    after an update.. trying to see how many rows were updated...  you dont want procedure or function calls between the update and the sql% line
    correct me if im wrong and how would i fix it?or maybe i shouldnt
    You correct it by NOT executing function calls as part of the UPDATE statement.
    1. Issue the function calls BEFORE the update statement
    2. save the function results into variables
    3. use those variables in the UPDATE statement.
    v_rectab1 := vrectab(1);
    v_rectab2 := vrectab(21);
    v_rectab5 := vrectab(5);
    UPDATE P_PM_CONTROL_COUNT 
                            SET AVAIL_SEG = AVAIL_SEG -1,
                                ALLOCATION = ALLOCATION -1
                            WHERE PM_UNIT_TYPE_ID = v_rectab1
                            AND USAGE_DATE = v_rectab2
                            AND SEGMENT_CODE = v_rectab5
                            AND ALLOCATION - UNITS_RESERVED > 0;

  • [svn:bz-trunk] 16330: QA: Yes - Ran test locally and it was failing but tested condition was true - there is no services-config .xml file

    Revision: 16330
    Revision: 16330
    Author:   [email protected]
    Date:     2010-05-26 07:55:41 -0700 (Wed, 26 May 2010)
    Log Message:
    QA: Yes - Ran test locally and it was failing but tested condition was true - there is no services-config.xml file
    Doc: No
    Checkintests: NA
    Details: Updated expected error message to match current error.
    Modified Paths:
        blazeds/trunk/qa/apps/qa-regress/testsuites/config/tests/NoServicesConfigFileTest/error.t xt

    I have uploaded detail.txt at below url.
    http://m.uploadedit.com/b041/1413264342685.txt
    Hi Mahesh,
    According to log file, I find the message ‘The setup100.exe.config file was not found, therefore the DTSWizard and SQLWatson app config files were not replaced’. It seems that the SQL Server setup file is not complete. Please check that if the SQL Server
    setup file is corrupted, if it is corrupted, please download it again and reinstall SQL Server 2008 R2.
    However, if there’s no problem with the setup file, please check that if there is third-party software such as anti-virus software on your computer blocking the process of SQL Server installation. In addition, make sure that you choose ‘Run as administrator’
    to launch the setup and configure SQL Server service accounts appropriately with administrator permission during the installation.
    For more details about this error, please review the following similar thread.
    http://answers.flyppdevportal.com/categories/sqlserver/sqlsetupandupgrade.aspx?ID=ad794a97-09ae-4aae-9d68-0b06f9af3e16
    Thanks,
    Lydia Zhang

  • SQLCODE and SQLERRM in SQL stmts.

    Hi Everybody,
    I was going through PL/SQL scripts and I came across this description and example:
    DECLARE
    v_ErrorCode logtable.errcode%TYPE;
    v_ErrorMesg logtable.errormesg%TYPE;
    BEGIN
    IF .....
    RAISE e_xyz;
    END IF;
    EXCEPTION
    WHEN e_xyz THEN
    WHEN OTHERS THEN
    v_errorcode = SQLCODE;
    v_errormesg = SQLERRM;
    INSERT INTO logtable
    VALUES(v_ErrorCode, v_ErrorMesg);
    END;
    And the book says that SQLCODE and SQLERRM cannot be used directly in a SQL statement because these functions are procedural.
    Can you please explain how a function can be procedural when we know that there are differences between functions and procedures.
    If SQLCODE and SQLERRM are indeed procedures how can they return values that are assigned to v_ErrorCode and v_ErrorMesg as shown?
    v_errorcode = SQLCODE;
    v_errormesg = SQLERRM;
    Can you please help me out on this?
    Thanking you.

    I "think" what they mean by procedural in this context is simply that the functions are written in a procedural language (e.g. one with control structures and flow).
    This is in contract with SQL which (at it's core) is a set manipulation language with no flow control.
    Hence PL/SQL is Procedural Language/SQL.
    In earlier version of SQL you couldn't reference certain functions (e.g. user defined) in SQL.
    Hope this helps.
    Ken

  • PL/SQL 101 : Cursors and SQL Projection

    PL/SQL 101 : Cursors and SQL Projection
    This is not a question, it's a forum article, in reponse to the number of questions we get regarding a "dynamic number of columns" or "rows to columns"
    There are two integral parts to an SQL Select statement that relate to what data is selected. One is Projection and the other is Selection:-
    Selection is the one that we always recognise and use as it forms the WHERE clause of the select statement, and hence selects which rows of data are queried.
    The other, SQL Projection is the one that is less understood, and the one that this article will help to explain.
    In short, SQL Projection is the collective name for the columns that are Selected and returned from a query.
    So what? Big deal eh? Why do we need to know this?
    The reason for knowing this is that many people are not aware of when SQL projection comes into play when you issue a select statement. So let's take a basic query...
    First create some test data...
    create table proj_test as
      select 1 as id, 1 as rn, 'Fred' as nm from dual union all
      select 1,2,'Bloggs' from dual union all
      select 2,1,'Scott' from dual union all
      select 2,2,'Smith' from dual union all
      select 3,1,'Jim' from dual union all
      select 3,2,'Jones' from dual
    ... and now query that data...
    SQL> select * from proj_test;
             ID         RN NM
             1          1 Fred
             1          2 Bloggs
             2          1 Scott
             2          2 Smith
             3          1 Jim
             3          2 Jones
    6 rows selected.
    OK, so what is that query actually doing?
    To know that we need to consider that all queries are cursors and all cursors are processed in a set manner, roughly speaking...
    1. The cursor is opened
    2. The query is parsed
    3. The query is described to know the projection (what columns are going to be returned, names, datatypes etc.)
    4. Bind variables are bound in
    5. The query is executed to apply the selection and identify the data to be retrieved
    6. A row of data is fetched
    7. The data values from the columns within that row are extracted into the known projection
    8. Step 6 and 7 are repeated until there is no more data or another condition ceases the fetching
    9. The cursor is closed
    The purpose of the projection being determined is so that the internal processing of the cursor can allocate memory etc. ready to fetch the data into. We won't get to see that memory allocation happening easily, but we can see the same query being executed in these steps if we do it programatically using the dbms_sql package...
    CREATE OR REPLACE PROCEDURE process_cursor (p_query in varchar2) IS
      v_sql       varchar2(32767) := p_query;
      v_cursor    number;            -- A cursor is a handle (numeric identifier) to the query
      col_cnt     integer;
      v_n_val     number;            -- numeric type to fetch data into
      v_v_val     varchar2(20);      -- varchar type to fetch data into
      v_d_val     date;              -- date type to fetch data into
      rec_tab     dbms_sql.desc_tab; -- table structure to hold sql projection info
      dummy       number;
      v_ret       number;            -- number of rows returned
      v_finaltxt  varchar2(100);
      col_num     number;
    BEGIN
      -- 1. Open the cursor
      dbms_output.put_line('1 - Opening Cursor');
      v_cursor := dbms_sql.open_cursor;
      -- 2. Parse the cursor
      dbms_output.put_line('2 - Parsing the query');
      dbms_sql.parse(v_cursor, v_sql, dbms_sql.NATIVE);
      -- 3. Describe the query
      -- Note: The query has been described internally when it was parsed, but we can look at
      --       that description...
      -- Fetch the description into a structure we can read, returning the count of columns that has been projected
      dbms_output.put_line('3 - Describing the query');
      dbms_sql.describe_columns(v_cursor, col_cnt, rec_tab);
      -- Use that description to define local datatypes into which we want to fetch our values
      -- Note: This only defines the types, it doesn't fetch any data and whilst we can also
      --       determine the size of the columns we'll just use some fixed sizes for this example
      dbms_output.put_line(chr(10)||'3a - SQL Projection:-');
      for j in 1..col_cnt
      loop
        v_finaltxt := 'Column Name: '||rpad(upper(rec_tab(j).col_name),30,' ');
        case rec_tab(j).col_type
          -- if the type of column is varchar2, bind that to our varchar2 variable
          when 1 then
            dbms_sql.define_column(v_cursor,j,v_v_val,20);
            v_finaltxt := v_finaltxt||' Datatype: Varchar2';
          -- if the type of the column is number, bind that to our number variable
          when 2 then
            dbms_sql.define_column(v_cursor,j,v_n_val);
            v_finaltxt := v_finaltxt||' Datatype: Number';
          -- if the type of the column is date, bind that to our date variable
          when 12 then
            dbms_sql.define_column(v_cursor,j,v_d_val);
            v_finaltxt := v_finaltxt||' Datatype: Date';
          -- ...Other types can be added as necessary...
        else
          -- All other types we'll assume are varchar2 compatible (implicitly converted)
          dbms_sql.DEFINE_COLUMN(v_cursor,j,v_v_val,2000);
          v_finaltxt := v_finaltxt||' Datatype: Varchar2 (implicit)';
        end case;
        dbms_output.put_line(v_finaltxt);
      end loop;
      -- 4. Bind variables
      dbms_output.put_line(chr(10)||'4 - Binding in values');
      null; -- we have no values to bind in for our test
      -- 5. Execute the query to make it identify the data on the database (Selection)
      -- Note: This doesn't fetch any data, it just identifies what data is required.
      dbms_output.put_line('5 - Executing the query');
      dummy := dbms_sql.execute(v_cursor);
      -- 6.,7.,8. Fetch the rows of data...
      dbms_output.put_line(chr(10)||'6,7 and 8 Fetching Data:-');
      loop
        -- 6. Fetch next row of data
        v_ret := dbms_sql.fetch_rows(v_cursor);
        -- If the fetch returned no row then exit the loop
        exit when v_ret = 0;
        -- 7. Extract the values from the row
        v_finaltxt := null;
        -- loop through each of the Projected columns
        for j in 1..col_cnt
        loop
          case rec_tab(j).col_type
            -- if it's a varchar2 column
            when 1 then
              -- read the value into our varchar2 variable
              dbms_sql.column_value(v_cursor,j,v_v_val);
              v_finaltxt := ltrim(v_finaltxt||','||rpad(v_v_val,20,' '),',');
            -- if it's a number column
            when 2 then
              -- read the value into our number variable
              dbms_sql.column_value(v_cursor,j,v_n_val);
              v_finaltxt := ltrim(v_finaltxt||','||to_char(v_n_val,'fm999999'),',');
            -- if it's a date column
            when 12 then
              -- read the value into our date variable
              dbms_sql.column_value(v_cursor,j,v_d_val);
              v_finaltxt := ltrim(v_finaltxt||','||to_char(v_d_val,'DD/MM/YYYY HH24:MI:SS'),',');
          else
            -- read the value into our varchar2 variable (assumes it can be implicitly converted)
            dbms_sql.column_value(v_cursor,j,v_v_val);
            v_finaltxt := ltrim(v_finaltxt||',"'||rpad(v_v_val,20,' ')||'"',',');
          end case;
        end loop;
        dbms_output.put_line(v_finaltxt);
        -- 8. Loop to fetch next row
      end loop;
      -- 9. Close the cursor
      dbms_output.put_line(chr(10)||'9 - Closing the cursor');
      dbms_sql.close_cursor(v_cursor);
    END;
    SQL> exec process_cursor('select * from proj_test');
    1 - Opening Cursor
    2 - Parsing the query
    3 - Describing the query
    3a - SQL Projection:-
    Column Name: ID                             Datatype: Number
    Column Name: RN                             Datatype: Number
    Column Name: NM                             Datatype: Varchar2
    4 - Binding in values
    5 - Executing the query
    6,7 and 8 Fetching Data:-
    1     ,1     ,Fred
    1     ,2     ,Bloggs
    2     ,1     ,Scott
    2     ,2     ,Smith
    3     ,1     ,Jim
    3     ,2     ,Jones
    1     ,3     ,Freddy
    1     ,4     ,Fud
    9 - Closing the cursor
    PL/SQL procedure successfully completed.
    So, what's really the point in knowing when SQL Projection occurs in a query?
    Well, we get many questions asking "How do I convert rows to columns?" (otherwise known as a pivot) or questions like "How can I get the data back from a dynamic query with different columns?"
    Let's look at a regular pivot. We would normally do something like...
    SQL> select id
      2        ,max(decode(rn,1,nm)) as nm_1
      3        ,max(decode(rn,2,nm)) as nm_2
      4  from proj_test
      5  group by id
      6  /
            ID NM_1   NM_2
             1 Fred   Bloggs
             2 Scott  Smith
             3 Jim    Jones
    (or, in 11g, use the new PIVOT statement)
    but many of these questioners don't understand it when they say their issue is that, they have an unknown number of rows and don't know how many columns it will have, and they are told that you can't do that in a single SQL statement. e.g.
    SQL> insert into proj_test (id, rn, nm) values (1,3,'Freddy');
    1 row created.
    SQL> select id
      2        ,max(decode(rn,1,nm)) as nm_1
      3        ,max(decode(rn,2,nm)) as nm_2
      4  from proj_test
      5  group by id
      6  /
            ID NM_1   NM_2
             1 Fred   Bloggs
             2 Scott  Smith
             3 Jim    Jones
    ... it's not giving us this 3rd entry as a new column and we can only get that by writing the expected columns into the query, but then what if more columns are added after that etc.
    If we look back at the steps of a cursor we see again that the description and projection of what columns are returned by a query happens before any data is fetched back.
    Because of this, it's not possible to have the query return back a number of columns that are based on the data itself, as no data has been fetched at the point the projection is required.
    So, what is the answer to getting an unknown number of columns in the output?
    1) The most obvious answer is, don't use SQL to try and pivot your data. Pivoting of data is more of a reporting requirement and most reporting tools include the ability to pivot data either as part of the initial report generation or on-the-fly at the users request. The main point about using the reporting tools is that they query the data first and then the pivoting is simply a case of manipulating the display of those results, which can be dynamically determined by the reporting tool based on what data there is.
    2) The other answer is to write dynamic SQL. Because you're not going to know the number of columns, this isn't just a simple case of building up a SQL query as a string and passing it to the EXECUTE IMMEDIATE command within PL/SQL, because you won't have a suitable structure to read the results back into as those structures must have a known number of variables for each of the columns at design time, before the data is know. As such, inside PL/SQL code, you would have to use the DBMS_SQL package, just like in the code above that showed the workings of a cursor, as the columns there are referenced by position rather than name, and you have to deal with each column seperately. What you do with each column is up to you... store them in an array/collection, process them as you get them, or whatever. They key thing though with doing this is that, just like the reporting tools, you would need to process the data first to determine what your SQL projection is, before you execute the query to fetch the data in the format you want e.g.
    create or replace procedure dyn_pivot is
      v_sql varchar2(32767);
      -- cursor to find out the maximum number of projected columns required
      -- by looking at the data
      cursor cur_proj_test is
        select distinct rn
        from   proj_test
        order by rn;
    begin
      v_sql := 'select id';
      for i in cur_proj_test
      loop
        -- dynamically add to the projection for the query
        v_sql := v_sql||',max(decode(rn,'||i.rn||',nm)) as nm_'||i.rn;
      end loop;
      v_sql := v_sql||' from proj_test group by id order by id';
      dbms_output.put_line('Dynamic SQL Statement:-'||chr(10)||v_sql||chr(10)||chr(10));
      -- call our DBMS_SQL procedure to process the query with it's dynamic projection
      process_cursor(v_sql);
    end;
    SQL> exec dyn_pivot;
    Dynamic SQL Statement:-
    select id,max(decode(rn,1,nm)) as nm_1,max(decode(rn,2,nm)) as nm_2,max(decode(rn,3,nm)) as nm_3 from proj_test group by id order by id
    1 - Opening Cursor
    2 - Parsing the query
    3 - Describing the query
    3a - SQL Projection:-
    Column Name: ID                             Datatype: Number
    Column Name: NM_1                           Datatype: Varchar2
    Column Name: NM_2                           Datatype: Varchar2
    Column Name: NM_3                           Datatype: Varchar2
    4 - Binding in values
    5 - Executing the query
    6,7 and 8 Fetching Data:-
    1     ,Fred                ,Bloggs              ,Freddy
    2     ,Scott               ,Smith               ,
    3     ,Jim                 ,Jones               ,
    9 - Closing the cursor
    PL/SQL procedure successfully completed.
    ... and if more data is added ...
    SQL> insert into proj_test (id, rn, nm) values (1,4,'Fud');
    1 row created.
    SQL> exec dyn_pivot;
    Dynamic SQL Statement:-
    select id,max(decode(rn,1,nm)) as nm_1,max(decode(rn,2,nm)) as nm_2,max(decode(rn,3,nm)) as nm_3,max(decode(rn,4,nm)) as nm_4 from proj_test group by id order by id
    1 - Opening Cursor
    2 - Parsing the query
    3 - Describing the query
    3a - SQL Projection:-
    Column Name: ID                             Datatype: Number
    Column Name: NM_1                           Datatype: Varchar2
    Column Name: NM_2                           Datatype: Varchar2
    Column Name: NM_3                           Datatype: Varchar2
    Column Name: NM_4                           Datatype: Varchar2
    4 - Binding in values
    5 - Executing the query
    6,7 and 8 Fetching Data:-
    1     ,Fred                ,Bloggs              ,Freddy              ,Fud
    2     ,Scott               ,Smith               ,                    ,
    3     ,Jim                 ,Jones               ,                    ,
    9 - Closing the cursor
    PL/SQL procedure successfully completed.
    Of course there are other methods, using dynamically generated scripts etc. (see Re: 4. How do I convert rows to columns?), but the above simply demonstrates that:-
    a) having a dynamic projection requires two passes of the data; one to dynamically generate the query and another to actually query the data,
    b) it is not a good idea in most cases as it requires code to handle the results dynamically rather than being able to simply query directly into a known structure or variables, and
    c) a simple SQL statement cannot have a dynamic projection.
    Most importantly, dynamic queries prevent validation of your queries at the time your code is compiled, so the compiler can't check that the column names are correct or the tables names, or that the actual syntax of the generated query is correct. This only happens at run-time, and depending upon the complexity of your dynamic query, some problems may only be experienced under certain conditions. In effect you are writing queries that are harder to validate and could potentially have bugs in them that would are not apparent until they get to a run time environment. Dynamic queries can also introduce the possibility of SQL injection (a potential security risk), especially if a user is supplying a string value into the query from an interface.
    To summarise:-
    The projection of an SQL statement must be known by the SQL engine before any data is fetched, so don't expect SQL to magically create columns on-the-fly based on the data it's retrieving back; and, if you find yourself thinking of using dynamic SQL to get around it, just take a step back and see if what you are trying to achieve may be better done elsewhere, such as in a reporting tool or the user interface.
    Other articles in the PL/SQL 101 series:-
    PL/SQL 101 : Understanding Ref Cursors
    PL/SQL 101 : Exception Handling

    excellent article. However there is one thing which is slightly erroneous. You don't need a type to be declared in the database to fetch the data, but you do need to declare a type;
    here is one of my unit test scripts that does just that.
    DECLARE
    PN_CARDAPPL_ID NUMBER;
    v_Return Cci_Standard.ref_cursor;
    type getcardapplattrval_recordtype
    Is record
    (cardappl_id ci_cardapplattrvalue.cardappl_ID%TYPE,
    tag ci_cardapplattrvalue.tag%TYPE,
    value ci_cardapplattrvalue.value%TYPE
    getcardapplattrvalue_record getcardapplattrval_recordtype;
    BEGIN
    PN_CARDAPPL_ID := 1; --value must be supplied
    v_Return := CCI_GETCUSTCARD.GETCARDAPPLATTRVALUE(
    PN_CARDAPPL_ID => PN_CARDAPPL_ID
    loop
    fetch v_return
    into getcardapplattrvalue_record;
    dbms_output.put_line('Cardappl_id=>'||getcardapplattrvalue_record.cardappl_id);
    dbms_output.put_line('Tag =>'||getcardapplattrvalue_record.tag);
    dbms_output.put_line('Value =>'||getcardapplattrvalue_record.value);
    exit when v_Return%NOTFOUND;
    end loop;
    END;

  • SQl%rowcount problem

    i have created a function, in pl/sql to check the diffrence betwenn 2 similar tables having same columns . if it has diffrence tha is if select query returns row then it shoul go in error log table but this is not happening could you solve my problem.
    thanks in advance
    CREATE OR REPLACE FUNCTION CAL_BETWEEN_TABLES(
    source_name IN VARCHAR2,
    target_name IN VARCHAR2)
    RETURN number
    IS
    v_success CONSTANT NUMBER := 0;
    v_failure CONSTANT NUMBER := -1;
    V_SQL VARCHAR2(10000);
    v_rows_processed NUMBER :=0;
    p_err_modul error_logs.err_modul%TYPE := 'NULL';
    p_err_function error_logs.err_function%TYPE := ' CAL_BETWEEN_TABLES';
    p_err_type error_logs.err_type%TYPE := 'SN';
    BEGIN
    V_SQL:= 'SELECT * from '||source_name||' minus select * from '||target_name||'';
    v_rows_processed:=sql%rowcount;
    IF v_rows_processed>0
    THEN
         p_err.insert_error(p_err_modul,
    p_err_function,
    p_err_type,
    SQLCODE,
    USER,
    'Failed in the function CAL_BETWEEN_TABLES' ||
    SQLERRM);
    RETURN(v_failure);
    --dbms_output.put_line('failure');
    ELSE
    RETURN(v_success);
    --dbms_output.put_line('success');
    END IF;
    END CAL_BETWEEN_TABLES;

    You are missing EXECUTE IMMEDIATE or it is cut and paste problem. also
    Declare variable
    v_row source_name%rowtype;
    V_SQL:= 'SELECT * from '||source_name||' minus select * from '||target_name||'';
    EXECUTE IMMEDIATE v_sql INTO v_row;
    v_rows_processed:=sql%rowcount;
    HTH

  • SQL Server Unit Tests

    Hi SQL Server Experts,
    About SQL Server Unit Tests (vide
    http://msdn.microsoft.com/en-us/library/jj851203(v=vs.103).aspx), please help with inputs on pros and cons of SQL Server Unit Tests. Any ideal recommendation?
    Thanks

    Blog on the topic: "Database unit testing is used for feature testing of your individual modules (stored procedures, triggers or user defined functions) that is to say your module performs as expected.  Apart from that, it is also used to ensure that
    subsequent changes to the module does not break any functionality.
    At first glace, it looks like this would add overhead to create vs. doing adhoc testing, but Visual Studio lets you automatically generate T-SQL code stubs to test the database object which you can customize as per your need.
    Visual Studio provides Database Unit Test Designer which you can write/define T-SQL scripts (also insert SQL assertion in this code) that calls your module and then evaluates the execution result against the different test conditions which indicates your
    modules execution success or failure."
    LINK:
    SQL Server Unit Testing with Visual Studio 2010
    >Please pardon my ignorance as I am coming back to SQL Server after a brief gap.
    You may have to brush up with T-SQL prior to using a sophisticated tool like this:
    http://www.sqlusa.com/bestpractices/
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Design & Programming
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • Modes and Methods in Tag Query and SQL Query

    Hi,
    Can someone explain me about the modes available in <b>TAG Query and SQL Query.</b>
    TAG Query has modes such as <b>Current, CurrentWrite, GroupList, History, HistoryEvent, ModeList, Statistics and TagList</b>
    SQL Query i still have doubt on <b>FixedQuery with output , Modelist and TableList</b>
    I also need to know why methods are used?
    Thanks in advance
    Regards
    Muzammil

    I'll try to  explain to the best of my knowledge :
    <u><b>TagQuery</b></u>
    <b>Current</b> : Gives you the current value of the Tag you are reading.
    <b>CurrentWrite</b> : Let you write a Value as the Current Value of the Tag.
    <b>GroupList</b> : Generally Tags are grouped under different groups. Returns you the name of the Groups.
    <b>From the xMII Help Document :</b>
    <b>History</b> : History Mode returns interpolated data.  Interpolation can be accomplished by specifying either the # of rows desired or the retrieval resolution.  If the mode is "History" and a value is provided for the Resolution parameter (which is in seconds), the connector will retrieve evenly-spaced values starting at the beginning of the time interval, up to the maximum # of rows specified in the RowCount parameter.  If no value is provided for the Resolution parameter, the connector will return an evenly-spaced number of values based on the value of the RowCount parameter.
    For example, if the time interval is 1 hour, Resolution is 15, and RowCount is 240, the connector will return evenly spaced values each 15 seconds, up to 240 values (which would span the entire hour).
    If the time interval is 1 hour, Resolution is not provided or is set to zero, and RowCount is 120, the connector would return 120 evenly spaced values, at an effective interval of 30 seconds.
    <b>HistoryEvent Mode</b> : The connector can provide historical values "as they were stored" the database.  This mode provides no interpolation of values.
    <b>Statistics Mode</b> : When retrieving data for statistical calculations, the connector utilizes the same techniques as in the "HistoryEvent"  mode.  It is important to note that the first two returning columns in the HistoryEvent query must be the timestamp and the value, in that order.  The SAP xMII Statistical processor expects that order, or errors will occur.  This ensures precision of statistical measurements, particularly time-weighted average, by using the exact storage time and values from the historical database.  The SAP xMII system provides the statistical calculations.
    <b>Modelist</b> : Basically returns the modes of the Query Available. The Data returned is same as the data in the Modes list in the Quert Template Editor.
    <b>Taglist</b> : Returns all the Tags in the Datasource.
    <u><b>SQL Query</b></u>
    <b>Modelist</b> : Same as above.
    <b>TableList</b> : List of all the tables in the database to which the connector connects.
    Again from SAP xMII Help Documentation :
    <b>FixedQueryWithOutput</b> : This mode is used to execute an Oracle stored procedure or function that returns a REF CURSOR as output.  The position of the REF CURSOR is marked by a "?" in the query.  For example:
    <b>Create a table.</b>
    <i>create table usage (id int, name varchar(50));
    insert into usage (id, name) values (1, 'test1');
    insert into usage (id, name) values (2, 'test2');
    insert into usage (id, name) values (3, 'test3');
    insert into usage (id, name) values (4, 'test4');
    insert into usage (id, name) values (5, 'test5');
    insert into usage (id, name) values (6, 'test6');
    insert into usage (id, name) values (7, 'test7');
    insert into usage (id, name) values (8, 'test8');</i>
    <b>Define the stored procedure.</b>
    <i>DROP PACKAGE foopkg;
    CREATE PACKAGE foopkg IS
      TYPE cursortype is ref cursor;
      PROCEDURE test (mycursor in out cursortype);
    END foopkg;
    CREATE PACKAGE BODY foopkg IS
      PROCEDURE test (mycursor in out cursortype) AS
      BEGIN
         open mycursor for select * from usage;
      END;
    END foopkg;
    </i>
    Define a query template for calling the stored procedure.  Enter the following in the FixedQuery tab:
    <b>call foopkg.test(?)</b>
    This template returns all rows from the Usage table.

  • FMT and SQL tablibs not recognised in JSF2 xhtml page

    The following xhtml page produces the html source shown below. However I can't get it to process the fmt and sql taglibs correctly. I had this working prior to using xhtml pages. I had a look a the J6EE tutorial (Chapter 6 - Facelets) which mentions all the other tab libraries, but not those two. What are the available alternatives ?
    other.xhtml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:c="http://java.sun.com/jsp/jstl/core"
          xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
          xmlns:sql="http://java.sun.com/jsp/jstl/sql"
          xmlns:fn="http://java.sun.com/jsp/jstl/functions"
          xml:lang="en" lang="en">
    <fmt:setBundle basename="com.j2anywhere.addressbookserver.web.Translations" var="translations" scope="session"/>
    <f:loadBundle basename="com.j2anywhere.addressbookserver.web.Translations" var="faces_translations"/>
    <h:head>
      <meta http-equiv="content-type" content="text/html; charset=utf-8" />
      <c:if test="${pageContext.request.requestURI ne '${pageContext.request.contextPath}/autoLogout.jsf'}">
      <meta http-equiv="refresh" content="1800;url=${pageContext.request.contextPath}/autoLogout.jsf"/>
      </c:if>
      <title><fmt:message key="PageTitle" bundle="${translations}"/></title>
      <script src="${pageContext.request.contextPath}/scripts/common.js" type="text/javascript"></script>
    </h:head>
    <h:body>
      <h1>Other</h1>
      <h:form>
        <h:outputText value="#{faces_translations.Yes}"/>
      </h:form>
      <h:outputText value="#{faces_translations.Yes}"/>
    </h:body>
    </html>
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xmlns:fmt="http://java.sun.com/jsp/jstl/fmt" xmlns:sql="http://java.sun.com/jsp/jstl/sql" xml:lang="en" lang="en">
    <fmt:setBundle basename="com.j2anywhere.addressbookserver.web.Translations" var="translations" scope="session"></fmt:setBundle>
    <head>
      <meta http-equiv="content-type" content="text/html; charset=utf-8" />
      <meta http-equiv="refresh" content="1800;url=/autoLogout.jsf" />
      <title><fmt:message key="PageTitle"></fmt:message></title>
      <script src="/scripts/common.js" type="text/javascript"></script></head><body>
      <h1>Other</h1>
    <form id="j_idt10" name="j_idt10" method="post" action="/other.jsf" enctype="application/x-www-form-urlencoded">
    <input type="hidden" name="j_idt10" value="j_idt10" />
    Yes<input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="-9208139216578266380:-4314993053830858838" autocomplete="off" />
    </form>Yes</body>
    </html>

    okay here's the code for the whole procedure. Some variable names have been changed but it's otherwise the same code:
    DECLARE
    v_total_cost     NUMBER(10,2);
    v_deposit        NUMBER(10,2);
    v_remaining      NUMBER(10,2);
    v_payment_type   varchar2(2);
    v_checkbox       varchar2(4000);
    v_user           varchar2(4000);
    v_bok_paid       varchar2(1);
    v_msg            varchar2(4000);
    BEGIN
    v_total_cost     := :P100_COST;
    v_deposit        := :P100_DEPOSIT;
    v_remaining      := v_total_cost - v_deposit;
    v_payment_type   := :P100_PAYMENT_AMOUNT;
    v_checkbox       := :P100_CHECKBOX;
    v_user           := :APP_USER;
    --wwv_flow.debug('before condition');
    if v_checkbox != '' AND :P100_RADIO = 'CD' THEN
      v_bok_paid := 'Y';
    else
      v_bok_paid := 'N';
    end if;
    --wwv_flow.debug('after condition');
    IF v_payment_type  = 'D' THEN
    :P100_AMOUNT_TO_PAY := :P100_DEPOSIT;
    INSERT INTO SAL_TRANSACTIONS (TRA_BKG_ID, TRA_COST, TRA_TOTAL,TRA_TYPE, TRA_PAID, TRA_PAY_TYPE, TRA_DATE, TRA_MANUAL, TRA_USER)
    VALUES (:P100_BKG_ID, 0, v_deposit, v_payment_type, v_bok_paid, :P100_RADIO, SYSDATE, v_checkbox, v_user);
    INSERT INTO SAL_TRANSACTIONS (TRA_BKG_ID, TRA_COST, TRA_TOTAL,TRA_TYPE, TRA_PAID, TRA_PAY_TYPE, TRA_DATE, TRA_MANUAL, TRA_USER)
    VALUES (:P100_BKG_ID, 0, v_remaining, 'L','N', null, SYSDATE, v_checkbox, v_user);  
    ELSIF v_payment_type  = 'F' THEN
    :P100_AMOUNT_TO_PAY := :P100_COST;
    INSERT INTO SAL_TRANSACTIONS (TRA_BKG_ID, TRA_COST, TRA_TOTAL,TRA_TYPE, TRA_PAID, TRA_PAY_TYPE, TRA_DATE, TRA_MANUAL, TRA_USER)
    VALUES (:P100_BKG_ID, 0, v_total_cost, :P100_PAYMENT_AMOUNT, v_bok_paid, :P100_RADIO, SYSDATE, v_checkbox, v_user);
    END IF;
    :P100_TRANSACTION_FLAG := '1';
    if v_bok_paid = 'Y' then
    v_msg := '<div>Message clipped</div>';
    --send confirmation email
    GLO_CORRESPONDANCE.proc_corr_controller(
    :P100_BOOKING_MEMBER_ID,
    :P100_BKG_ID,
    null,
    v_msg,
    'E',
    'Payment confirmation',
    null
    end if;
    END;Thanks :)

  • Sql Exception on Testing Configuration with SQL Server JDBC driver for XA

    I have a requirement of analyzing the behavior of SQL Server JDBC data sources for XA transactions in our application.We have been using Non-XA drivers for both Oracle and SQL Server as we had no requirement for transactions spanning across multiple databases in past.I have setup and tested the XA driver for Oracle (Oracle Driver (Thin XA) for Instance Connections 9.0.1,9.2.0,10,11) in Weblogic 11g and its working perfectly for transactions spanning across two databases.No when I am trying to configure weblogic 11g R1 for Sql server JDBC driver to support XA transactions with driver details as follows,
    Server:Weblogic 11g R1
    Driver Type: MS Sql Server
    Database Driver :Oracle's MS SQL Server Driver(Type 4 XA) Version:7.0,2000,2005)
    Database:SQL Server 2005(Single Instance)
    and try to create a new data source and select "Test Configuration" and following error is thrown ,
    <Mar 17, 2011 4:49:49 PM GMT+05:30> <Error> <Console> <BEA-240003> <Console encountered the following error java.sql.SQLException: [OWLS][SQLServer JDBC Driver][SQLServer]xa_open (0) returns -3
    at weblogic.jdbc.sqlserverbase.BaseExceptions40.createAppropriateSQLExceptionInstance(Unknown Source)
    at weblogic.jdbc.sqlserverbase.BaseExceptions40.createSQLException(Unknown Source)
    at weblogic.jdbc.sqlserverbase.BaseExceptions.createException(Unknown Source)
    at weblogic.jdbc.sqlserverbase.BaseExceptions.getException(Unknown Source)
    at weblogic.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown Source)
    at weblogic.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown Source)
    at weblogic.jdbc.sqlserver.tds.TDSRPCRequest.processReplyToken(Unknown Source)
    at weblogic.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Source)
    at weblogic.jdbc.sqlserver.SQLServerImplStatement.getNextResultType(Unknown Source)
    at weblogic.jdbc.sqlserverbase.BaseStatement.commonTransitionToState(Unknown Source)
    at weblogic.jdbc.sqlserverbase.BaseStatement.postImplExecute(Unknown Source)
    at weblogic.jdbc.sqlserverbase.BasePreparedStatement.postImplExecute(Unknown Source)
    at weblogic.jdbc.sqlserverbase.BaseStatement.commonExecute(Unknown Source)
    at weblogic.jdbc.sqlserverbase.BaseStatement.executeUpdateInternal(Unknown Source)
    at weblogic.jdbc.sqlserverbase.BasePreparedStatement.executeUpdate(Unknown Source)
    at weblogic.jdbcx.sqlserver.SQLServerImplXAResource.executeXaRpc(Unknown Source)
    at weblogic.jdbcx.sqlserver.SQLServerImplXAResource.executeXaRpc(Unknown Source)
    at weblogic.jdbcx.sqlserver.SQLServerImplXAResource.open(Unknown Source)
    at weblogic.jdbcx.sqlserverbase.BaseXAConnection.init(Unknown Source)
    at weblogic.jdbcx.sqlserverbase.BaseXAConnection40.init(Unknown Source)
    at weblogic.jdbc.sqlserverbase.BaseClassCreatorForJDBC40.createXaConnection(Unknown Source)
    at weblogic.jdbcx.sqlserverbase.BaseXADataSource.getXAConnection(Unknown Source)
    at com.bea.console.utils.jdbc.JDBCUtils.testConnection(JDBCUtils.java:550)
    at com.bea.console.actions.jdbc.datasources.createjdbcdatasource.CreateJDBCDataSource.testConnectionConfiguration(CreateJDBCDataSource.java:450)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.beehive.netui.pageflow.FlowController.invokeActionMethod(FlowController.java:870)
    at org.apache.beehive.netui.pageflow.FlowController.getActionMethodForward(FlowController.java:809)
    at org.apache.beehive.netui.pageflow.FlowController.internalExecute(FlowController.java:478)
    at org.apache.beehive.netui.pageflow.PageFlowController.internalExecute(PageFlowController.java:306)
    at org.apache.beehive.netui.pageflow.FlowController.execute(FlowController.java:336)
    at org.apache.beehive.netui.pageflow.internal.FlowControllerAction.execute(FlowControllerAction.java:52)
    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
    at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.access$201(PageFlowRequestProcessor.java:97)
    at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor$ActionRunner.execute(PageFlowRequestProcessor.java:2044)
    at org.apache.beehive.netui.pageflow.interceptor.action.internal.ActionInterceptors$WrapActionInterceptorChain.continueChain(ActionInterceptors.java:64)
    at org.apache.beehive.netui.pageflow.interceptor.action.ActionInterceptor.wrapAction(ActionInterceptor.java:184)
    at org.apache.beehive.netui.pageflow.interceptor.action.internal.ActionInterceptors$WrapActionInterceptorChain.invoke(ActionInterceptors.java:50)
    at org.apache.beehive.netui.pageflow.interceptor.action.internal.ActionInterceptors$WrapActionInterceptorChain.continueChain(ActionInterceptors.java:58)
    at org.apache.beehive.netui.pageflow.interceptor.action.internal.ActionInterceptors.wrapAction(ActionInterceptors.java:87)
    at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.processActionPerform(PageFlowRequestProcessor.java:2116)
    at com.bea.console.internal.ConsolePageFlowRequestProcessor.processActionPerform(ConsolePageFlowRequestProcessor.java:261)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
    at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.processInternal(PageFlowRequestProcessor.java:556)
    at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.process(PageFlowRequestProcessor.java:853)
    at org.apache.beehive.netui.pageflow.AutoRegisterActionServlet.process(AutoRegisterActionServlet.java:631)
    at org.apache.beehive.netui.pageflow.PageFlowActionServlet.process(PageFlowActionServlet.java:158)
    at com.bea.console.internal.ConsoleActionServlet.process(ConsoleActionServlet.java:256)
    at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
    at com.bea.console.internal.ConsoleActionServlet.doGet(ConsoleActionServlet.java:133)
    at org.apache.beehive.netui.pageflow.PageFlowUtils.strutsLookup(PageFlowUtils.java:1199)
    at com.bea.portlet.adapter.scopedcontent.ScopedContentCommonSupport.executeAction(ScopedContentCommonSupport.java:686)
    at com.bea.portlet.adapter.scopedcontent.ScopedContentCommonSupport.processActionInternal(ScopedContentCommonSupport.java:142)
    at com.bea.portlet.adapter.scopedcontent.PageFlowStubImpl.processAction(PageFlowStubImpl.java:106)
    at com.bea.portlet.adapter.NetuiActionHandler.raiseScopedAction(NetuiActionHandler.java:111)
    at com.bea.netuix.servlets.controls.content.NetuiContent.raiseScopedAction(NetuiContent.java:181)
    at com.bea.netuix.servlets.controls.content.NetuiContent.raiseScopedAction(NetuiContent.java:167)
    at com.bea.netuix.servlets.controls.content.NetuiContent.handlePostbackData(NetuiContent.java:225)
    at com.bea.netuix.nf.ControlLifecycle$2.visit(ControlLifecycle.java:180)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:324)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walk(ControlTreeWalker.java:130)
    at com.bea.netuix.nf.Lifecycle.processLifecycles(Lifecycle.java:395)
    at com.bea.netuix.nf.Lifecycle.processLifecycles(Lifecycle.java:361)
    at com.bea.netuix.nf.Lifecycle.processLifecycles(Lifecycle.java:352)
    at com.bea.netuix.nf.Lifecycle.runInbound(Lifecycle.java:184)
    at com.bea.netuix.nf.Lifecycle.run(Lifecycle.java:159)
    at com.bea.netuix.servlets.manager.UIServlet.runLifecycle(UIServlet.java:388)
    at com.bea.netuix.servlets.manager.UIServlet.doPost(UIServlet.java:258)
    at com.bea.netuix.servlets.manager.UIServlet.service(UIServlet.java:199)
    at com.bea.netuix.servlets.manager.SingleFileServlet.service(SingleFileServlet.java:251)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at com.bea.console.utils.MBeanUtilsInitSingleFileServlet.service(MBeanUtilsInitSingleFileServlet.java:47)
    at weblogic.servlet.AsyncInitServlet.service(AsyncInitServlet.java:130)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3592)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2202)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2108)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1432)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    I followed the instruction in weblogic jdbc drivers guide to configure the JTA Transactions to support XA on SQL Server machine and weblogic server which included,
    1.Copying sqljdbc.dll copied to SQL_Server_Root/bin directory from WL_HOME\server\lib.
    2.Copied instjdbc.sql to sql server machine and executed the script with following output,
    Changed database context to 'master'.
    Msg 3701, Level 11, State 5, Server SQLDB, Procedure sp_dropextendedproc, Line 16
    Cannot drop the procedure 'xp_jdbc_open', because it does not exist or you do not have permission.
    Msg 3701, Level 11, State 5, Server SQLDB, Procedure sp_dropextendedproc, Line 16
    Cannot drop the procedure 'xp_jdbc_open2', because it does not exist or you do not have permission.
    Msg 3701, Level 11, State 5, Server SQLDB, Procedure sp_dropextendedproc, Line 16
    Cannot drop the procedure 'xp_jdbc_close', because it does not exist or you do not have permission.
    Msg 3701, Level 11, State 5, Server SQLDB, Procedure sp_dropextendedproc, Line 16
    Cannot drop the procedure 'xp_jdbc_close2', because it does not exist or you do not have permission.
    Msg 3701, Level 11, State 5, Server SQLDB, Procedure sp_dropextendedproc, Line 16
    Cannot drop the procedure 'xp_jdbc_start', because it does not exist or you do not have permission.
    Msg 3701, Level 11, State 5, Server SQLDB, Procedure sp_dropextendedproc, Line 16
    Cannot drop the procedure 'xp_jdbc_start2', because it does not exist or you do not have permission.
    Msg 3701, Level 11, State 5, Server SQLDB, Procedure sp_dropextendedproc, Line 16
    Cannot drop the procedure 'xp_jdbc_end', because it does not exist or you do not have permission.
    Msg 3701, Level 11, State 5, Server SQLDB, Procedure sp_dropextendedproc, Line 16
    Cannot drop the procedure 'xp_jdbc_end2', because it does not exist or you do not have permission.
    Msg 3701, Level 11, State 5, Server SQLDB, Procedure sp_dropextendedproc, Line 16
    Cannot drop the procedure 'xp_jdbc_prepare', because it does not exist or you do not have permission.
    Msg 3701, Level 11, State 5, Server SQLDB, Procedure sp_dropextendedproc, Line 16
    Cannot drop the procedure 'xp_jdbc_prepare2', because it does not exist or you do not have permission.
    Msg 3701, Level 11, State 5, Server SQLDB, Procedure sp_dropextendedproc, Line 16
    Cannot drop the procedure 'xp_jdbc_commit', because it does not exist or you do not have permission.
    Msg 3701, Level 11, State 5, Server SQLDB, Procedure sp_dropextendedproc, Line 16
    Cannot drop the procedure 'xp_jdbc_commit2', because it does not exist or you do not have permission.
    Msg 3701, Level 11, State 5, Server SQLDB, Procedure sp_dropextendedproc, Line 16
    Cannot drop the procedure 'xp_jdbc_rollback', because it does not exist or you do not have permission.
    Msg 3701, Level 11, State 5, Server SQLDB, Procedure sp_dropextendedproc, Line 16
    Cannot drop the procedure 'xp_jdbc_rollback2', because it does not exist or you do not have permission.
    Msg 3701, Level 11, State 5, Server SQLDB, Procedure sp_dropextendedproc, Line 16
    Cannot drop the procedure 'xp_jdbc_forget', because it does not exist or you do not have permission.
    Msg 3701, Level 11, State 5, Server SQLDB, Procedure sp_dropextendedproc, Line 16
    Cannot drop the procedure 'xp_jdbc_forget2', because it does not exist or you do not have permission.
    Msg 3701, Level 11, State 5, Server SQLDB, Procedure sp_dropextendedproc, Line 16
    Cannot drop the procedure 'xp_jdbc_recover', because it does not exist or you do not have permission.
    Msg 3701, Level 11, State 5, Server SQLDB, Procedure sp_dropextendedproc, Line 16
    Cannot drop the procedure 'xp_jdbc_recover2', because it does not exist or you do not have permission.
    creating JDBC XA procedures
    instxa.sql completed successfully.
    3.Verified that MSDTC service is running on both SQL Server and weblogic machines with XA Transaction enabled and DTC option enabled for both inbound and outbound connections.
    4.Copied sqljdbc.jar (version 3.0 downloaded from msdn portal) to "C:\Oracle\Middleware\wlserver_10.3\server\ext\jdbc\sqlserver" directory and updated weblogic_classpth variable in commEnv.cmd file.
    set WEBLOGIC_CLASSPATH=%JAVA_HOME%\lib\tools.jar;%BEA_HOME%\utils\config\10.3\config-launch.jar;%WL_HOME%\server\lib\weblogic_sp.jar;%WL_HOME%\server\lib\weblogic.jar;%FEATURES_DIR%\weblogic.server.modules_10.3.2.0.jar;%WL_HOME%\server\lib\webservices.jar;%ANT_HOME%/lib/ant-all.jar;%ANT_CONTRIB%/lib/ant-contrib.jar;C:\Oracle\Middleware\wlserver_10.3\server\ext\jdbc\sqlserver\server\ext\jdbc\sqlserver\sqljdbc.jar
    Can some one please provide some input on whats causing this and any other steps needs to be followed to implement XA support using SQL Server JDBC driver.

    You seem to have done everything correctly and diligently. I would ask that you open
    an official support case.

  • SSDT: Creation of localDB instances from project file - Sql Server Unit testing purposes

    I have a SqlServer Database Project in my solution (VS2013 Professional) which has a corresponding test project with some stored procedure unit tests. Currently I am using a LocalDB and as far as I understand a local database instance is created in C:\Users\[User]\AppData\Local\Microsoft\Microsoft
    SQL Server Local DB\Instances\Projects and the specific .mdf file referenced in the SQL Server Object Explorer is in C:\Users\[User]\AppData\Local\Microsoft\VisualStudio\SSDT\[ProjectName]. The unit tests run fine on my local machine which I have developed
    the project on.
    My issue is we have a box which is configured to check out the project file from our version control, build the project using ms build commands and then run the unit tests using VSTest.Console. Usually with C# Test projects we reference the test project
    dll and the unit tests run fine. I have referenced the dll for the test project with the stored procedure unit tests in. 
    With the Stored Procedure unit tests however we get this exception: 
    Initialization method [project].[spTest].TestInitialize threw exception. System.Data.SqlClient.SqlException: System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. The specified LocalDB instance does not exist.
    After some digging I have realised that the localdb instance seems to be created when the project itself is created in VS not when it is built. Specifically when the localdb is first used and if you look into the appData folder of the test machine there
    is no corresponding mdf file for the project.  
    The question is is there a way to set up a localDB instance on the new machine if all you have the project file? The only purpose of the project on the test machine is to run the unit tests, no other development purposes. VS2013 Professional is installed
    on the test machine but a solution only using config file changes or MSBuild/VSTest commands would be preferable.
    I realise you could change the connection string to an actual test database and run the unit tests of that but we quite like the localdb approach for the testing. I also realise that you could potentially transfer the mdf file (haven't tested this solution)
    as well, though I would prefer if there is a solution to my initial question. 
    http://technet.microsoft.com/en-us/library/hh234692.aspx
    http://msdn.microsoft.com/en-us/library/hh309441(v=vs.110).aspx
    I have been reading up on LocalDB and I assume a automatic LocalDB is created when you create a sql server database project (ie on localdb first use). I have tried adding the database creation to the test project config file but do not really know where
    to go from there. The second link does not really specify when the named localdb will be created if you add the config items and I am not even sure if that is an actual solution.  Here's my test project config file for reference
    <configSections>
    <section name="system.data.localdb" type="System.Data.LocalDBConfigurationSection,System.Data,Version=4.0.0.0,Culture=neutral,PublicKeyToken=[PublicKeyToken]"/>
    <section name="SqlUnitTesting_VS2013" type="Microsoft.Data.Tools.Schema.Sql.UnitTesting.Configuration.SqlUnitTestingSection, Microsoft.Data.Tools.Schema.Sql.UnitTesting, Version=12.0.0.0, Culture=neutral, PublicKeyToken=[PublicKeyToken]" />
    </configSections>
    <system.data.localdb>
    <localdbinstances>
    <add name="SimpleUnitTestingDB" version="11.0" />
    </localdbinstances>
    </system.data.localdb>
    <SqlUnitTesting_VS2013>
    <DatabaseDeployment DatabaseProjectFileName="..\..\..\SimpleUnitTestDB\SimpleUnitTestDB.sqlproj"
    Configuration="Release" />
    <DataGeneration ClearDatabase="true" />
    <ExecutionContext Provider="System.Data.SqlClient" ConnectionString="Data Source=(localdb)\Projects;Initial Catalog=SimpleUnitTestDB;Integrated Security=True;Pooling=False;Connect Timeout=30"
    CommandTimeout="30" />
    <PrivilegedContext Provider="System.Data.SqlClient" ConnectionString="Data Source=(localdb)\Projects;Initial Catalog=SimpleUnitTestDB;Integrated Security=True;Pooling=False;Connect Timeout=30"
    CommandTimeout="30" />
    </SqlUnitTesting_VS2013>
    Thanks in advance for any response. Sorry if there is any misunderstanding, while I have been using VS to develop from the start, this is the first time I have used a Sql Server Database Project. 
    Regards,
    Christopher. 

    Yes, you can create a LocalDB instance manually. You use the SqlLocalDb utility, see here:
    http://technet.microsoft.com/en-us/library/hh212961.aspx
    Erland Sommarskog, SQL Server MVP, [email protected]

  • SQL%Rowcount in Forms 9i

    How can I get number of rows which was REALLY updated in database?
    I want to use VPD with select allowed and update restricted policy, so when I update rows from SQL*Plus, I can see if no rows was updated, but when I update the same table from Forms, it says "Transaction complete 5 rows were updated". Requery shows that nothing was changed.
    I want to use something like SQL%RowCount in post-update trigger in forms. Any suggestions?

    Hi guys,
    You could create a Global variable or a Non base table item, from Post-Update keep incrementing the variable. At the end of the commit, you will have how many records were updated. But, keep in mind of resetting the variable back to Zero.
    This is the first thing which struck my mind, does anyone has good idea?
    Regards,
    Momen.

  • How to add multiple test conditions in 'test' attribute expression of xsl:if tag

    Hi all,
    How to add multiple test conditions in 'test' attribute expression of <xsl:if> tag ?
    I have 2 parameters and I want To skip the massage if this 2 conditions happened I tried to write it :
            <xsl:when test="($TransferToCompany = 0 and $ObjectInclide=1 )">
            <b1im_skip xmlns="" info=" Obect Will Not Transfer To company">
            </b1im_skip>
          </xsl:when>
    But I get an error while I am trying to transfer The object (Account) true B1if
    I am working with SBO 9 PL 13
    thank you
    shachar

    Hi saado
    Check this link:
    http://stackoverflow.com/questions/318875/can-you-put-two-conditions-in-an-xslt-test-attribute
    Kind regards,
    Radek

  • SQL%ROWCOUNT problem in Oracle 9i

    We have migrated our application from 8i to 9i. There is a PL/SQL procedure which returns number of rows inserted in the table. In Oracle it was returning correct number of rows but when we have migrated same procedure on Oracle9i it is returning 0 (ZERO) number of records even though procedure inserts successfully more than 100,000 rows in the table. It is used as:
    tmpCount := SQL%ROWCOUNT;
    Is there any change on Oracle9i?

    From MetaLink
    The behaviour you are observing is due to bug 2286387. You can set event 10943 to level 4194304 in your init<SID>.ora to get the old Oracle 8i behaviour.
    NOTE : The new behaviour in which SQL% attributes are affected by commit and rollback will be the DEFAULT behaviour going forward (Oracle 10i) so it is recommended to change the code so that you check the SQL% attrubutes before a commit or rollback.
    The event 10943 will also be removed in the future releases.

  • How can I display SQL%ROWCOUNT in the "Process Success Message"

    Hi all;
    I am trying to display SQL%ROWCOUNT in the "Process Success Message" of a custom update Process.
    Any ideas?

    Chris,
    I assume,
    ORDER_ITEM_LOAD.MERGE_INTELLI_LABS ( in_DEPARTMENT_UID );
    is a package / procedure you call to do something. Change the procedure and add an
    out parameter to it, which will get the
    SQL%ROWCOUNT
    value. Then, call this package like this:
    DECLARE
      in_DEPARTMENT_UID NUMBER;
    BEGIN
      in_DEPARTMENT_UID := :P4_DEPARTMENT_UID;
      ORDER_ITEM_LOAD.MERGE_INTELLI_LABS ( in_DEPARTMENT_UID,  :P4_ROW_COUNT );
    END;Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://htmldb.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

Maybe you are looking for

  • Error While Uploading XDB files in Portal.

    Hi Experts, I have created an adobe forms which consists of Date,Text,NUmeric fields. After saving the same file in xdb format and trying to upload the same file to generate xml in portal, it is throwing error in create callable object --> Upload Def

  • Utilization amount of Higher education cess not appearing in RG23A and RG23

    Dear All We have done Utilization for the month of FEB-08. Now when it check these utilization amount in register RG23A and RG23C part II.The entries for BED and Ecess are apperaing but for HEcess are not appearing. PLA entries for BED,Ecess,HEcess a

  • Webpage size

    Hi I'm starting a very simple web page to display some work. I have a few brief questions that i will ask later, but in starting i was wondering how a web page is measured predominantly the horizontal size. I know that it is usually in pixels but doe

  • Another iPod not showing up problem

    Greetings, I'm having a problem similar to the ones described on here. My iPod 5G is working fine, as is iTunes. The iPod isn't showing up in iTunes or in My Computer though. Before I uninstalled and reinstalled iTunes and the iPod from my computer f

  • What upkeep/housework do I need to do on my Macbook...

    Sorry, not sure what the right term is for it.. Just bought my 1st mac.. getting used to it and loving it. What sort of upkeep do you need to do to it if any.. For example on my pc I was always told its good to run the scan disk scan every now and th