Displaying data from stored procedure into textbox fields based on user input.
I have a stored procedure that is selecting data from a table called "Vendor" in my database. The data that is being returned are vendor names, vendor addresses, vendor Id's, etc...In my stored proc, I have one parameter that allows
the user to enter a vendor name and then return all the data for that specific vendor. The report that I'm building is going to look like a basic form with a bunch of textboxes on the screen labeled Vendor Address, Vendor Id, Vendor City, Vendor State,
etc...In the report I'm trying to build, the user will enter in a vendor name and then it will return all of the vendor's data based on what the user searches for. However, the report will only return ONE vendor's data at a time.
The problem is that some of the data in the database has very similiar vendor names, but different vendor addresses, vendor Id's, etc...In some instances the vendor name is actually
exactly the same, but the vendor address, vendor city, vendor Id, is all different. So what I did was added another parameter in my report that shows a drop down list of vendor names based on the wildcard search the user just did and
allows the user to select the exact vendor name that he/she is looking for based on what they searched. The problem I'm having is that I don't know what expression I need to put in each one of my textboxes to retrieve the correct data from
the vendor table that the user selects from the drop down list. So what I want to do is return the exact data from the vendor table based on the selection that the user makes from that drop down list. It's like I somehow have to compare the
drop down list parameter directly to the dataset but I don't know what expression needs to go in the textbox. I've tried...=First(Fields!VendorName.Value, "DataSet1").EqualsParameters!DropDownList.Value(0) but I keep getting an error message.
--Here is an example of the kind of thing the user might search for...when the user searches the word "sprint" it returns three different vendor names to the drop down list.
1. sprint
2. sprint
3. sprint co
Each one of those three vendor names has a different vendor address, vendor city, vendor ID, etc...but the vendor names are extremely similar and in some cases
exactly the same. In my report now I can't get the textboxes to return the correct data based on what the user selects. Any advice at all is greatly appreciated.
P.S. I didn't even know what SQL Server was a month ago and had zero knowledge of SSRS at all. I've learned a lot recently, but if you could explain a solution in the easiest way possible I would appreciate it. Thanks!
Hi Jrcowles,
If I understand you correctly, you wnat to list all the Vendor Name which like the user typed Vendor Name on a drop-down list, right? If in this case, we can use a cascading parameters to achieve your requirement. I have tested it on my local environment,
the steps below are for you reference.
Create an other stored procedure using the query below.
CREATE PROCEDURE GetVendorName
@VendorName NVARCHAR(50)
AS BEGIN
exec( 'SELECT * FROM Vendor WHERE VendorName LIKE ''%'+@VendorName+'%''')
END
Create another dataset DataSet2 and using the new created procedure.
Create another parameter VendorName2 and check "Allow Multiple Values" for this parameter.
On the Available Values tab, check "Get values from a query". Select corresponding dataset and field.
On the Default Values tab, check "Get values from a query". Select corresponding dataset and field.
The screenshots below are for you reference.
Reference
http://technet.microsoft.com/en-us/library/aa337169(v=sql.100).aspx
http://www.msbiguide.com/2012/02/adding-cascading-parameters-to-ssrs-reports/
Regards,
Charlie Liao
TechNet Community Support
Similar Messages
-
URGENT : Return Bulk data from Stored Procedure
Hi,
Tell me, how do I return a bulk of data which
does not exist in the data base
but is concluded while the Stored Procedure is executed
from the Stored procedure
to the C++ program.
For Example:
Table ABC
Field1 Field2 Field3
A 1 3
B 1 5
C 2 10
Table DEF
Field1 Field2 Field3
D 10 24
E 3 16
F 8 19
SP_TESTING
Depending on the values in both the tables
for some range of conditions,
a conclusion X is derived for each range value of the
condition range.
Now I need to return this bulk of data X with the
condition they belong to
back to the C++ code calling it....
NOTE : A stored procedure is requited as there is a lot
of processing
required before we conclude the result X for each value
in the condition range.
If I execute this code from C++ instead of Stored
procedure
it is very slow and speed is a prime requirement of my
system.
Also i'm not using any MFC class to access database.
I'm using ConnectionPtr, RecordsetPtr and _CommandPtr
from msado15.dll for database access...
One solution to this could be use of Temp tables.
As this process is used by a lot of different stored
procedures having a common
temp table to all will need something like 50 NUMERIC
fields, 50 VARCHAR fields
and so on, which doesn't seem like a very good solution
to this problem.
Sounds like something I would have done while in school,
implement a dumb solution.
So, please suggest me a solution as to how do I return
bulk data in the form
of recordsets from stored procedure.
Regards
ShrutiUse Out parameter mode
SQL> CREATE OR REPLACE procedure a1 (x OUT NUMBER, y OUT NUMBER) AS
2 BEGIN
3 x:= 1;
4 y:= 2;
5 END;
6 .
SQL> /
Procedure created.
SQL> SET SERVEROUTPUT ON
SQL> DECLARE
2 a NUMBER :=3;
3 b NUMBER :=4;
4 BEGIN
5 a1 (a,b);
6 DBMS_OUTPUT.PUT_LINE( 'a = ' || a );
7 dbms_output.put_line( 'b = ' || b );
8 END;
9 .
SQL> /
a = 1
b = 2
PL/SQL procedure successfully completed.By default parameters are copied to the OUT parameter mode .
COPY hint in PLSQL don’t send a pointer to calling program unit but NOCOPY
does.
Khurram -
Ora-06550 returning data from Stored Procedure and Entity Data Model
Hi.
I'm creating an application that uses a WCF Service to return data. I also created a proyect with the EDMX design and mapped most of my DBModel to a classes context. I have added some of the procedures as well. One of them receive some parameters and return a Sys_RefCursor, that is populated according to the parameters.
I have declared the "<add >" tags in the Web.Config and imported the function of the Procedure. When I call the Asyncronous function I get different exceptions:
1. If I call the function, with all of the parameters i get:
Oracle.DataAccess.Client.OracleException: ORA-06550: línea 1, columna 8:
PLS-00306: número o tipos de argumentos erróneos al llamar a
'SP_HECHOSJURITER'
ORA-06550: línea 1, columna 8:
(wrong number or types of arguments in call to 'SP_HECHOSJURITER')
2. If i just set 1 parameter in the SP, returning the same type of data, I get:
Error al recibir la respuesta HTTP a
http://localhost/Procalculo.CGFM.SIGOC.DatosServices/ServiceDatos.svc.
(failed to receive http response. error 12152)
3. If I don't set any parameters in the procedure, it works fine, and return correct data.
It exclusively happen with one entity.
Any clue?
I appreciate any help.When you return result sets from stored procedures to Entity Framework, you are very likely using implicit result sets. Implicit result sets don't need to be declared as a parameter in code, only in the <add> tags to define the metadata in the .NET config file.
For example, in the EF Oracle By Example, you'll see that the stored procedure in the function import has three parameters, but only two are declared in the code. The third one was defined in the config file.
http://download.oracle.com/oll/obe/EntityFrameworkOBE/EntityFrameworkOBE.htm -
Displaying data from multiple columns into a single line graph
Post Author: hollowmatrix
CA Forum: WebIntelligence Reporting
Hey,I have an issue with the WEBI reporting.I have a data source that has multiple columns say ( month1, month2, month3, month4,.....month 12, month 13, ....month24) with the sales data for each month.Now say I call the month 1 to month 12 as "current year", and call month 13 - month 24 as "previous year".I want to put a prompt in the report which allows me to select between "current year" and "previous year".Based on the prompt value we get a graph of the sales vs month ....as in if we select "current year", then we get a graph of the sales Vs time( remember that the sales data for each month is in a different column.)and if we select "previous year" then we get a graph of the sales Vs time for previous year..( sales vs time for Month 13, month 14, month 15....month 24).I am not able to pull data from multiple columns into a single object that I can use to populate the graphs.Any help on the same will be appreciated .Hi,
<p>
please click
here (asktom) and look for the words "how about the other way round"
</p> -
Web Service receives no data from Stored Procedure call.
Issue: When calling a Stored Procedure from a Web Service no data is returned.
Lead up: I can call the SP 100 times a day for 3-4 days then for some reason the Web Service no longer get the data from SQL. I have ran a trace and I can see the SP running though all of its steps and returning the data, but the Web Service
is not getting it.
Fix: None yet.
Work around: Before the Web Service calls the SP, I am sending an SP_Recompile to the SP in question. For now this seems to have resolved the issue.
Detail:
1. SP is querying data from another DB on the same server.
2. SP is storing query data in Temp Tables.Hello,
Does your Stored Procedure have parameters? If so, the issue may be cause by parameter sniffing. Please refer to the following blog about Paraemeter Sniffing:
http://www.sommarskog.se/query-plan-mysteries.html
The recommended fix for most situations is to not use parameters directly in queries, but rather store them into local variables and then use those variables in the queries.
Regards,
Fanny Liu
If you have any feedback on our support, please click here.
Fanny Liu
TechNet Community Support -
Accessing Data from Stored Procedure using CallableStatement
I have created a Stored Procedure as shown , IS it possible to access these data inside my JDBC Program ??
CREATE or replace PROCEDURE getEmpName(EMP_NUM IN NUMBER)
is
CURSOR C1 is select from emp ;*
C2 c1%rowtype;
BEGIN
open c1;
loop
fetch c1 into c2;
exit when c1%NOTFOuND;
end loop;
END ;
*CallableStatement cs = conn.prepareCall("{call getEmpName(?)}");*What do you mean by :
IS it possible to access these data inside my JDBC Program ??JDBC provide/helps to execute a stored proc. when we say executing a proc, it actually executes on DB. So if a proc is written which has in and out parameter. and if does some work based on in parameter and returns the result in out parameter. Here if you mean, like can i read the out parameter and check what it has returned, then yes you can access this data from JDBC.
CREATE or replace PROCEDURE getEmpName(EMP_NUM IN NUMBER)
is
CURSOR C1 is select from emp ;*
C2 c1%rowtype;
BEGIN
open c1;
loop
fetch c1 into c2;
exit when c1%NOTFOuND;
end loop;
END ;
/But in your above proc it has only in parameter, no out parameter and has only select. so you could execute the proc using JDBC. -
OIM: Retrieve data from stored procedure, pre populate it in Resource form
Hi,
I need to retrieve data form a stored procedure that i have created . This data needs to be per populated in the Iplanet resource from. The stored procedure will have one input string and one output string.
Thankz,
Sanjay Rulez1. Prepare OIM Admin Console to interact with an Oracle Database, by adding jdbc jar files in the lib Directory of OIM Console.
2. Restart OIM Console and Create a database Resource
3. Create an Pre-populate adapter Task with a "Stored Procedure" Type
4. Invoke you Procedure.
The main problems can be around datatype conversion between Java and Oracle database.
For instance, all Oracle NUMBER type are mapped on java LONG type, and you need to deal every time with conevsrion between INTEGER and LONG in the adapter task. -
Multiple result sets from stored procedure into CachedRowSet
How can you obtain multiple sets of data from a stored procedure that returns multiple result sets, when you'd like to use CachedRowSet rather than ResultSet?
My database's stored procedures return multiple result sets, but I'm not sure how to manipulate that using CallableStatements and CachedRowSets... I read the RowSet tutorial from java.sun.com but that didn't cover the case of multiple result sets and CallablStatements.
How might I do this? Thanks a lot.SELECT columns..
FROM table
FOR XML PATH('NodeName'),('Rootname')
Thank you for replying.
I dont have to generate XML from a query. I have to generate from a SP and that too without modifying it.
Thanks,
Tauhid
thats ok you can do like this
1. Create a table with structure same as SP resultset
2. Populate table with SP result as per below
INSERT table
EXEC SPName param1value,...
3. Add a query like below
SELECT columns..
FROM tablename
FOR XML PATH('NodeName'),('RootName')
see
http://visakhm.blogspot.com/2014/05/t-sql-tips-fun-with-for-xml-path.html
4. Use sp_send_dbmail to sent it through mail
http://msdn.microsoft.com/en-IN/library/ms190307.aspx
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
JDBC - How to Get Data from Stored Procedure?
Gurus,
I am using Oracle Thin JDBC driver. A stored procedure has an IN parameter and an OUT parameter. The type of OUT parameter is TABLE of RECORD which is defined in the PL/SQL package in which the stored procedure is included. My question is if there is any way to call this stored procedure and process the data returned by the OUT parameter in my Java code.
Thanks.
Larrydefine in the pl/sql block as a cursor
register the out parameter as an oracle.cursor
on the java program get an object (from the statement), casting it to an resultset and then you can work on it -
Displaying data from a list into a single field with comma separated values
Hi,
I have a requirement to change a report with an XML structure (simplified version) as below
<Protocol>
<ProtocolNumber>100</ProtocolNumber>
<SiteName>Baxter Building</SiteName>
<ListOfActivity>
<Activity>
<Description>Communication Memo Description.</Description>
<Name>James</Name>
</Activity>
<Activity>
<Description>Visit 4</Description>
<Name>James</Name>
</Activity>
<ListOfActivity/>
</Protocol>
On the report I need to display all the 'Names' for each of the Child (Activities) in a single field at the Parent (Protocol) level, with each Name separated by a comma.
How do I go about getting this to work?
ThanksTake a look at this: http://blogs.oracle.com/xmlpublisher/entry/inline_grouping
You could do this (ofcourse, you will need to add extra logic to ensure that there is no comma added after the last name..)
<?for-each@inlines:Name?><?.?><?', '?><?end for-each?>
Thanks,
Bipuser -
Access 2010 - How to display data from a table into a text box upon combo box selection?
Hi
I have a a table with 5 columns: month, year, USD, SGD, BAHT.
I created a form with a combo box for selection of the month and year, and I would like to set adjacent text boxes to show USD, SGD, BAHT information. How can i go about doing that?
From the Q&A here, most of them uses the function similar to this "=[Combo0].[Column](1)" to show the data in the text box, but this would require the combo box to list a whole bunch of details if i were to add in more currency values to the
table. Is it possible to not show this information in the combo box, but still populate data in the textboxes base on a selection on only the "month" and "year" in the combo box.Hi,
According to your description, my understanding is that you want to show only the month/year in the combo box, we can choose the date, and it will display the value of USD/SGD/BAHT based on the month/year.
If it is, I recommend you try the steps:
Create a form based on your data source table>Add the combo box>combo box wizard>Find a record on my form based on the value I selected my combo box>Add mouth and year to selected fields
http://office.microsoft.com/en-us/access-help/create-a-list-of-choices-by-using-a-list-box-or-combo-box-HA010113052.aspx
If I misunderstand something, please let me know. We may upload some screenshots or a sample through OneDrive.
Regards,
George Zhao
TechNet Community Support -
What is the best approach to return Large data from Stored Procedure ?
no answers to my original post, maybe better luck this time, thanks!
We have a stored proc (Oracle 8i) that:
1) receives some parameters.
2)performs computations which create a large block of data
3) return this data to caller.
compatible with both ASP (using MSDAORA.Oracle), and ColdFusion (using Oracle ODBC driver). This procedure is critical in terms of performance.
I have written this procedure as having an OUT param which is a REF CURSOR to a record containing a LONG. In order to make this work, at the end of the procedure I have to store the working buffer (an internal LONG variable) into a temp table, and then open the cursor as a SELECT from the temp table.
I have tried to open the cursor as a SELECT of the working buffer (from dual) but I get the error "ORA-01460: unimplemented or unreasonable conversion requested"
I suspect this is taking too much time; any tips about the best approach here? is there a resource with REAL examples on returning large data?
If I switch to CLOB, will it speed the process, be compatible with callers, etc ? all references to CLOB I saw use trivial examples.
Thanks for any help,
Yoram AyalonCreate a new farm in the secondary Data Center at the same patch level with the desired configuration. Replicate the databases using the method of choice (Mirroring, AlwaysOn, etc.). Create a downtime window where you can then attach the databases to the
new farm's Web Application(s)/Service Application(s).
Trevor Seward
Follow or contact me at...
  
This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs. -
Hi,
How do I return two values from a
stored procedure into an "Execute SQL Task" please? Each of these two values need to be populated into an SSIS variable for later processing, e.g. StartDate and EndDate.
Thinking about stored procedure output parameters for example. Is there anything special I need to bear in mind to ensure that the SSIS variables are populated with the updated stored procedure output parameter values?
Something like ?
CREATE PROCEDURE [etl].[ConvertPeriodToStartAndEndDate]
@intPeriod INT,
@strPeriod_Length NVARCHAR(1),
@dtStart NVARCHAR(8) OUTPUT,
@dtEnd NVARCHAR(8) OUTPUT
AS
then within the SSIS component; -
Kind Regards,
Kieran.
Kieran Patrick Wood http://www.innovativebusinessintelligence.com http://uk.linkedin.com/in/kieranpatrickwood http://kieranwood.wordpress.com/Below execute statement should work along the parameter mapping which you have provided. Also try specifying the parameter size property as default.
Exec [etl].[ConvertPeriodToStartAndEndDate] ?,?,? output, ? output
Add a script task to check ssis variables values using,
Msgbox(Dts.Variables("User::strExtractStartDate").Value)
Do not forget to add the property "readOnlyVariables" as strExtractStartDate variable to check for only one variable.
Regards, RSingh -
Writing from Stored Procedure directly into a file...
Hi guys,
I would like to write the results of a stored procedure into a file. Indeed, I am calling a Stored Procedure from a script and I would like to write the result of that procedure to a file and not a table.
Thanks guys,
PipocaHi,
The UTL would be nice, but since I am calling the procedure from a unix script and *I wanted to keep the file in the unix machine* I don't believe this is the solution.UTL_FILE - will refers to a directory - which resides on Server - I Hope your DB is placed on Unix and you script is exeucted from their only. Then obviously your resulted file and source exits on unix machine only.
HTH
- Pavan Kumar N
OCP- Oracle 9i/10g
http://oracleinternals.blogspot.com -
Best method to transfer large strings (XML data) to/from stored procedure
Hi!
I'm trying to call a PL/SQL procedure from Java. The procedure inputs a string (XML) that is parsed, and returns a result string (also XML).
Typical size of the string is 5kb -> 1mb.
I can see two possible solutions:
1) String / LONG
2) CLOB (Using DMBS_LOB.createTemporary and getting a CLOB locator and passing the locator to the stored procedure)
Does anyone have other suggestions?
What is the fastest method for transferring XML structures from to and from stored procedures?
AndersAnders,
I would say it depends on your requirement. Both the methods have some advantages and disadvantages.
Using a CLOB means that you have to use vendor specific libraries but this is more extendible and I fast too.
Using String/Long will be more portable in the long run but again you lose on speed/performance.
Just a doubt of mine... If I got it correct, you are transforming one XML to another XML based on some conditions. Why dont you use XSL and XSL StyleSheet Processor packaged with XDK for this? I think this would be the fastest way.
Hope this helps.
Maybe you are looking for
-
I had to get my phone replaced, I did back it up. However when I went to sync my itunes to my phone, now ALL my music is all of the sudden not able to be found. As you can imagine I'm quite ******. Anyone know anything of this? I also updated my itun
-
Ref: Nilesh Ranasinghe : MSS E-Recruitment
Hi Nilesh I m facing the same error mentioned below whihc is posted by you in SAP HCM group... Hi All, We are implementing MSS Business Package. The client has already implemented E-Recruitment and it resides in diferent box. Under 'My Team' there
-
Plants / Excise Group / Series while preparing Purchase Orders, Sales Orde
Dear all, sap gurus plz do need ful Presently we are making some mistakes by selecting wrong Plants / Excise Group / Series while preparing Purchase Orders, Sales Orders, GRIR and Invoices. We need to make it mandatory to select respective Plant /
-
Problem with broadcom driver (wl) - can't set essid
After a long history of failure installing linux on Mac hardware, I thought I'd try once again try installing Arch a MacBook (4,1) containing the Broadcom BCM4328 wireless card. I followed the instructions on this wiki page (http://wiki.archlinux.org
-
Best Practical JSP Book for PHP developer
Hi Friends, I am new to JSP and want learn basics of JSP so that I can do simple web page works. I am a PHP developer with one and half years of experience. Can anybody tell me what is the best JSP book for beginners or any web link with lots of simp