Like in stored procedure returns incorrect result

Hello all,
I have a stored procedure like below
Alter PROCEDURE ContactsListBySearch
@AuthorID int,
@currentPage INT,
@pageSize INT,
@searchStr nvarchar
AS
BEGIN
set nocount on;
WITH tempLog AS (
SELECT distinct ROW_NUMBER()OVER (ORDER BY email DESC) AS Row,
email,username from AddContact where userid = @AuthorID and email like '%'+@searchStr+'%' and username like '%'+@searchStr+'%' )
SELECT email,username
FROM tempLog
WHERE Row between ((@currentPage - 1) * @pageSize + 1) and (@currentPage*@pageSize)
END
for a search string david it gives me unrelated rows.
But for the same query string david if i run the query
select email,username from addcontact where userid=2 and email like '%david%' and username like '%david%'
It gives me exact result.
How to pass an paramter as a string in the stored procedure?? please help me.
regards,
Guru
Edited by: user4554966 on Jan 18, 2010 6:45 PM

Did not get any help from them ;)
Regards,
Guru

Similar Messages

  • Sub report using Stored Procedure returns incorrect data

    Post Author: rikleo2001
    CA Forum: Data Connectivity and SQL
    Guys,
    I am using CR 9 in ASP.net application.
    One simple report and one Sub report, sub report is basically linked with Stored procedure accepting one parameter and returns a select query.
    Main report is linked with that sub report using that parameter field.
    Sub report is on demand sub report.
    Now when I execute that main report and click on on demand sub report I am getting Wrong order information.
    Here is out put on main report
    Order 1                                          on demandDetail
    Order 2                                          on demandDetail
    Order 3                                          on demandDetail  
         NOW If I click on Order 3 (On demanddetail link, it displays rondom order details, some time correct on too), I am really stuck and don't know where I am going wrong.
    Please help me to solve this issues.
    Many Thanks

    Post Author: rikleo2001
    CA Forum: Data Connectivity and SQL
    Hi Yangster,
    Thank you so much for your reply.
    On DEMAND Sub report is located in main report, IN DETAIL SECTION
    I am passing Order ID from main report linked to  {?morderid} in subreport under command object, and if I run it in design mode, it works perfectly alright, so problem is isolated to ASP.NET and Crystal report post back method on Crystal report.
    The example I give to you this is a simple example to identify issues in my real application and report.
    My main report contains summary of data base on unique identifier. that summary have 4 differant types of details which has to be on the same report (as Crystal report doesn't provide Nested subreport), so I decided to use 4 subreports on main report and all subreport using Stored procedure command object.(Sub report has it own complex processing requirement to fulfill).
    Please help me with any further ideas? for the sample which I presented to you this is only using one SP on main report with a simple processing.
    Many Thanks

  • Calling a Stored Procedure with a result set and returned parms

    I am calling a stored procedure from a Brio report. The stored procedure returns a result set, but also passes back some parameters. I am getting a message that states that the DBMS cannot find the SP with the same footprint. Besides the result set, the SP returns 3 out parameters: (Integer, char(60), char(40)). Is there something special I need to do in Brio to format the out parameters to be passed back from the SP.
    Thanks,
    Roland

    Did you try just declaring the vars?
    untested
    declare
      myCur SYS_REFCURSOR;
      myRaw RAW(4);
      BEGIN
        test (0, 0, myRaw, sysdate, myCur);
      END;

  • If the result from the stored procedure returns 0 rows I get this error returned:

    If the result from the following stored procedure returns 0
    rows I get this error returned:
    faultCode:Server.Processing faultString:'Variable transfers
    is undefined.' faultDetail:''
    How can I get round this?

    Well if I try this in a cfm page:
    <cfstoredproc procedure="GetTransfers"
    datasource="datasource" returncode="true">
    <cfprocparam type="in" cfsqltype="CF_SQL_VARCHAR"
    value="4">
    <cfprocparam type="in" cfsqltype="cf_sql_date"
    value="12/09/2006 08:42:00">
    <cfprocparam type="in" cfsqltype="cf_sql_date"
    value="12/09/2008 08:42:00">
    <cfprocresult name="transfers">
    I get an error like:
    [Macromedia][SQLServer JDBC Driver][SQLServer]Procedure or
    function 'GetTransfers' expects parameter '@fromdate', which was
    not supplied.
    But this procedure only accepts 3 parameters.

  • Error saving map. Stored procedure returned non-zero result BizTalk Bug

    Hallo all
    MSDN is reporting this Bug.
    "Error saving map. Stored procedure returned non-zero result." error message when you deploy the BizTalk Server 2010 applications in BizTalk Server 2010 Administration Console"
    http://support.microsoft.com/kb/2673264/en-us
    I am having this problem in BizTalk 2013. Is this correct? or I am doing something wrong..
    This error occured as I was about to deploy BizTalk application from Visual studio 2012 to BizTalk 2013.
    If this bug is available in 2013, where can I get a fix for it..
    Thanks in Advance
    AKE

    Hi AKE,
    Fix for this bug in BizTalk Server 2013 is not publicly available yet. Only option to get the fix for this bug is to contact:
    http://support.microsoft.com/contactus/?ws=support
    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful.

  • Error saving map. Stored procedure returned non-zero result. Check if source and target schemas are present.

    I am using VS 2012 and BizTalk 2013 and attempting to deploy an application to BizTalk when I get these errors:
    Error 47
    at Microsoft.BizTalk.Deployment.Assembly.BtsMap.Save()
       at Microsoft.BizTalk.Deployment.Assembly.BtsArtifactCollection.Save()
       at Microsoft.BizTalk.Deployment.Assembly.BtsAssembly.Save(String applicationName)
       at Microsoft.BizTalk.Deployment.BizTalkAssembly.PrivateDeploy(String server, String database, String assemblyPathname, String applicationName)
       at Microsoft.BizTalk.Deployment.BizTalkAssembly.Deploy(Boolean redeploy, String server, String database, String assemblyPathname, String group, String applicationName, ApplicationLog log)
    0 0
    Error 49
    Failed to add resource(s). Change requests failed for some resources. BizTalkAssemblyResourceManager failed to complete end type change request. Failed to deploy map "XXX.BTS2013.XXX.Maps.map_XXXX_R01_InsLabProc".
    Error saving map. Stored procedure returned non-zero result. Check if source and target schemas are present. Error saving map. Stored procedure returned non-zero result. Check if source and target schemas are present.
    0 0
    Error 46
    Failed to deploy map "XXX.BTS2013.XXX.Maps.map_XXXX_R01_InsLabProc".
    Error saving map. Stored procedure returned non-zero result. Check if source and target schemas are present.
    0 0
    I also tried to Import a MSI file from our test environment to see if that would work...got the same errors.  After spending hours (not kidding) looking for an answer, all I could find is that a hotfix would work.  So, I got the hotfix from Microsoft
    Support and applied it then rebooted.  Still getting the same errors.  I'm absolutely at a stand still.  Interesting that I got this application to deploy yesterday and then the next time I deployed it I started getting these errors.  I'm
    ready to pull my hair out!
    Is there an answer for this out there somewhere?  Any help would be appreciated.
    Thanks,
    Dave

    Hi Dave,
    Which hotfix have you applied? I don't think a hotfix of this issue is available for BizTalk 2013 yet. You should create a
    support ticket with Microsoft to get a solution.
    If this answers your question please mark as answer. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • Stored proc returns zero result

    Hello, please help me. I am quite new to oracle stored
    procedures. I have a proc that returns data to cfm but it keeps
    giving zero results. But if i don't use stored proc, the same query
    gives me something. please help. my stored proc and cfm goes
    something like below:
    ************************************ stored procedures
    CREATE OR REPLACE PACKAGE PACK_REFCURSOR_NHM_TRANSACTION AS
    TYPE TRANS_TableRows IS REF CURSOR;
    PROCEDURE REFCUR_NHM_TRANSACTION (
    IN_sTMPACC IN varchar2,
    IN_sITEM_TYPES IN varchar2,
    OUT_TRANS OUT TRANS_TableRows);
    END PACK_REFCURSOR_NHM_TRANSACTION ;
    CREATE OR REPLACE PACKAGE BODY PACK_REFCURSOR_NHM_TRANSACTION
    AS
    PROCEDURE REFCUR_NHM_TRANSACTION (
    IN_sTMPACC IN varchar2,
    IN_sITEM_TYPES varchar2,
    OUT_TRANS OUT TRANS_TableRows)
    IS
    BEGIN
    OPEN OUT_TRANS FOR
    SELECT T.TRANSACTION_ID, T.TRANSACTION_TYPE,
    T.TRANSACTION_DATE, T.TRANSACTION_TIME,
    T.ITEM_CODE, 0 OE_DETAIL_ID,
    T.QUANTITY, T.LIST_PRICE, T.DISCOUNT, T.SALE_PRICE,
    T.GST_AMOUNT, 'I' INSURER_TYPE
    FROM NHM_TRANSACTION T
    WHERE DISPENSED_FLG = 'Y'
    AND T.ACCOUNT_ID = IN_sTMPACC
    AND T.TRANSACTION_TYPE IN ('01','02', '09')
    AND NVL(T.STATUS,'F') != 'C'
    AND T.BILLED_FLG = 'N'
    AND T.ITEM_TYPE IN (IN_sITEM_TYPES)
    AND T.BILL_ITEM_FLG = 'Y'
    UNION ALL
    SELECT T.OE_TRANSACTION_ID TRANSACTION_ID, TRANSACTION_TYPE,
    T.TRANSACTION_DATE,
    T.TRANSACTION_TIME, NVL(T.ITEM_CODE,T.PACKAGE_CODE)
    ITEM_CODE, T.OE_DETAIL_ID,
    T.QUANTITY, T.LIST_PRICE, T.DISCOUNT, T.SALE_PRICE,
    T.GST_AMOUNT, 'S' INSURER_TYPE
    FROM NHC_OE_TRANSACTION T, NHC_MASTER_ITEM M, NHM_PACKAGE P
    WHERE T.ACCOUNT_ID = IN_sTMPACC
    AND T.ITEM_CODE = M.ITEM_CODE(+)
    AND T.PACKAGE_CODE = P.PACKAGE_CODE(+)
    AND (DECODE(T.ITEM_CODE,NULL,P.BILL_OPTION,M.BILL_OPTION) in
    ('P','O','F'))
    AND NVL(T.STATUS,'F') != 'C'
    AND T.BILLED_FLG = 'N'
    AND ((T.TRANSACTION_TYPE = '09' AND STATUS IN ('P','R'))
    OR T.TRANSACTION_TYPE IN ('01','02','11','12', '10'))
    AND T.BILL_ITEM_FLG = 'Y'
    AND T.ITEM_TYPE IN (IN_sITEM_TYPES) ;
    END REFCUR_NHM_TRANSACTION ;
    END PACK_REFCURSOR_NHM_TRANSACTION ;
    *************** the cfm code (note: i am using coldfusion
    MX************
    <cfstoredproc datasource="#application.datasource#"
    procedure="NSCOCT.PACK_REFCURSOR_NHM_TRANSACTION.REFCUR_NHM_TRANSACTION">
    <cfprocparam type="IN" cfsqltype="CF_SQL_VARCHAR"
    value="#TMPACC#" dbvarname="IN_sTMPACC">
    <cfprocparam type="IN" cfsqltype="CF_SQL_VARCHAR"
    value="#QRYLOCITEM.ITEM_TYPE#" dbvarname="IN_sITEM_TYPES">
    <cfprocresult name="getPrescItems">
    </cfstoredproc>
    ***** i dumped getPrescItems and returns no data. it's
    suppose to return something . Any help is much appreciated. Thank
    you. *********

    just an update. i found out that it has something to do with
    the condition "IN". the values there is supposed to be a list (e.g.
    a,b,c,d,e,f,g). What I suspect is that when in stored proc, it
    interprets in the query as "IN('a,b,c,d,e,f,g')" instead of
    "IN('a','b','c','d','e','f','g')" which is what I actually want.
    I have also tried the quotedvaluelist in cfm but still no
    result, so i suspect again, using quotedvaluelist, that it
    interprets in the proc as "IN(''a','b','c','d','e','f','g'')".
    Can anybody help me whit this so i can have the proc
    interpret my IN condition as "IN('a','b','c','d','e','f','g')"?
    Thanks.

  • Problem calling Stored Procedure returning SETOF UDT (Using Spring)

    I am using Spring's StoredProcedure class to call a stored procedure from a PostgreSql database. It returns a set of user defined data types. I'm having a problem in parsing the results returned.
    The user defined data type :
    CREATE TYPE process_states AS (
    process_name text,
    process_type text
    The stored procedure returns a SET of "process_state" :
    CREATE FUNTION inquire_process_state (.....)
    RETURNS SETOF process_state AS '
    SELECT ....
    I hava a Java class extending the Spring StoredProcedure classs.
    public MyProcStats extends StoredProcedure {
    private class ProcStateCallBackHandler implements RowCallBackHandler {
    public void processRow(ResultSet rs) throws SQLException {
    System.out.println(rs.getString(1));
    public MyProcStats (DataSource ds) {
    super(ds, "inquire_process_state");
    super.setFunction(true);
    declareParameter(new SqlOutparameter("rs", Types.OTHER, new ProcStateCallBackHandler());
    declareParameter(new SqlParameter("family_name", Types.VARCHAR) ;
    While testing this class, I get an errormessage
    "java.sql.SQLException:ERROR: cannot display a value of type record"
    I would appreciate if anyone can point out my mistakes. I tried declaring
    new SqlOutParameter("rs", Types.OTHER, "process_state"), but that didn't help.

    As the related posts suggest, you will need to use direct JDBC code for this.
    Also I'm not sure JDBC supports the RECORD type, so you may need to wrap your stored functions with ones that either flatten the record out, or take OBJECT types.

  • SSRS - Oracle Stored procedure returns no data but does in SQL Developer Sudio

    HI there,
    Stored procedure returns no data when executed on the report but when i execute the stored procedure in Sql Developer it returns required rows.
    Thanks for your help!

    Hi Simon,
    When i test with simple query, i get the data.
    For your convenience, my stored proc looks lyk :
    PROCEDURE pr_REPORT_data(P_STARTDATE IN DATE, P_ENDDATE IN DATE, data_rows OUT T_CURSOR) AS 
    OPEN completed_Reinstatement FOR
      SELECT 
                 value1,.......value5
      FROM table1
    WHERE
        To_Date(createdDate, 'YYYY/MM/DD') BETWEEN To_Date(P_STARTDATE, 'YYY/MM/DD') AND To_Date(P_ENDDATE, 'YYYY/MM/DD');
    END pr_REPORT_data;          
    T_CURSOR is of type cursor which is declared on the package.
    I'm assuming the problem is with date parameters, however i converted the date before passing to
    WHERE clause. 

  • Error in calling Stored procedure returns REFCURSOR

    Hi,
    I've written a oracle stored procedure returning REFCURSOR. say,extractorderdespatchconfirmsp('','','','','','H1','ACG','','','','',:rc).
    Following statement throwing error.
    CallableStatement cs = con.PrepareCall("{extractorderdespatchconfirmsp('','','','','','H1','ACG','','','','',:rc)}");
    rs = cs.executeQuery();
    Could you rectify this problem and give me the currect code.
    riyaz

    Your naming convention leaves a little to be desired.
    String command = "{CALL extractorderdespatchconfirmsp(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}";
    CallableStatement cstmt = conn.prepareCall(command);
    //set the variables here ie, dates need to be a timestamp format. use set timestamp.
    cstmt.setInt(1, 2);
    cstmt.setString(2, "a string");
    cstmt.setInt(3, 0);
    //for return values
    cstmt.registerOutParameter(3, Types.INTEGER);
    cstmt.registerOutParameter(2, Types.INTEGER);
    cstmt.execute();
    int status = cstmt.getInt(3);
    int status2 = cstmt.getInt(2);
    cstmt.close();
    It took me awhile too to get JDBC to call these right.

  • Calling stored procedure returning result set

    Hi all,
    i know this issue is discussed quite often. I did not find an answer in the forums, not in the manual and even not in the examples for stored procedure.
    So i try it here once more :)
    Description:
    GET_SKS:
    The GET_SKS procedure is used to generate a number of surrogate keys. It has one input parameter NUM_SKS_IN that specifies the number of keys to generate. The generated keys are returned as a result set.
    So i tried:
    CallableStatemant sproc_stmt = lsession.connection().prepareCall("{ call Get_SKS(?,?)}");
    sproc_stmt.setInt(2,1);
    sproc_stmt.registerOutParameter(1,OracleTypes.CURSOR);
    sproc_stmt.execute();
    ResultSet sproc_result = (ResultSet) sproc_stmt.getObject(1);
    I got the exception:
    java.sql.SQLException: ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'GET_SKS'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    Thanks for help! This is really getting frustrating...
    Regards,
    ak

    Hi there,
    i could speak to our one of our admins. This is what he gave me:
    CREATE OR REPLACE PROCEDURE "TCSDBOWNER"."GET_SKS"
       (num_sks_in IN INTEGER,
        sk_out OUT SYS_INFO.SYS_INFO_SK%TYPE)
    AS
    /*+
    || Procedure - GET_SKS - Oracle
    ||
    || Description:
    ||   This procedure is used to get one or more primary keys for tables with
    ||   surrogate keys as the primary key.  This number is unique across all
    ||   tables and installations for a given client.
    ||
    || Parameters:
    ||   num_sks_in - INTEGER: number of surrogate keys to return
    ||   sk_out - sk_subtype: first key in the sequence of requested keys
    ||
    || History:
    ||   08/30/01,dcs: Created
      CURSOR request_cur IS
        select DBMS_LOCK.REQUEST(170333184) from dual;
      CURSOR release_cur IS
        select DBMS_LOCK.RELEASE(170333184) from dual;
      CURSOR dual_sk_cur IS
         select SEQ_SK.NEXTVAL SK
           from DUAL;
      v_base_offset SYS_INFO.BASE_OFFSET%TYPE;
      v_sk SYS_INFO.SYS_INFO_SK%TYPE;
      v_sqlstring VARCHAR2(1000);
      v_cursor_handle INTEGER;
      v_return INTEGER;
    BEGIN
      IF num_sks_in < 1 THEN
        TCS_EXC.RAISE_ERROR(TCS_EXC.num_sks_in_lt_1);
      END IF;
      OPEN request_cur;
      FETCH request_cur INTO v_return;
      CLOSE request_cur;
      IF v_return <> 0 AND v_return <> 4 THEN
        TCS_EXC.RAISE_ERROR(TCS_EXC.sk_gen_lock_failed);
      END IF;
      v_cursor_handle := DBMS_SQL.OPEN_CURSOR;
      v_sqlstring := 'ALTER SEQUENCE SEQ_SK INCREMENT BY '|| TO_CHAR(num_sks_in);
      DBMS_SQL.PARSE(v_cursor_handle, v_sqlstring, DBMS_SQL.V7);
      v_return := DBMS_SQL.EXECUTE(v_cursor_handle);
      DBMS_SQL.CLOSE_CURSOR(v_cursor_handle);
      GET_BASE_OFFSET(v_base_offset);
      OPEN dual_sk_cur;
      FETCH dual_sk_cur INTO v_sk;
      CLOSE dual_sk_cur;
      sk_out := (v_base_offset * 10000000000) + v_sk - num_sks_in + 1;
      v_cursor_handle := DBMS_SQL.OPEN_CURSOR;
      v_sqlstring := 'ALTER SEQUENCE SEQ_SK INCREMENT BY 1';
      DBMS_SQL.PARSE(v_cursor_handle, v_sqlstring, DBMS_SQL.V7);
      v_return := DBMS_SQL.EXECUTE(v_cursor_handle);
      DBMS_SQL.CLOSE_CURSOR(v_cursor_handle);
      OPEN release_cur;
      FETCH release_cur INTO v_return;
      CLOSE release_cur;
      IF v_return <> 0 THEN
        TCS_EXC.RAISE_ERROR(TCS_EXC.sk_gen_lock_failed);
      END IF;
    END GET_SKS; Ok, i tried with that but even not succeded yet. Can anybody help me to code that into a java call?
    Regards,
    ak

  • Calling an Oracle stored procedure and retrieving result from OUT parameter

    Hello,
    I have a stored procedure that returns a string in an OUT parameter after receiving 6 IN parameters. I have tested the procedure in PL/SQL and it's producing the right output there. The problem is when I call the stored procedure from my Java method. I then get an error message telling me that I have the wrong number or types of arguments in my procedure call. I have checked that the method receives and sends the correct data in the correct order and I'm not sure what else the error message can relate to...?
    The exception is called on my second try statement but I haven't been able to find out what I have done wrong there. Does anyone have any suggestions? Thanks.
    the error message
    java.sql.SQLException: ORA-06550: line 1, column 13: PLS-00306: wrong number or types of arguments in call to 'P_SET_GIVEN_ANSWER' ORA-06550: line 1, column 7: PL/SQL: Statement ignored
    the procedure
    CREATE OR REPLACE PROCEDURE p_set_given_answer(
    strfeedback OUT VARCHAR2,
    intpi_id IN INTEGER,
    intquestion_id IN INTEGER,
    intgivenanswer IN INTEGER,
    strgivenprefix IN VARCHAR2,
    strgivenunit IN VARCHAR2,
    strgu_id IN VARCHAR2) AS
    -- some declarations
    BEGIN
    -- some processing and then returns the string below indicating the outcome
    strfeedback = 'result';
    END
    the java method (the class is called dbUtil and the database connection is created in the method called getDbConnection() )
    public void setGivenAnswer(int intPi_id, int intQuestion_id, int intGivenAnswer, String strGu_id, String strGivenPrefix, String strGivenUnit) {
    java.sql.Connection con = null;
    String query = "{call ? := p_set_given_answer(?,?,?,?,?,?)}";
    try {
    con = dbUtil.getDbConnection();
    } catch(Exception e) {
    dbConnectionExceptionMessage = "error 1:"+e.toString();
    try{
    CallableStatement stmt = con.prepareCall(query);
    // register the type of the out param - an Oracle specific type
    stmt.registerOutParameter(1, OracleTypes.VARCHAR);
    // set the in params
    stmt.setInt(2, intPi_id);
    stmt.setInt(3, intQuestion_id);
    stmt.setInt(4, intGivenAnswer);
    stmt.setString(5, strGivenPrefix);
    stmt.setString(6, strGivenUnit);
    stmt.setString(7, strGu_id);
    // execute the stored procedure
    stmt.execute();
    // retrieve the results
    strFeedback = stmt.getString(1);
    } catch (java.sql.SQLException e) {
    dbConnectionExceptionMessage = "error 2:"+e.toString();
    try {
    con.close();
    } catch (java.sql.SQLException e) {
    dbConnectionExceptionMessage = "error 3:"+e.toString();
    ----------------------------------------

    Looks like you are declaring a procedure, but you are calling it like a function. A procedure has no return value, it has only parameters: "{call p_set_given_answer(?,?,?,?,?,?,?)}"

  • How to stop SQL Server Agent Job if Stored Procedure returns value 0

    I have SQL Server 2012 SSIS.
    I have 2 SSIS packages.
    I have created SQL Server Agent Job for running packages.
    I have created steps. If first step have run succesfully next step is run.
    I have need to add new logic.
    I have validation stored procedure, which validate DB table values and returns 1 or 0.
    I would like to create logic where first of all this SP is runned. Return value of SP determines if steps are run or not.
    I was thinking to use Execute SQL Task for running SP.
    If value 1 is returned, then run rest of Tasks is run.
    If value 0 is returned, what should I do so that Job is stopped? I need assistance! 
    I want current step to stop never moved to next step.
    Is there any SSIS tasks, which can stop the Job?
    Or should I make Step for running validation SP?
    How to do so that if value 0 is returned stop Job.
    Kenny_I

    Please refer the below link:
    http://technet.microsoft.com/en-us/library/aa260308(v=sql.80).aspx
    Please read Remarks carefully!!!
    Remarks
    If a job is currently executing a step of type CmdExec, the process being run (for example, MyProgram.exe) is forced to end prematurely. Premature ending can result in unpredictable behavior such as files in use by the process being held open. Consequently,
    sp_stop_job should be used only in extreme circumstances if the job contains steps of type CmdExec.
    Permissions
    Execute permissions default to the public role in the
    msdb database. A user who can execute this procedure and is a member of the
    sysadmin fixed role can stop any job. A user who is not a member of the
    sysadmin role can use sp_stop_job to stop only the jobs he/she owns.
    When sp_stop_job is invoked by a user who is a member of the
    sysadmin fixed server role, sp_stop_job will be executed under the security context in which the SQL Server service is running. When the user is not a member of the
    sysadmin group, sp_stop_job will impersonate the SQL Server Agent proxy account, which is specified using
    xp_sqlagent_proxy_account. If the proxy account is not available,
    sp_stop_job will fail. This is only true for Microsoft® Windows® NT 4.0 and Windows 2000. On Windows 9.x, there is no impersonation and
    sp_stop_job is always executed under the security context of the Windows 9.x user who started SQL Server.

  • Stored procedure return datatable or temporary table

    hi again everybody
    i just want to ask can stored procedure or function return a datatable or a temporary table that i want to fill later
    the problem is i want to make a stored procedure that make research for the client with many option and with this selected option the procedure execute the right request from
    different table and i just return the result in the datatable or the temporary table ????
    help ^^ and thank's

    >
    so i want make the client choose options for search and after that the programme interrogate my DB according to his options
    so the solution i want it ,i hope it's optimised cuz i dn't want to use much view or cursor so when i interrogate the BD i put the result into temporary table
    >
    Well that is a start at a better explanation though you still seem focused on the solution you want instead of the result you want. It shouldn't matter to you if a view or cursor is used if you get the result quickly. Besides all queries use cursors to get their results whether you explicitly define a cursor or not.
    The usual choices given to users for any particular search do not include which table or view to use. You would normally let the user select the filtering to be done.
    The columns and datatypes in the result set are usually fixed and are not provided dynamically. That is you wouldn't let user1 select 5 columns from tableA and user2 select 7 different ones. The reason is the the client software used to display the result set to the user needs to know how many columns it has to deal with and what the datatypes are.
    Only software like sql developer, toad or similar creates generic data grids with different columns and datatypes.
    >
    and that so the other thing i want is : can stored procedure or function return a datatable
    >
    As Justin said a pipelined function can return a result set but, like I just said above, it generally returns the same number of columns and the same datatypes every time it is called. A procedure can return a REF CURSOR that the client software can use to obtain the rows of the result set or the procedure could return an Oracle collection.
    But procedures/functions don't return actual tables. Returning a small collection is as close to that as you get.

  • Error calling a  stored procedure returning a PLSQL table /  REF cursor

    stored proceure declares -
    TYPE A_rec IS RECORD (
    date DATE,
    id NUMBER(10),
    start NUMBER (10),
    end NUMBER (10)
    TYPE tmp_tbl IS TABLE OF A_rec ;
    PROCEDURE get_B(
    p_id IN NUMBER,
    p_startdate IN DATE,
    p_enddate IN DATE,
    p_tbl OUT tmp_tbl
    My Java code reads -
    StoredProcedureCall storedProcedureCall = new StoredProcedureCall();
    storedProcedureCall.setProcedureName("get_B");
    DataReadQuery query = new DataReadQuery();
    query.setCall(storedProcedureCall);
    Vector parameters = new Vector();
    /** For all input params **/
    query.addArgument(param.getInputParamName(" name");
    parameters.add("values");
    /** Now comes the OUT part .. i am not sure what to do **/
    storedProcedureCall.useNamedCursorOutputAsResultSet("p_tbl ");
    /** execute query **/
    Vector result = (Vector) getSession(ctx).executeQuery(query, parameters);
    ------------- My program does not throw any error ... but does not return anything ----

    TopLink currently doesn't support pl/sql types to be used as stored procedures parameters - but version 11 will.
    However you can use a single cursor as an out parameter in your stored procedure:
    p_tbl OUT CURSOR_TYPE.ANY_CURSOR,
    and it will be returned by TopLink.

Maybe you are looking for

  • Game Center - How can you view friends of friends

    I read on another forum that it's possible for my friends on Game Center to view my other friends. But no indication as to how to do that, was mentioned. Does anyone know how to do this? Message was edited by: Char FL

  • HT201363 how to reset my security questins if i forgot mine?

    hyuhioffryr6

  • Ref Cursor as input parameter

    Is it possible to pass a ref cursor from java as an input parameter to a stored procedure, which the procedure can then process? (Passing Ref Cursors as output parameters from a stored procedure to a result set works fine.)

  • Placing barcode on report

    Question 1 =========== I have a simple records as follow: Customer Amount Account_no John Walsh 1500 123456 Mary Joe 700 985000 Lisa Black 2510 456000 Kim Blackson 980 254100 I would like in the report to ruen the account no column into barcode numbe

  • A question occured when i created a vc4wd file.

    Hi, all. I tried to implement a exercise "Creating a Bank Information iView  " from library. Everything was fine and I finished successfully. In order to use this file in GP, I tried to change compiler`s option. When I changed "compiler runtime" from