Different results of an store procedure

Hi everyone,
I have a partitioned table (by day of the week) and an store procedure that selects some records from a especific partition (that one that represents "today").
Inside Oracle client I get the result I'm expecting, but when I call the procedure from a java client I get a different result (it searches in another partition).
Any ideas?? if you need some code let me know.
Thanks in advance,
Charlie Garcia.

Well, partitioned by day of the week means the column is declared as?
I'm assuming there's a bind mismatch between the defined value in the table, and what you are passing in to the routine.
So for example, your table is partitioned on a date column and you pass in a string to your stored routine. Then Oracle has to do a conversion for you (if it can) and compare the value you passed in, to the converted value.
for example, if you pass in '01-05-01' as a string, what date would you say that is?
ME_XE?select to_date('01-05-03', 'dd-mm-yy') from dual;
TO_DATE('01-05-03','DD-MM-
01-MAY-2003 12 00:00
1 row selected.
Elapsed: 00:00:00.00
ME_XE?select to_date('01-05-03', 'mm-dd-yy') from dual;
TO_DATE('01-05-03','MM-DD-
05-JAN-2003 12 00:00
1 row selected.
Elapsed: 00:00:00.01
ME_XE?select to_date('01-05-03', 'yy-dd-mm') from dual;
TO_DATE('01-05-03','YY-DD-
05-MAR-2001 12 00:00
1 row selected.

Similar Messages

  • Select   from all_tables inside a procedure brings a different result set

    Hi all,
    There are two cases.. both are the same, but gives different out put.
    CASE 1 pulls few for SYS and all for current user.
    CASE 2 Pulls data for ALL USERS.
    Why the same code in side a procedure brings a different result ?
    SQL>
    --CASE 1
    CREATE OR REPLACE procedure test_t_owner as
    cursor cur1 is select table_name,owner from all_Tables;
    begin
    for rec1 in cur1
    loop
    dbms_output.put_line(rec1.table_name||'--'||rec1.owner);
    end loop;
    end;
    set serveroutpu on;
    exec test_t_owner
    --CASE 2
    Declare
    cursor cur1 is select table_name,owner from all_Tables;
    begin
    for rec1 in cur1
    loop
    dbms_output.put_line(rec1.table_name||'--'||rec1.owner);
    end loop;
    end;
    - regards
    sk

    i create one new user
    create user test identified by test;
    grant connect, select any table to test;
    grant dba to test;according to you then i run the procedure test_t_owner it should be give error
    and i case of AB it should return all rows from all_tables.
    But give output same in but sames.
    Regards
    Singh

  • Map Fields, store procedure results is "Expr1000"

    Hi guys.
    This is my problem.
    I have a sql server 2005 database. In this database i have a store procedure (3100 lines, with temporal tables, unions .. etc).
    When i try to create the report in CR9, i do this :
    1) i'm go to "set datasource location"
    2) select the database
    3) select the store procedure
    4) put some parameters
    5) Accept
    When i want to add the fields to the report ....
    the only results from the SP is a result field called "Expr1000".
    I execute the store in my sql server and this give me all the columns results (174 columns).
    My question is:
    What is the error , that in CR9 i can't see all the columns results , and only i can see "Expr1000".
    Thanks !!!!!
    Pablo Reynoso.

    This is definitely not the solution for everyone but reading this thread made me do a little more checking on my own.
    I too was receiving the "Expr1000" field from the SP when linking it into a new report or even when trying to MAP fields in an existing report template.  In the Map Fields dialog the source SP had no fields displayed for Mapping.
    What I discovered was S.U.E. (stupid user error).  While testing some changes to the source SP I changed the return result from returning data to returning the actual sql code I was constructing in the SP.  I often write the code into a local string variable and then use the 'exec(@str);' command as the final step of the SP.  I changed that code to 'Select @str;' which returned the @str string value when I executed the SP from within SQL Manager - to see the actual sql code.
    I never changed the code back to using the 'exec(@str);' so I was returning a 4,000+ char string from the SP which when loaded into Crystal the SP "field" became "Expr1000".
    After making this little change, returning the data instead of a single LARGE string the report behavior returned to what is was before the testing snafu.
    Hope this helps someone else, at least maybe point them to their code changes and not necessarily the CR template.
    Dave

  • Which is better to use Store Procedure or Views in Crystal Reports ?

    Hi,
    which one is more better to use Store Procedure or Views in Crystal Reports ?
    Thanks.

    It depeneds on the requirement. Well, but from performance point of view as u know that stored procedures are already compiled on DB side, they would be more efficient. Views are handled differently. Here CR has nothing to do with it.
    But if the stored procedure u r using is having 2 Select statements, CR will only display the results from the first select statement. In that case you need to use Views as one can use more than one views in the report and join them.
    Using a Generic view which is created by the DBA for a larger audience will result in performance issues meaning if a View "V" has 25 fields and View is based on 5 tables  and ur report is using only 5 fields which are coming only from 2 tables inside the view,in this case u will end up in joining 3 more tables unnecessarily.
    Hope this helps!

  • Can we pass temporary result set to the  procedure?

    Hi,
    The result set is stored in a temporary storage. Can we pass that resultset to the procedure?
    Thanks and regards
    Gowtham Sen.

    I'm still unclear just what this result set is... Is is a table or a cursor or something else?
    If you imply the physical result set of a SQL query, there is no such thing in Oracle. Oracle does not create and store a result set in memory containing the rows of the SQL SELECT. Creating such sets in memory does not scale. A single SELECT on such a database can kill the performance of the entire database by exhasuting all memory with a single large physical result set.
    Oracle "results" live in the database cache (residing in the SGA). Rows (as data blocks) are paged into and out of this case as demand dictates. When PL/SQL code, for example, fetches a row, the SQL engine grabs the row from the db cache (SGA) and copies it to the PGA (the private memory area of the PL/SQL process). The row also may not yet exist in the db cache - in which case it needs a physical read from disk to get the data block containing that row into the db cache (after which it is copied to the PGA).
    A PL/SQL process can do a bulk fetch - e.g. fetch a 100 rows from the SQL query/cursor at a time. In that case, a 100 rows are copied from the SGA db cache to the PGA.
    At no time is there are single large unique and dedicated memory struct in the SGA that contains the complete "result set" of a SQL query.
    Once you have fetched that row, that is it. Deal is done. You cannot reverse the cursor and fetch the row again. After you have fetched the last row in that cursor, you cannot pass that cursor to another process - the cursor is now empty. That other process cannot rewind the cursor and start fetching from the 1st row again. You will need to pass the SQL to that process in order for it to create its own cursor - also keeping in mind that in between the rows can have changed and that this other process could now see different results with its cursor.
    If you want to create such a physical temporary result set that is consistent and re-usable, you can use a temporary table - and insert the results of the SELECT into this temp table for further processing. This temp table is session specific and is auto destroyed when the session terminates.
    A comment though - it sounds like you're approaching the date warehouse processing (scrubbing, transformation and loading of data) as a row-by-row process.
    That is a flawed approach. Row-by-row processing does not scale. One should deal with data sets. Especially when the volumes are large. One should also attempt to perform minimal passes through a data set. Processing a bunch of rows, then passing that rows to another process to do some processing on the same rows.. this means multiple passes through the same data. That is very inefficient performance and resource wise.

  • Different opertimizer_mode will cause different result( ie. row count).

    Hello expert,
    in my store procedure, I have change "opertimizer_mode" from several times among "rule" and "all_rows". I am wondering for the same statement if using different opertimizer_mode will cause different result for data volume ( such as row count?).
    Many Thanks,

    What version of Oracle?
    The rule hint should probably not be used in or after 10g except in very precise and very limited circumstances which usually involve querying data where no statstics exist - an unlikely event in 10g or 11g. Maybe with collection-to-table CAST() or TABLE() conversions and similar situations.
    The cost-based optimizer is almost always to be preferred to the rule-based optimizer in recent versions because almost all of the useful new features the database implements require it.
    Like BluShadow I wonder what the need to switch between the optimzers could possibly be

  • SQL Server Store Procedure, selecting rows from multiple tables

    i have got a store procedure that is pulling data from one table, now i have got the same data collected in a different table,
    as the IDs are different i cannot put all data from the second table into the first one. so now i have to have two select statements in one store procedure. Although the corresponding data is same but the field names in both table are different. for instance
    BRIEF_TITLE would be briefTitle in the second table. how can i merge the data from two different tables into one. the result is bonded to ASP.net grid view control.

    >> I have a store procedure that is pulling data from one table, now I have got the same data collected in a different table, as the IDs are different I cannot put all data from the second table into the first one. <<
    This is redundancy. The idea of databases even before RDBMS, was to remove redundancy. Oh, columns are not fields. These are basic concepts. 
    >> so now I have to have two select statements in one store procedure. Although the corresponding data is same but the field [sic] names in both table are different.<<
    NO! Where is your data dictionary that assures data elements have one and only one name everywhere in the enterprise!  You are is serious trouble here. The data element names should be universal and used everywhere with the same casing, so that case sensitive
    standards will work. 
    >> for instance BRIEF_TITLE would be briefTitle in the second table.<< 
    The quick kludge is a VIEW with the ISO-11179 names over the camelCase crap
    The moron who did the second table does not know ISO-11179 Standards and missed the research that showed us that camelCase does not work. Your eye is trained to jump to an Uppercase letter since it is the start of a semantic unit (proper name, sentence, paragraph,
    emphasis, etc). When we researched this stuff at AIRMICS, this could add 8-12% to the time to maintain code in large systems. Your eyes twitch! 
    You really need to get your act together with a good text editor/ pretty printer tools. Get a copy of my SQL Programming Style and adapt it to those tools. 
    >> The result is bonded to ASP.net grid view control. <<
    We are the SQL guys; we do not are about the presentation layers :) 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • HOW TO EXECUTE A STORE PROCEDURE THAT RETURN MULTIPLE ROWS FROM A QUERY

    I NEED TO CREATE AND USE A STORE PROCEDURE THAT IS GOING TO DO A SELECT STATEMENT AN THE RESULT OF THE SELECT STATEMENT IS RETURN IN SOME WAY TO THE REQUESTER.
    THIS CALL IS MADE BY AN EXTERNAL LANGUAGE, NOT PL/SQL OR FORMS APPLICATION. USING FOR EXAMPLE ODBC AND VISUAL BASIC. WHAT I NEED TO DO IS ADD A DATA ACCESS LAYER TO MY APPLICATION AND I ALREADY HAVE IT DONE FOR MS SQL SERVER, BUT I NEED THE SAME FUNCTIONALITY ACCESSING AN ORACLE DATABASE.
    FLOW:
    1. VB CREATE A ODBC CONNECTION TO A ORACLE DATABASE
    2. VB EXECUTE A STORE PROCEDURE
    3. THE STORE PROCEDURE RETURNS TO THE VB APPLICATION THE RESULT OF THE QUERY THAT IS INSIDE OF THE STORE PROCEDURE.(I.E. THE STORE PROCEDURE IS A BASIC SELECT, NOTHING COMPLEX)
    4. VB DISPLAY THE RESULT IN A GRID
    FOR SURE I CAN DO THE SELECT DIRECTLY TO ORACLE, BUT FOR PERFORMANCE REASONS AND SCALABILITY, I'LL LIKE IT TO DO IT USING A STORE PROCUDURES
    IS THIS POSIBLE?, HOW?
    THANKS

    Certainly, it's possible. First, define a stored procedure that includes an OUT parameter which is a REF CURSOR. Then, call the stored procedure via ODBC omitting the OUT parameter from the list of parameters. IT will automatically be returned as a result set. Syntax for both is below...
    CREATE PROCEDURE foo (inParam in varchar2, resultSet OUT REF CURSOR )
    In ODBC:
    {call foo( 'someData' )}
    Justin

  • Select all values from Rule in Store Procedure

    Hi
    I have a rule like this
    CREATE RULE [dbo].[Rle_Currency_Lst]
    AS
    @List IN
    ('PKR','USD')
    GO
    Now i want to make simple "Currency List" report for which i need to select values from above rule in Store Procedure which i will use in SSRS to fill my report.
    Please help
    Zubair Afridi | Please mark as answered or vote helpful if this post help resolved your issue. Thanks!

    One way to get the values.
    declare @definition nvarchar(max);
    select @definition = m.definition
    from sys.objects o
    inner join sys.sql_modules m on o.object_id = m.object_id
    where schema_name(o.schema_id) = 'dbo' and o.name = 'Rle_Currency_Lst';
    set @definition = SUBSTRING(@definition, CHARINDEX('''', @definition), LEN(@definition));
    set @definition = LEFT(@definition, CHARINDEX(')', @definition) - 1);
    declare @myXML AS XML;
    set @myXML = N'<H><r>' + REPLACE(SUBSTRING(@definition, CHARINDEX('''', @definition), LEN(@definition)), ',', '</r><r>') + '</r></H>'
    declare @result table(myvalues nvarchar(100));
    insert @result(myvalues)
    SELECT Vals.id.value('.', 'NVARCHAR(100)') AS val
    FROM @myXML.nodes('/H/r') AS Vals(id)
    update @result set myvalues = REPLACE(myvalues, '''', '');
    select * from @result;
    Note that rules is a deprecated feature and will be removed in a future version of SQL Server.  The replacement for rules is CHECK CONSTRAINTS.  You may well want to consider a plan to migrate your current rules to check constraints.
    Tom

  • Error when run crystal report with store procedure in JSP

    I try to run report which is developed by crystal report XI and store procedure (SQL 2005) with JSP.
    But it occurs error that is "com.crystaldecisions.reports.reportengineinterface.JPEReportSource - failed to process getPage request: No results were returned by the query."
    How can I do for solving this problem? Pls, help me !!!!!
    (In other report which is not used store procedure I can run fine.)
    Message was edited by:
    Bonds_Identity

    What version of CR are you using?
    What CR updates are you using?
    See sample apps here:
    https://wiki.sdn.sap.com/wiki/display/BOBJ/CrystalReportsfor.NETSDK+Samples
    in particular check out vbnet_win_pass_dataset_main_sub.zip
    The [Crystal Reports for Visual Studio 2005 Walkthroughs|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/2081b4d9-6864-2b10-f49d-918baefc7a23] will also be good to look at.
    Ludek
    Follow us on Twitter
    http://twitter.com/SAPCRNetSup

  • Store procedure call to fetch data in JDBC sender adapter

    Hi guys,
    I have to fetch data from a Oracle server through JDBC adpater.
    the partner has in place some store procedure that have to be used with this purpose.
    But al the time I try to call a store procedure I got error that variables are not binded.
    I fill up the query sql statement field with following text
    call <store procedure name> (v1 OUT VARCHAR2, v2 in varchar2)
    Does anyone know the syntax to access such store procedure within jdbc adapter?
    As far as I know the jdbc call the store procedure with Callable statement but the paremeters need to be linked to datatype,but here I do not see such possibility.

    HI
    A stored procedure is a subroutine available to applications accessing a relational database system. Stored procedures (sometimes called a sproc or SP) are actually stored in the database data dictionary.
    Typical uses for stored procedures include data validation (integrated into the database) or access control mechanisms. Furthermore, stored procedures are used to consolidate and centralize logic that was originally implemented in applications. Large or complex processing that might require the execution of several SQL statements is moved into stored procedures and all applications call the procedures only.
    Stored procedures are similar to user-defined functions (UDFs). The major difference is that UDFs can be used like any other expression within SQL statements, whereas stored procedures must be invoked using the CALL statement
    Stored procedures can return result sets, i.e. the results of a SELECT statement. Such result sets can be processed using cursors by other stored procedures by associating a result set locator, or by applications. Stored procedures may also contain declared variables for processing data and cursors that allow it to loop through multiple rows in a table. The standard Structured Query Language provides IF, WHILE, LOOP, REPEAT, CASE statements, and more. Stored procedures can receive variables, return results or modify variables and return them, depending on how and where the variable is declared.
    http://help.sap.com/saphelp_nw04/helpdata/en/1d/756b3c0d592c7fe10000000a11405a/content.htm
    One of the usage is to prevent the query to directly write to the database
    http://en.wikipedia.org/wiki/Stored_procedure
    Check these:
    http://help.sap.com/saphelp_nw04s/helpdata/en/b0/676b3c255b1475e10000000a114084/frameset.htm
    http://help.sap.com/saphelp_nw04s/helpdata/en/4d/8c103e05df2e4b95cbcc68fed61705/frameset.htm
    Integration with Databases made easy – Part 1.
    JDBC Stored Procedures
    http://help.sap.com/saphelp_nw04/helpdata/en/45/023c41325fa831e10000000a1550b0/frameset.htm
    Calling stored procs in MaxDb using SAP Xi
    cheers

  • How to call a Store Procedure with IN PARAMETER

    Hi, im new using Oracle 10G with Oracle SQL Developer, my cuestion is how to call a Store Procedure with IN PARAMETER, I tried the following without results
    SELECT * FROM procedure_name(parameter);
    PROCEDURE procedure_name(parameter);
    EXEC procedure_name(parameter);
    CALL procedure_name(parameter);
    Please help me....

    Hi,
    As Beijing said,
    EXEC procedure_name(parameter);
    CALL procedure_name(parameter);work for me.
    So does
    BEGIN
        procedure_name(parameter);
    END;Can you be more specific about what you're doing? That is, are you testing it in SQL Developer? Where are you entering the commands? Where are you looking for output? Do you get error messages? Does anything else (like "SELECT SYSDATE FROM dual;") work?

  • Solaris 10_u8 upgrade slow down mysql store procedure

    Hi,
    Recently we upgraded the following and found out that MySQL store procedure takes more than 40 times longer to run:
    Old configurations:
    - Hardware T5120
    - Solaris 10_u4 8/7
    - MySQL 5.1.30
    - Primary service domain has 8 ldoms, primary has 4 cpus and 2G mem
    - Ldom mgr 1.0.3
    - Database server sits on LDOM2 with 12 vcpus and 8G mem, two image file disk export from primary, basically the whole 2nd disk raid 1 for LDOM2, one 15G for OS and other 100G for database
    - Store procedure only takes 0.87 seconds to finish
    New configurations:
    - everything is same as above, except I patched the primary to kernel patch 142900-02, then the mysql store procedure in LDOM2 takes about 35 seconds to finish
    I have tried all different kind of combinations, from the above configuration I think there might be some kernel parameters settings changed since the upgrade but not sure what are they. If any one know or has some kind issues please let me know. Any help would be appreciated.
    Thanks!

    Hello.
    Patch 142900-02 is old. You can try install 142909-17. This patch obsolete 142900.
    For rest you can remove patch 142900-02 and check performance.
    Regards.

  • Deski report which is using a Store Procedure - Redirecting connection

    I have a DeskI report which is using a Store Procedure as its data provider.
    This is an Oracle based Store Procedure.
    Where can i see wich connection (connections listed in CMC) is used in DeskI report ?
    How can i redirect one connection to point to another on report?
    Thanks
    Georg

    Marina,
    The strategy for displaying LOV via Infoview needs to be different than what you've set up via DeskI.  The main difference is that when using a client/server program like DeskI, the LOV is cached to the client, thus producing a list more quickly, however, over the web, the web client does not cache LOV as readily.  To "solve" this "problem" you need to go back to your universe and trace what is happening.  If the LOV is getting generated through an essential "select distinct" on the fact/dimension table, and that table has over a million rows, then it will take some time to generate the list (and thus will timeout).  A different strategy to take is to maintain a "backend lookup" table that the LOV will point to instead.  The backend lookup table will contain the unique instances of the column getting scanned and thus when the LOV points to the new lookup table the response will be quicker versus the old method.  Care must be taken each time new data is loaded to WH to ensure that any new unique values from the "home" table/column are also placed in the backend lookup table.
    thanks,
    John

  • Java - Platform Independent, so why different results?

    This isn't a code specific topic, but I hope someone can still help me out with this. I've been developing a bit of code for a Java class that I'm taking, working in a small group with a few friends. I spend an entire weekend pounding out a GUI for this project, and upon completion, test it thoroughly and agressively, absolutely TRYING to get it to crash. Once I'm satisified it's got more safety features than a Volvo, I pass it along to my friend and ask him to play with it a little and see what happens.
    Well, suffice to say he gets COMPLETELY different results. The layout of the GUI is the same, but on his side, when the code executes to remove a JLabel, it removes a couple of others with it. Upon staring at my code for hours, doing handwritten walk-throughs of the code itself, and doing more staring at the code, I can't understand for the life of me what's causing this. On my side, the one JLabel disappears just fine, reappears when the code is executed to restore it. On his side, multiple JLabels disappear, and refuse to reappear.
    I've tried changing it from setting them to disappear to setting them to setText("") and turn white. The same thing happens... multiple JLabels turn white and remove their text.
    The only common denominator I can get out of this is that his machines (he's tested more than one) are all multi-core systems (dual core or quad core), where mine is single core. Even then, I see nothing in the code that even if it were threaded should cause this to happen. The functions are extremely specific. Still, I'll confess to not knowing a THING about threading, could this have something to do with it? I can post some code if that would help, but there's quite a bit of it...

    I don't currently have my code available, but I've got a pseudocode outline of what's supposed to be happening, if that will help any... if not, sorry for just cluttering things up... >_>
    In response to the JLabel array quesiton, I have an X x Y sized grid made of JLabels, dynamically drawn based on user input (how many rows and how many columns they want). While those are in an array, they're not involved in this part of the process...
    The way this works is the project is a simulation of an assembly line on a shop floor. There are four types of mahcines, called BodyAttacher, Painter, InteriorAssembler, Wrapper, and Conveyor. There can only be one BodyAttacher, Painter, InteriorAssember, and Painter. Conveyors are essentially unlimited. There is a JLabel for each of these machines labeled with the name of that machine. Each one is setText to their class name. To ensure the user can ONLY place one of the first four machines, the code below kicks in. For simplicity's sake, I've included only the mouselistener for the BodyAttacher and the function that it calls, because they all do the same thing (except for a different instance of a machine).
    The method that happens when the user does this goes like this:
    //      This is done from memory, and I couldn't remember all of the code
    //      exactly, so any parts that have glaring errors (like the name of the
    //      mouse listener and the reference to event) because these probably
    //      aren't right.
    Machine newMachine = null;  // this is used to hold new machines as they are
                                               // created before they are attached to the line.
    // This is the mouse listener for the BodyAttacherLabel
    public void BodyAttacherLabelMouseClicked(java.awt.event evt) {
             JLabel tempMachineLabel = evt.getSource();  // store the source of which label was clicked on.
             if (tempMachineLabel.isEnabled()) {
                     newMachine = new BodyAttacher();
                     disableMachineLabel(tempMachineLabel);
             tempMachineLabel = null;   // ensure no other calls accidentally access this label
    // This is the method to disable the button
    public void disableMachineLabel(Label temp) {
            temp.setEnabled(false);
            temp.setText("");
    }This was done from memory, and probably isn't even syntactically correct but it gives an idea of how this works. Could screwy threading be causing disableMachineLabel to execute on more than one Label or something? I can't imagine why or how it would, but I don't know much about threading...

Maybe you are looking for

  • Picture Size in Photoshop CS3 Extended

    I have a bunch of digital pictures I am putting in a video script. My video is 16:9 so all my pictures have black at the sides. Does anyone know what size to make these pictures in Photoshop CS3 extended? Do I change the pixel size and if so to what?

  • Yellow Badge showing up in imported library

    I recently imported a managed library from a MBP to a Mac Pro, and roughly 10-15% of images are now showing the yellow badge w/ exclamation point. Images have always resided in a managed library on MBP. I understand what the badge signifies, but need

  • "server starting up" message after update

    Hi All, I've just updated my server from 10.6.5 to 10.6.7 and upon restart I can't connect to my wikis or blogs. I just get a grey screen and a spinning wheel saying "server starting up". I have tried the Apple solution listed here, as I do host my C

  • Change BPM of imported AAF

    I"ve imported an AAF with the tracks of a song from ProTools. I know the constant BPM from ProTools is 112 but when I imported the AAF Logic's BPM was set to 120. Now when I try to set Logic to 112 bpm it messes with the position and duration of the

  • Validation of the file type being uploaded

    Hi, My requirement is to put a validation on the Primary File metadata field so that it allows only certain type of file types. Example the primary file should allow only .doc and .pdf and restrict .jpeg/.tiff files Can any one suggest how this can b