Getting Stored Procedure Parameters Programmatically

Hi,
Does anyone know of a way to programatically return the paramaters of a stored procedure? I am building a code generator and have found the all_procedures view to get the stored procedures name now all I need is a way to get the parameters so I can execute the SP and get the column names they return.
Thanks,
Chuck

Play around with this;;
select OBJECT_NAME, PACKAGE_NAME, ARGUMENT_NAME, POSITION, DATA_TYPE, IN_OUT, DATA_LENGTH, DATA_PRECISION, DATA_SCALE from user_arguments where UPPER(object_name) = UPPER(:object_name) and package_name is null order by position
The reference to package names is because this code will work for stand-alone procedures/functions. If the procedure/function is in a package then you would specify the package name to get the parameters.

Similar Messages

  • Unused stored procedure parameters marked with a check mark in crystal reports

    Post Author: epowers0213
    CA Forum: General
    Hello,
    I have some Crystal Reports that currently use stored procedures as their datasources (I am in the process of modifying them to use datasets instead).  Some of the original reports have check marks next to stored procedure parameters which I cannot find as being used anywhere in the report.  Is this a legitimate possibility? (Some of them do not have check marks, however, so it is not consistent.)
    More Info:  I am using Crystal Reports within Visual Studio 2005.  I have looked through each report in every way I can think of to find if a parameter field is being used anywhere - I have checked all formula fields, the formatting formulas for sections and individual fields, the record and group selection formulas and the grouping and sorting experts, along with any subreports (although some of them have no subreports).
    (I have read on other forums that exporting a report definition file is another way to look for where fields or parameters are being used, but this does not appear possible within Visual Studio 2005.)
    In some cases, I have gone ahead and replaced the stored procedure datasource location with a dataset (generated based on the same stored procedure).  When I do this, Crystal automatically deletes the stored procedure parameters from the report, and I have still been able to run the modified report successfully - at least it looks ok and nothing is complaining.  So is it possible that these parameters were actually not being used anywhere on the report although they were marked with a check mark?
    Any help would be greatly appreciated!  I want to make sure I am not changing the function of these reports somehow without knowing it...
    Thank you!

    Are you referencing another database that Crystal can't see? Also, you can try and copy the SQL to a command object in Crystal to see if it behaves differently there.

  • How to change Stored Procedure Parameters to a value in a formula?

    My Client is using Crystal 8.5 on MSSQL 2005.  The crystal report is called from vb6 application, the client does not have access to the vb6 source code (they are upgrading vb.net), therefore I can only work in the crystal report.
    The vb6 code updates 2 formula fields Start_Date and End_Date in the crystal report.  I would like to pass these values as parameters to the stored procedure and suppress the "Enter Parameter Values" box.
    Stored Procedure: tcs_AMP_eSuper
        Parameters:  @startDate, @EndDate
    What I would like in crystal:
        {?@startDate} = {@Start_Date}
        {?@endDate} = {@End_Date}
    Thanks
    Barry

    Hi Barry,
    You can't run a Stored Procedure with Parameters unless you fill in the values and you can't get the values unless you prompt for them or provide then in the connection properties in code.
    So in your app just fill in the parameter values when logging in. Create your own Param UI or get them from somewhere from a preselected list. As long as they are valid then CR won't prompt for them.
    I don't understand why this is such a problem for you? Parameters will prompt, it's by definition. Create a UDL file, open NotePad and then rename it to *.udl. Double click the file and the OLE DB Provider log on UI will pop up. Connect to your SP with parameters and then save it. Open in edit mode and you'll see the SQL to open the SP with Values in the connection.
    Something like: exec YourSP;1, startdateValue, Enddate value
    So in code use that line in the log on method and the user won't get prompted. How you fill in those dates is up to you.
    Don

  • HowTo: Using special characters in SQL passthrough stored procedure parameters?

    Hi all,
    I am creating a Visual FoxPro 5.0a application, where I am trying to call a stored procedure in my Oracle database with the following SQLEXEC command (SQLEXEC is the Foxpro function to send sql statements to the ODBC driver):
    lcSQL = "{Call Insert_FRB.NewItemPage('KABO)n$i,30000000000', '184927', '184927', 'MAIR2001011216151314', 'MAIR')}"
    /* Sorry the above command should of course not break accross pages*/
    lnSuccess = sqlexec(1,lcSQL)
    With the parameters given, I get the ODBC error: "Connectivity error: [Oracle][ODBC Oracle Driver]Syntax Error."
    I get the same error, when using the Oracle ODBC 32bit Test utility.
    The call works just fine, if I replace the "$" in the first parameter 'KABO)n$i,30000000000' with a "normal" character, e.g. 'KABO)nAi,30000000000'. Oracle handles the $-character just fine, the stored procedure is working properly when called directly in SQLPLUS8.
    I am using the Oracle ODBC driver sqo32_73.dll Version2.00.03.01.
    Questions:
    How do I have to submit the "$" to the ODBC driver, in order to be passed through to Oracle unchallenged?
    Does anybody know of other special characters, which are not accepted by the ODBC-drivers for Oracle?
    Thanks to any hints,
    Peter

    You could try downloading the Oracle 8.1.7 client and the latest
    Oracle8 ODBC driver, install them on your machine, and verify
    that the failure goes away. That's obviously the acid test.
    I can tell you that when I worked in the ODBC driver group we
    did identify and fix some bugs where our parser wasn't skipping
    string literals. If this particular bug wasn't fixed earlier,
    it almost certainly was then (I'm guessing that work was done 12-
    18 months ago).
    Justin

  • How to create an External Content Type with SQL Stored Procedures Parameters and query it in a SharePoint App

    Hi,
    I'm new to SharePoint 2013 I want to be able to query a MSSQL database from a SharePoint App I have tried to create an External Content Type (ECT) which is produced from a MSSQL stored Procedure, this procedure has several parameters which are needed to
    filter the data correctly.  From here I want to produce an external list which I can then query from a c# SharePoint app.  If I leave the filters in the ECT null then the list is of course empty or if enter a default values the results are limited
    for the app to query so are no good.
    I want to dynamically pass values to the ECT when querying from the app, is this not possible.  Should I just be returning everything in an external list and then letting the query in the app filter the data, this seems inefficient?
    Is this the best way to do this or should I be doing this differently?
    Please can someone point me in the right direction.
    Thanks

    Hi Pandra801,
    When you create a the external content type, please try to add a filter based on your select statement.
    http://arsalkhatri.wordpress.com/2012/01/07/external-list-with-bcs-search-filters-finders/
    Or, try to create a stored procedure based on your select statement, then create ECT using the SQL stored procedure.
    A step by step guide in designing BCS entities by using a SQL stored procedure
    http://blogs.msdn.com/b/sharepointdev/archive/2011/02/10/173-a-step-by-step-guide-in-designing-bcs-entities-by-using-a-sql-stored-procedure.aspx
    I hope this helps.
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

  • Pass values to stored procedure parameters

    I have a stored procedure in MS SQL 2005 that has a datetime parameter.  I want to be able to use the stored procedure but I only want to pass a date value and assume all times for this date. 
    When i add the stored procedure to the report it automatically creates the parameters and I don't know how to bypass them.
    Is it possible to create a date type parameter and then pass it to the stored procedure parameter?

    Hi Johua,
    Yes, you can create a date type parameter and pass it to a stored proc that accepts a datetime parameter.
    This will, however, need a container type of a report.
    1) Create a new report and also create a date parameter in this report
    2) Insert the original report as a subreport in, perhaps, the report header/footer section
    3) Create a formula with this piece of code:
         datetime({?Date},time(0,0,0));
    4) Link this formula with the subreport's stored proc parameter
    -Abhilash

  • Stored Procedure parameters

    I need to get the parameter list of certain stored procedures in
    a schema. One option I tried was to go thru "user_source" which
    seemed to work okay.
    Is there any other way to get just the parameter list, without
    any of the source code?
    TIA,
    Atul

    After some research, found out that the parameter list can be
    obtained by using an Oracle View called "all_arguments". This
    returns a row for each argument of a procedure/function.
    HTH,
    Atul

  • Stored Procedure Parameters - Setting a default value

    Using SQL 2005, 2008, 2012
    This should be easy, but think that I am making it hard. Below is the stored procedure that I want to call. If I want to pass a 'N' to @SearchDBsFlag how can I retain the default values for @DBName and @PreviewTextSize? I do not want to explicitly pass the
    NULL, 100. I want it to pick up the default values that are defined in the stored procedure.
    Create Procedure [dbo].[ifs_util_Find]
    @SearchText varchar(8000)
    , @DBName sysname = Null
    , @PreviewTextSize int = 100
    , @SearchDBsFlag char(1) = 'Y'
    , @SearchJobsFlag char(1) = 'Y'
    , @SearchSSISFlag char(1) = 'Y'

    I did look up "flag coupling" and all I found was posts from you.
    Start with http://en.wikipedia.org/wiki/Coupling_(computer_programming). The terminology varies; what I call "flag coupling" is one version of Content
    coupling. 
    Cohesion:
    This is how well a module does one and only one thing; that it is logically coherent. The modules should have strong cohesion. You ought to name the module in the format "<verb><object>", where the "<object>" is a specific logical unit in
    the data model. There are several types of cohesion. We rank them going from the worst form of cohesion to the best
    1) Coincidental 
    2) Logical
    3) Temporal
    4) Procedural
    5) Communicational
    6) Informational 
    7) Functional 
    Coupling:
    If modules have to be used in a certain order, then they are strongly coupled. If they can be executed independently of each other and put together like Lego blocks, then they are loosely or weakly coupled. There are several kinds of coupling, which are ranked
    from worse to best: 
    1) Content 
    2) Common 
    3) Control 
    4) Stamp 
    5) Data 
    This is covered briefly in a chapter on writing stored procedures in my book on SQL PROGRAMMING STYLE. In the meantime, you can read DeMarco, Yourdon, Constantine, Myers or several other of the pioneers. 
    This is FAR more basic than SQL programming. This is what you are supposed to know before you write any code in any language. 
    --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

  • Binding multi-byte string to stored procedure parameters

    Can someone post a piece of sample code to show how to bind a multi-byte string to a stored procedure's INPUT parameter?
    Thank you!
    Regards, Nancy

    Can someone post a piece of sample code to show how to bind a multi-byte string to a stored procedure's INPUT parameter?
    Thank you!
    Regards, Nancy

  • Get Stored Procedure Last Execution time.

    Hi,
    I am looking to get last execution of store proc(My cache is flushed off). So would like to know all the store proc execution times.
    sys.dm_exec_query_stats( as I known gets from cache, now all my cache is flushed)
    Is there any way out.
    N_14
    Naveen| Press Yes if the post is useful.

    You may need to look at sys.dm_exec_procedure_stats.
    As your cache is flushed, you will be unlikely to get this information without manual logging.

  • Crystal Reports 2008 Stored Procedure and Parameters from LOVs

    Quite simple report using stored procedure as data source. When editing some of the parameters we get this error when clicking OK to close "This stored procedure parameter can only accept multiple values. Please ensure that Allow Multiple Values is true."
    As we all know stored procedure parameters do not access multiple values at all, so this message is very hard to debug. The report does work if we set the 'Allow Multiple Values' to true, but only when using exactly one value for the parameter. We have tried verify database and other things, but cannot find any way around this issue.
    All ideas are appreciated as this is stopping us from utilizing the dynamic parameters.
    Thanks, Stig

    We managed to work around the issue by creating a new stored procedure. First we used the same parameter names and changed the data source to the new stored procedure. After renaming the parameter with the issue the problem then was resolved.
    Note that another parameter that was earlier affected by this issue in the way that it could not be edited and saved due to the same error message now also works fine. This even if this parameter has not changed names.
    Quite a complex situation to debug this. Maybe if the source of the error message is found in the code we could help testing.
    Stig

  • Passing collection parameters from/to Oracle 8i stored procedure to/from Weblogic java program

    Environment- Oracle DB 8.1.7 (Sun) - JDBC OCI 8.1.7 - Application Server (WebLogic 6.0 or 6.1)QuestionHow to pass oracle collection data types from PL/SQL stored procedures to Weblogic java program as in/out stored procedures parameters. I am hitting oracle error 2006 unidentified data type trying to pass the following data types:-o java.sql.Structo java.sql.Arrayo oracle.sql.STRUCTo oracle.sql.ARRAYo oracle.jdbc2.Structo oracle.jdbc2.Arrayo any class implemented oracle.jdbc2.SQLData or oracle.sql.CustomDatumInformationAbout PL/SQL stored procedure limitation which only affects the out argument types of stored procedures calledusing Java on the client side. Whether Java methods cannot have IN arguments of Oracle 8 object or collection type meaning that Java methods used to implement stored procedures cannot have arguments of the following types:o java.sql.Structo java.sql.Arrayo oracle.sql.STRUCTo oracle.sql.ARRAYo oracle.jdbc2.Structo oracle.jdbc2.Arrayo any class implemented oracle.jdbc2.SQLData or oracle.sql.CustomDatum

    this is becoming a mejor problem for me.And are you storing it as a blob?
    Oracle doesn't take varchars that big.
    And isn't LONG a deprecated field type for Oracle?
    From the Oracle docs......
    http://download-west.oracle.com/docs/cd/B13789_01/server.101/b10759/sql_elements001.htm#sthref164
    Oracle strongly recommends that you convert LONG RAW columns to binary LOB (BLOB) columns. LOB columns are subject to far fewer restrictions than LONG columns. See TO_LOB for more information.

  • Get System Stored Procedure Data in variables

    Hello all Forum Members,
    I am new to SQL Server.
    My Requirement is that i want to get sp_helpuser procedure data in select query variables.
    is it Possible?
    Please Help.

    Hi Prashanth,
    It works  as per my requirement.
    But, Can it be achieved without creating table type variable i.e by creating simple variables ?
    Thanks very much for the reply.
    its possible to get stored procedure resultset using a select as per method 2 below
    http://sqlblogcasts.com/blogs/madhivanan/archive/2007/11/26/select-columns-from-exec-procedure-name-is-this-possible.aspx
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Should Output parameters always be declare at the beginning of the Stored Procedure?

    Should Output parameters always be declare at the beginning of the Stored Procedure?

    Usually input parameters listed first followed by output parameters. This is just a custom, not a requirement.
    Blog: How to architect stored procedure parameters?
    BOL: http://msdn.microsoft.com/en-us/library/ms187926.aspx
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Database Design
    New Book / Kindle: Beginner Database Design & SQL Programming Using Microsoft SQL Server 2014

  • How to get Stored Proc name from ReportClientDoc object (java)

    Post Author: cpriyanka
    CA Forum: Exporting
    We are using Crysta Report 9 and Java.
    We create ReportClientDocument by mentioning report template name ("rassdk://" + report template file path).
    Once I open ReportClientDocument, is there way I can get stored procedure name that is used (associated to report template) to get data in report.
    Thanks,
    Priyanka

    Post Author: cjmorris1201
    CA Forum: Exporting
    Priyanka,
    I am not too sure about the ReportClientDocument and java.
    Where I work we use 8.5, .Net.  We use ttx files to define our data source. 
    I can use something similar to below to retrieve the ttx name programmatically.  Perhaps you can use something similar:
    oCrystalSession.oRpt.Database.Tables.Item(1).Name
    Good luck!

Maybe you are looking for