Building recordset query dynamically based on form parameter availability
Hi,
I have a real estate property table that I'd like to query.
The form itself let's the user search by state, county, zip code
etc. The user need not enter all the information. For eg: If the
user just selects a state and searches, I should list all
properties that belong to that state. But if the user also selects
a county along with state then I should filter the results by state
AND county. This situation applies for a lot of the form
parameters.
Now, in Dreamweaver when I try to create a recordset, I want
to append
AND county = $_REQUEST['county']
to the end of my record set query if and only if the user
selected a county. If the user didn't select the county, I do not
want to have that as part of my query.
Is there an easy way to do this in DW? I understand that
variables let you define a default var. I donot even want to
specify a default value.
Any help is greatly appreciated.
Thanks!!
You'll have to write the code yourself but something like
this...
sqlString = "SELECT .... "
if user selects county (probably a drop down list) then
sqlString = sqlString + " AND county = " + $_REQUEST
then just send the sqlString to the server.
"flash0777" <[email protected]> wrote in
message
news:e40b1o$bok$[email protected]..
> Hi,
>
> I have a real estate property table that I'd like to
query. The form
> itself
> let's the user search by state, county, zip code etc.
The user need not
> enter
> all the information. For eg: If the user just selects a
state and
> searches, I
> should list all properties that belong to that state.
But if the user also
> selects a county along with state then I should filter
the results by
> state AND
> county. This situation applies for a lot of the form
parameters.
>
> Now, in Dreamweaver when I try to create a recordset, I
want to append
> AND county = $_REQUEST
> to the end of my record set query if and only if the
user selected a
> county.
> If the user didn't select the county, I do not want to
have that as part
> of my
> query.
>
> Is there an easy way to do this in DW? I understand that
variables let you
> define a default var. I donot even want to specify a
default value.
>
> Any help is greatly appreciated.
>
> Thanks!!
>
Similar Messages
-
How to build a query dynamically....
hi...i want to build a query dynamically. i don't want to build query by using string buffer. i want to create it directly by using sql query itself.
my situation is like this....i have four drop down list in a page. The user can search the things based on one or two or three or four selected values.
how to build a query for this kind of situation....pls let me know.
Edited by: success_shiva6mca on Mar 3, 2008 12:39 PMthere are two problems with building sql directly.
1. it allows sql injection
2.it allows XSS
google them and you will understand if you dont already.
I will recoment catching the values and using preparedStatements -
Can you change the data model query dynamically based on its parent query
Hi
Question:
I have a data model query q1 and q2 is the child of q1
Say q1 returns 2 rows and and
for the first row
i want q2 to be select 1 from table1
for the second row
i want q2 to be select 1 from table2
Basically i want to build the q2 dynamically
for each row fetched in q1.
Can this be done?
If so where do i write the code to achieve this
Thanx in advance.
SureshOne simple (but not very realistic) example:
1. DATABASE TABLES AND DATA
CREATE TABLE dept_all (
deptno NUMBER (2),
dname VARCHAR2 (20),
in_usa CHAR (1) DEFAULT 'Y')
INSERT INTO dept_all VALUES (10, 'DEPT 10', 'Y');
INSERT INTO dept_all VALUES (20, 'DEPT 20', 'N');
INSERT INTO dept_all VALUES (30, 'DEPT 30', 'Y');
CREATE TABLE emp_usa (
empno NUMBER (4),
ename VARCHAR2 (20),
deptno NUMBER (2))
INSERT INTO emp_usa VALUES (1001, 'EMP 1001', 10);
INSERT INTO emp_usa VALUES (1002, 'EMP 1002', 10);
INSERT INTO emp_usa VALUES (3001, 'EMP 3001', 30);
INSERT INTO emp_usa VALUES (3002, 'EMP 3002', 30);
CREATE TABLE emp_non_usa (
empno NUMBER (4),
ename VARCHAR2 (20),
deptno NUMBER (2))
INSERT INTO emp_non_usa VALUES (2001, 'EMP 2001', 20);
INSERT INTO emp_non_usa VALUES (2002, 'EMP 2002', 20);
2. DATABASE PACKAGE
Note that Oracle Reports 3.0 / 6i needs 'static' ref cursor type for building Report Layout.
So, in package specification we must have both ref cursor types, static for Report Layout
and dynamic for ref cursor query.
CREATE OR REPLACE PACKAGE example IS
TYPE t_dept_static_rc IS REF CURSOR RETURN dept_all%ROWTYPE;
TYPE t_dept_rc IS REF CURSOR;
FUNCTION dept_query (p_where VARCHAR2) RETURN t_dept_rc;
TYPE t_emp_rec IS RECORD (
empno emp_usa.empno%TYPE,
ename emp_usa.ename%TYPE);
TYPE t_emp_static_rc IS REF CURSOR RETURN t_emp_rec;
TYPE t_emp_rc IS REF CURSOR;
FUNCTION emp_query (
p_in_usa dept_all.in_usa%TYPE,
p_deptno dept_all.deptno%TYPE)
RETURN t_emp_rc;
END;
CREATE OR REPLACE PACKAGE BODY example IS
FUNCTION dept_query (p_where VARCHAR2) RETURN t_dept_rc IS
l_dept_rc t_dept_rc;
BEGIN
OPEN l_dept_rc FOR
'SELECT * FROM dept_all WHERE ' || NVL (p_where, '1 = 1') || ' ORDER BY deptno';
RETURN l_dept_rc;
END;
FUNCTION emp_query (
p_in_usa dept_all.in_usa%TYPE,
p_deptno dept_all.deptno%TYPE)
RETURN t_emp_rc
IS
l_emp_rc t_emp_rc;
l_table VARCHAR2 (30);
BEGIN
IF p_in_usa = 'Y' THEN
l_table := 'emp_usa';
ELSE
l_table := 'emp_non_usa';
END IF;
OPEN l_emp_rc FOR
'SELECT * FROM ' || l_table || ' WHERE deptno = :p_deptno ORDER BY empno'
USING p_deptno;
RETURN l_emp_rc;
END;
END;
3. REPORT - QUERY FUNCTIONS AND DATA LINK
FUNCTION q_dept RETURN example.t_dept_static_rc IS
BEGIN
-- "p_where" is a User Parameter
RETURN example.dept_query (:p_where);
END;
FUNCTION q_emp RETURN example.t_emp_static_rc IS
BEGIN
-- "in_usa" and "deptno" are columns from Parent Group (G_DEPT)
RETURN example.emp_query (:in_usa, :deptno);
END;
Of course, we must create Data Link between Parent Group (G_DEPT) and Child Query (Q_EMP).
Regards
Zlatko Sirotic -
Query Result based on the Parameter Form
Good Morning folks. I really couldn't come up with a smart enough Subject Line but I will try and make it up in the body.
I currently have a report that accepts Parameters on the Parameter Form. They are Employee ID# and Number of Copies. The Employee ID is stored in the Employee table but the number of copies is not.
The output on the Report shows all the different addresses and Phone Numbers the Employee has. Lets say, Employee ID 0001 has two addresses -- Home and Office. In the Report output based on my Query, it is going to return me two records in the Repeating Group. I however, have another parameter along with the Employee ID which is the Number of Copies. In this case, if the Number of Copies to be printed is 1, then its not an issue. However, if the Number of Copies entered by the User is 4, I would expect in that case 4 x 2 = 8 pages of Report output (4 with the Home Address and 4 with the Office Address).
I know there is way to do this using a Temporary table in AfterPForm and then using the results in the Query by joining my query to the Temporary table but I was really hoping to avoid this situation if it can be handled through the Query.
Main Query:
SELECT e.emp_no,
e.saln||e.first_name||' '||e.last_name emp_name,
a.street,
a.city||' '||a.province||' '||a.postal_code city,
'('||a.tel_area||') '||a.tel_number telephone
FROM employee e, emp_address a
WHERE e.emp_no = a.emp_no
AND e.emp_no = :P_EMP_NO;Any help is appreciated. Thanks!I think I have not explained my requirements clearly and I have missed some valuable information. I will go ahead and start again.
We do have quite a few reports with similar scenarios, so avoiding Temporary tables would be very beneficial if this works using Queries.
I have a Report that has a Parameter Form. This Parameter form has 6 fields in total.
Three of them belong to Customer ID# and 3 belong to Number of Copies.
User Parameters for Customers: P_CUST_ID1, P_CUST_ID2, P_CUST_ID3
User Parameters for the Number of Copies: P_N1, P_N2, P_N3
So, the field PF_CUST_ID1 would have a source with P_CUST_ID1 and the field PF_N3 would have a source P_N3
Form Paramater:
PF_CUST_ID1 ---------- PF_N1 ---
PF_CUST_ID2 ---------- PF_N2 ---
PF_CUST_ID3 ---------- PF_N3 ---So, at any given point, there could be a maximum of 3 Customer ID's passed to the main query. Here is an example of what the input parameters could look like.
User chose to enter values for Customer ID's 1 and 2 and left it blank for Customer 3.
Customer ID1 1001 Number of Copies 2
Customer ID2 1002 Number of Copies 3
Customer ID3 ---- Number of Copies -The Query that retrieves data looks something like this. The query below is intended to fetch Customer Home and Office Addresses.
Of course, it is possible that there might be No home or Office Address or both.
SELECT c.cust_no,
c.saln||c.first_name||' '||c.last_name cust_name,
a.address_type,
a.street,
a.city||' '||a.province||' '||a.postal_code city,
'('||a.tel_area||') '||a.tel_number telephone
FROM customer c, customer_address a
WHERE c.cust_no = a.cust_no
AND c.cust_no IN (:P_CUST_ID1, :P_CUST_ID2, :P_CUST_ID3);Based on my query:
Customer ID 1001 has 3 Addresses (2 Home and 1 Office) --> Total number of Records = 3
Customer ID 1002 has 2 Addresses (1 Home and 1 Office) --> Total number of Records = 2
The output should be something like this. I have put a Label Copy1, Copy2 and Copy3 to show
how the data will appear for readability.
Cust No Customer Name Address Type Address Line 1 Address Line 2 Telephone
Copy1
1001 Mr Robert Green H 2100 Picket Fences Vancouver BC V6E 2C9 (604)726-5555
1001 Mr Robert Green H 2300 Happy Valley Vancouver BC V6G 2N8 (604)308-5555
1001 Mr Robert Green O 1200 Davie Street Vancouver BC V1V 1X1 (604)211-5555
Copy2
1001 Mr Robert Green H 2100 Picket Fences Vancouver BC V6E 2C9 (604)726-5555
1001 Mr Robert Green H 2300 Happy Valley Vancouver BC V6G 2N8 (604)308-5555
1001 Mr Robert Green O 1200 Davie Street Vancouver BC V1V 1X1 (604)211-5555
Copy1
1002 Ms Cynthia Brown H 261 King Street W Calgary AB M5A 1N1 (416)432-5555
1002 Ms Cynthia Brown O 150 Bloor St W Calgary AB M1W 1S3 (416)321-5555
Copy2
1002 Ms Cynthia Brown H 261 King Street W Calgary AB M5A 1N1 (416)432-5555
1002 Ms Cynthia Brown O 150 Bloor St W Calgary AB M1W 1S3 (416)321-5555
Copy3
1002 Ms Cynthia Brown H 261 King Street W Calgary AB M5A 1N1 (416)432-5555
1002 Ms Cynthia Brown O 150 Bloor St W Calgary AB M1W 1S3 (416)321-5555
Scripts for the table creation and INSERTs
CREATE TABLE CUSTOMER
"CUST_NO" VARCHAR2(4 BYTE) NOT NULL,
"SALN" VARCHAR2(4 BYTE),
"FIRST_NAME" VARCHAR2(20 BYTE),
"LAST_NAME" VARCHAR2(20 BYTE),
CONSTRAINT "CUSTOMER_PK" PRIMARY KEY ("CUST_NO")
Insert into CUSTOMER values ('1001','Mr','Robert','Green');
Insert into CUSTOMER values ('1002','Ms','Cynthia','Brown');
Insert into CUSTOMER values ('1003','Dr','David','Taylor');
CREATE TABLE CUSTOMER_ADDRESS
"CUST_NO" VARCHAR2(4 BYTE) NOT NULL ENABLE,
"ADDRESS_TYPE" VARCHAR2(1 BYTE) NOT NULL ENABLE,
"STREET" VARCHAR2(20 BYTE),
"CITY" VARCHAR2(20 BYTE),
"PROVINCE" VARCHAR2(2 BYTE),
"POSTAL_CODE" VARCHAR2(10 BYTE),
"TEL_AREA" VARCHAR2(3 BYTE),
"TEL_NUMBER" VARCHAR2(10 BYTE)
Insert into CUSTOMER_ADDRESS values ('1001','H','2100 Picket Fences','Vancouver','BC','V6E 2C9','604','726-5555');
Insert into CUSTOMER_ADDRESS values ('1001','H','2300 Happy Valley','Vancouver','BC','V6G 2N8','604','308-5555');
Insert into CUSTOMER_ADDRESS values ('1001','O','1200 Davie Street','Vancouver','BC','V1V 1X1','604','211-5555');
Insert into CUSTOMER_ADDRESS values ('1002','H','261 King Street W','Calgary','AB','M5A 1N1','416','432-5555');
Insert into CUSTOMER_ADDRESS values ('1002','O','150 Bloor St W','Calgary','AB','M1W 1S3','416','321-5555');
Insert into CUSTOMER_ADDRESS values ('1003','O','435 Richmond Street','Calgary','AB','M5A 4T6','416','453-5555');Edited by: Roxyrollers on Jul 17, 2012 10:34 AM
Edited by: Roxyrollers on Jul 17, 2012 10:58 AM -
XML query results in HTML form parameter
Hi,
I would like insert records from a query result (raw XML) into HTML form tags, using the XSL stylesheet. Here is the code I am trying to use, but obviously it is not working.
<INPUT TYPE="hidden" NAME="te_hb_strdEntryId"
VALUE="<xsl:value-of select="ID"/>">
Are there any other options to put a result of a query in a hidden tag, using XSL?
Any help will be appriciated.<INPUT TYPE="hidden" NAME="te_hb_strdEntryId"
VALUE="<xsl:value-of select="ID"/>">
The correct syntax would be:
<INPUT TYPE="hidden" NAME="xxx">
<xsl:attribute name="VALUE">
<xsl:value-of select="ID"/>
</xsl:attribute>
however, there is a shortcut syntax
when you are using XPath expressions
in literal attribute values:
XSLT attribute value templates. They are
XPath expressions inside curly braces.
So, you can achieve your desired result
with the shorter form:
<INPUT TYPE="hidden" NAME="xxx" VALUE="{ID}">
as well. -
Hide or show a column based on a parameter?
I have a parameter that has two values linked to 2 fields and included in my SQL query. I would like to hide or show columns based on the parameter value chosen for other fields. How do I begin to write the expression?
Hi KittyCat101,
Based on my understanding, you want to display columns dynamically based on a parameter, right?
In your scenario, you can specify column visibility for all columns based on the expression which contains selected parameter values. So that if we select a value from the drop-down list of the parameter, the column will display based on the column visibility
expression. For more information, please refer to this article:
Conditionally Setting Column Visibility in SSRS.
If you have any question, please feel free to ask.
Best regards,
Qiuyun Yu
Qiuyun Yu
TechNet Community Support -
Adjusting frame size or Border size based on user parameter
Hi,
I'm using Oracle 10g developerr suite and working on Oracle reports. I've a requirement to change the frames in the report dynamically based on user parameter value. The same if possible I want to try with report border also.
If anyone have came across this kind of requirement could you please advise how can I proceed on this or Suggest first of all whether is it possible to achieve this requirement.
Anyone please suggest your views.
Thanks,
SubuThere is another way to change the frame automatically
this can be done by horizontally elasticity and vertical elasticity properties to the frame, You can set them as variable or expand to make them elastic due to the data -
Dynamic element binding between XML based PDF form and WDA context
Hi Experts,
I am working on a XML based interactive form.There is a table node in the XML interface which generated by WDA context, and binding on a subform in the PDF form.
I tried to add instances to the subform using javascript. Unfortunately, I can not get the internal table in WDA.
If I initialize the table to 10 lines in WDA , and then add 5 line to it in PDF, when I submit the PDF, I can only get 10 lines in the WDA framework. It seems that the element which is create dynamically can not be past to the interface.
Could you tell me why? And is there any other better solution? I just want build a table in PDF form in runtime and pass it to WDA context.
Thanks a lot!
Best Regards,
Guo Guo QingHi Thomas,
Thank you for your reply.
I think the performance will be a problem if I create the elment in WDA using submit event. I need to create hundreds of record dynamically. I must find some way to reduce the communication between the WDA and PDF form. Maybe I can set a container with a number of elements before the PDF output. Do you have some better ideas?
Best Regards,
Guo Guo Qing -
Bex report to report interface dynamically based on Value in the query
Hi,
Is it possible to change the destination of the report to report interface dynamically based on the data of the bex query?
For example my query has the below data
Plant | KPI | Quantity
P1 | A | 20.00
P2 | B | 25.00
When the user selects KPI A I want to navigate to Query 1, and when KPI B is selected to Query 2. Query 1 and Query 2 have completely different layouts, Instead of create to two destinations is it possible to pick one based on the KPI selected.
Is this possible in Bex report to report interface or any other way.
Please suggest
Thanks in advance.Hi
we have RRI in sap bw. ( TCODE RSBBS.)
Below article will enlighten you about this topic .
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/607e63d5-b56f-2c10-718f-8e33a08baa89?quicklink=index&overridelayout=true
hope this helps -
How to build a query based on(UNION) 3 vendor InfoObject
Dear Experts:
I have a requirement to build one query based on 3 vendor InfoObjct: 0VENDOR + 0VEN_COMPC + 0VEN_PURORG.
I tried to build a multiprovider upon these 3 infoobjects, but when I Identify(Assign) the key for each InfoObject, supposely there should be 3 InfoObject for me to check (0VENDOR, 0VEN_COMPC and 0VEN_PURORG) so that I can UNION these 3 infoobjects together on vendor number. But since the reference infoobject of these 3 vendor master data is different, I can not check the 3 together.
Can anybody let me know how to build that query? I only need vendor number show once, and the attributes of 0VEN_COMPC and 0VEN_PURORG can be union to 0vENDOR.
Any post would be appreciated and thank you all in advance!
Best Regards!
TimHi,
you can create a link between the vendor objects itself, means link 0vendor with 0ven_compc and 0ven_purorg. This should give you a list of all vendors multiplied with the comp codes multiplied with the purch. org. May be here it is possible to create another link between a attribute (eg. comp_code of 0ven_purorg with comp_code of 0ven_compc). In case it is not possible you need to add this link information somehow. Another option might be to create 2 queries. One on a infoset of 0vendor and 0ven_purorg and another one on 0vendor and 0ven_compc.
regards
Siggi -
Dynamic SQL in Form Builder 6.0
Hai,
I would like to know how to create Dynamic SQL in Form Builder 6.0. I'am using oracle 9i database...Please help me.....I studied the EXEC_SQL and i wrote these syntax(below), but it gives me error...Could you help me please......:
PROCEDURE Dynamic_sql IS
connection_id EXEC_SQL.CONNTYPE;
cursorID EXEC_SQL.CURSTYPE;
sql_string VARCHAR2(1000);
v_pc varchar2 (4);
v_pd varchar2 (30);
v_poc varchar2(4);
v_pvd DATE;
v_pid DATE;
exec_id PLS_INTEGER;
out_file TEXT_IO.FILE_TYPE;
linebuf varchar2(7000);
vchFileName VARCHAR2(100);
Vchfolder VARCHAR2(100);
AppID PLS_INTEGER;
nmbAlert varchar2(50);
BEGIN
SET_APPLICATION_PROPERTY(CURSOR_STYLE,'BUSY');
vchFileName := 'dynamic_sql_'||sysdate||'.txt';
Vchfolder := 'D:\KONS\Damar\';
host('mkdir '||Vchfolder,NO_SCREEN);
out_file := text_io.fopen(vchfolder||vchFileName,'w');
TEXT_IO.PUT_LINE (out_file,'PRODUCT CODE PRODUCT DESC PRODUCT OBJECT CODE PRODUCT VALID DATE PRODUCT INVALID DATE ');
connection_id := EXEC_SQL.OPEN_CONNECTION('FIFDBA/F1FDBA@REPL_DAILY');
cursorID := EXEC_SQL.OPEN_CURSOR(connection_id);
sql_string := 'SELECT PROD_CODE, PROD_DESC, PROD_OBJT_CODE, PROD_VALID_DATE, PROD_INVALID_DATE
FROM HOUS_PRODUCT_TYPE ';
EXEC_SQL.PARSE(connection_id, cursorID, sql_string, exec_sql.V7);
--EXEC_SQL.BIND_VARIABLE(connection_id, cursorID, '', input_empno);
EXEC_SQL.DEFINE_COLUMN(connection_id, cursorID, 1,v_pc, 4);
EXEC_SQL.DEFINE_COLUMN(connection_id, cursorID, 2, v_pd, 30);
EXEC_SQL.DEFINE_COLUMN(connection_id, cursorID, 3, v_poc, 4);
EXEC_SQL.DEFINE_COLUMN(connection_id, cursorID, 4, v_pvd);
EXEC_SQL.DEFINE_COLUMN(connection_id, cursorID, 5, v_pid);
exec_id := EXEC_SQL.EXECUTE(connection_id, cursorID);
WHILE (EXEC_SQL.FETCH_ROWS(connection_id, cursorID) > 0 ) LOOP
EXEC_SQL.COLUMN_VALUE(connection_id, cursorID, 1, v_pc, 4);
EXEC_SQL.COLUMN_VALUE(connection_id, cursorID, 2, v_pd);
EXEC_SQL.COLUMN_VALUE(connection_id, cursorID, 3, v_poc);
EXEC_SQL.COLUMN_VALUE(connection_id, cursorID, 4, v_pvd);
EXEC_SQL.COLUMN_VALUE(connection_id, cursorID, 5, v_pid);
TEXT_IO.PUT_LINE(out_file,v_pc || v_pd ||v_poc||v_pvd||v_pid);
--Forms_DDL('INSERT INTO TEMP VALUES('||''''||nRows||' '||v_state_id||''''||')');
--COMMIT_FORM();
END LOOP;
EXEC_SQL.CLOSE_CURSOR(connection_id, cursorID);
EXEC_SQL.CLOSE_CONNECTION(connection_id);
SET_APPLICATION_PROPERTY(CURSOR_STYLE,'DEFAULT');
TEXT_IO.FCLOSE(out_FILE); -
Dynamically assign email submission target based on form content
We need to be able to assign the email target on a given form dynamically based on user selection out of a pre-defined set - drop-down. Currently, you can only target the submissions to an email manually entered into the email field or have a separate form for each unique email submission target.
We have a branch-office model company and each office interacting with a given form is going to need some things on that form to change based on which office the person filling out the form is with.
Thanks.Thanks Randy.
Say we had an Agent Sales Information Form online in our intranet/portal - embeded, and it was visable by 20 branch offices. When a user fills out the form it needs to go to a single central office person as well as the administrative assistant and manager in the specific branch office that the user (form filler) is based out of.
Example:
Agent Sales Information Form
--> user selects 'I'm with Office A' from the drop-down menu --> form needs to go to: Central Office, Admin Assistant in Office A, Manager in Office A
--> user selects 'I'm with Office B' from the drop-down menu --> form needs to go to: Central Office, Admin Assistant in Office B, Manager in Office B
In FormsCentral I can put an email field on the form and direct the form submission to that email address or I can share a given form with a pre-defined set of people. What I can't do is have a single form with a drop-down menu for which branch office that user (form filler) is from and change the people the form submits to based on that choice. Having the users manually enter the email addresses of the people the form needs to be submitted to is a deal breaker.
While we're at it, other things on my list for an embeddable paperless forms solution:
- user can print the form -- automatically on submission or by 'print button' on the form
- user can download pdf copy of the form
- user can save a form for later completion (across browser sessions)
- upload pictures and have them display on the form (not just as attachments)
- API functionality to allow fields to be auto-populated with data from another system (eliminating the office selection drop-down menu in this example -- our portal knows what office the logged-in user is from and can tell the form if it would listen )
Thanks Randy. I appreciate your taking a look at this for me. -
Error when querying REST web services from web-based InfoPath form 2013 environment
Error when querying REST web services from web-based InfoPath form 2013 environment, we are trying to consume REST web service in InfoPath form ( SharePoint 2013 version)
http://spapp/sites/litigation/Intake/_api/web/lists/getbytitle('Email%20Profiles')/items(1)
it works in preview but does not when it is published. because of claim based authentication i m getting below error
The form cannot run specified query, the underlying connection was closed. An expected error occurred
same works in 2010 environment .. are we missing anything in 2013 servers?? please let me know how we can resolve it.. thank you
gurueveryone face this issue, nothing in event viewer, its easy to reproduce error at ur end also..
just you need to use below web service in infopath and populate some data on form load like id = 1 pull the title and try to set in form any field...the
list has one item thats all
guru -
Assigning a query dynamically to a cursor based on IF ELSE condotion
hello guys,
we are facing a problem while creating a procedure.
The procedure has been recreated in ORACLE from SQL SERVER 2005.
the problem is that in SQL server we can assign a query dynamically to a cursor so that it will be called at execution time.But this is not the case in oracle, i.e in Oracle its not allowed to assign a query to a cursor dynamically(OR IS IT...!!!)
the code is
vr_SQL varchar2(400);
declare
cursor ord_cur ; <-----cursor declaration
begin
If v_pIsScrutiny = 0 then +<--------------second condition+
vr_SQL:='Select NVL(ServiceID,0) ServiceID,OrdQty,+<-------query assignment to a variable+
NVL(DrugID,0) DrugID,NVL(ServiceAmount,0) Rate,OrdDtlID
from Orderdtl inner join ordermst on Orderdtl.OrdID = ordermst.OrdID
Where Orderdtl.OrdID in (Select OrdID From Ordermst Where OrdVisitID = vr_visitid
and TO_CHAR(ordermst.OrdDate,''DD-MON-YYYY'')
Between TO_CHAR(vr_pActivationDate,''DD-MON-YYYY'')
and TO_CHAR(vr_pExpiryDate,''DD-MON-YYYY'')
) And NVL(Orderdtl.Cancelled,0) = 0 And NVL(Orderdtl.PackageID,0) = 0
and NVL(Orderdtl.DrugID,0) = 0;';
Else +<--------------first condition+
Update OrderDtl Set PackageID = 0 , AllocationID = 0 , ConsumptionID = 0
Where OrdID in (Select OrdID From Ordermst Where OrdVisitID = vr_visitid)
And AllocationID = v_pHCPAllocationID;
vr_SQL:= 'Select NVL(ServiceID,0) ServiceID, +<-------query assignment to a variable+
OrdQty,NVL(DrugID,0) DrugID,NVL(ServiceAmount,0)
Rate,OrdDtlID
from Orderdtl inner join ordermst on Orderdtl.OrdID = ordermst.OrdID
Where Orderdtl.OrdID in (Select OrdID From Ordermst Where OrdVisitID = vr_visitid
and TO_CHAR(ordermst.OrdDate,''DD-MON-YYYY'')
Between TO_CHAR(vr_pActivationDate,''DD-MON-YYYY'')
and TO_CHAR(vr_pExpiryDate,''DD-MON-YYYY'')
) And NVL(Orderdtl.Cancelled,0) = 0 And NVL(Orderdtl.PackageID,0) = 0;';
end if;
ord_cur is vr_SQL; +<----------query assigned to a cursor variable+
ord_rec ord_cur%ROWTYPE;
if not ord_cur%ISOPEN then
open ord_cur;
end if;
loop
fetch ord_cur into ord_rec;
exit when ord_cur%NOTFOUND;So currently we are stuck with this problem.
Any solution would be of great help..
thank you841363 wrote:
hello guys,
we are facing a problem while creating a procedure.
The procedure has been recreated in ORACLE from SQL SERVER 2005.
the problem is that in SQL server we can assign a query dynamically to a cursor so that it will be called at execution time.But this is not the case in oracle, i.e in Oracle its not allowed to assign a query to a cursor dynamically(OR IS IT...!!!)The problem is that you are thinking in SQL Server terms and Oracle just isn't SQL Server.
You need to consider using ref cursors for such things (sys_refcursor) e.g.
SQL> CREATE OR REPLACE PACKAGE reftest IS
2 PROCEDURE test(P_no in number, cur_o OUT sys_refcursor);
3 end;
4 /
Package created.
SQL>
SQL> CREATE OR REPLACE PACKAGE body reftest as
2 PROCEDURE test(P_no in number, cur_o OUT sys_refcursor) as
3 myexc exception;
4 BEGIN
5 if P_no = 1 then
6 open cur_o for select empno, ename from emp;
7 elsif p_no =2 then
8 open cur_o for select deptno, dname from dept;
9 else
10 RAISE myexc;
11 END IF;
12 exception
13 when myexc then
14 raise_application_error(20991,'input must be 1 or 2');
15 end ;
16 end reftest;
17 /
Package body created.
SQL> var x refcursor;
SQL> exec reftest.test(1,:x);
PL/SQL procedure successfully completed.
SQL> print x;
EMPNO ENAME
7369 SMITH
7499 ALLEN
7521 WARD
7566 JONES
7654 MARTIN
7698 BLAKE
7782 CLARK
7788 SCOTT
7839 KING
7844 TURNER
7876 ADAMS
7900 JAMES
7902 FORD
7934 MILLER
14 rows selected.
SQL> exec reftest.test(2,:x);
PL/SQL procedure successfully completed.
SQL> print x;
DEPTNO DNAME
10 ACCOUNTING
20 RESEARCH
30 SALES
40 OPERATIONS
SQL> -
Value for a parameter based on another parameter value
Hi all,
i am using report 6i and 10g db.
I have to create a report based on some parameter values. For example
Two parameter named as P_emp_code and P_emp_name
In the first parameter p_emp_code has list of values like empcode emp_full_name ie like 0002108 Vanitha Lanet Mendez
when user select P_emp_code i want to display the fullname in p_emp_name .
I tried as follows in list of values
select emp_fullname from emp_master where emp_code=:p_emp_code
then getting error bind variable cannot be used
Please suggest a way .
Thanks
RincyHello,
The thing you are asking for set and editing the reports parameter form's value. Then i don't think you can do this by using the report parameter form.
But there are two alternatives for this task.
1. Create one form using form builder and pass the parameter and run the report from there. So, you can use the code as you showed in your first post.
2. Why don't you make this Title setting automatically? I Mean using the gender column (with decode/case condition) of same table.
-Ammad
Maybe you are looking for
-
How to open NEF files in PS 7.0 please
Hi I cannot open NEF files in PS 7.0. Any ideas please ?
-
"File Not Found" When opening a file in illustrator CS3
I having issues where when I click on a file it launches illustrator but then I get prompted with file not found. I then open illustrator and browse to the file and am to open it....any ideas? This one has me stumped.
-
Problem while Importing Transport Request
Hi Friends We are trying to import a transport request, while importing abap dictionary objects, in the log it is showing not imported. we have tried the same request in other system, but it works fine there. Can you please anyone explain what may be
-
Display WBS user defined fields
Hi Experts, I want to add one more user defined field in WBS detail screen. Previously my WBS detail screen has 3 user fields displayed already. So I choose "Ufield 4 WBS element" (PRPS-USR03) in OPUK and set it as Input. And then I set the name for
-
Help the weary - trying to upgrade from OS X 10.4.6 to 10.4.10
Hi all - I would greatly appreciate any help. I am trying to do an upgrade from 4.6 to 4.10. It is part of my software update list. The problem is that it is 300MB and the upgrade times out everytime I try to upgrade. The download gets slower and slo