Dynamic query from Infopath
Greetings. My ultimate goal is to be able to type in an account number in a browser enabled InfoPath form textbox and have it retrieve information about that account (customer's name, address, etc.). I've set up an External content type
to a SQL table with 100,000+ rows and created the external list to hold the data (after disabling the throttling limits). I set a filter when creating the ECT and can't filter the data any more for my purposes. I increased the data
connection timeouts and response sizes in InfoPath just to see how long it would take to retrieve this data in InfoPath so that I could use a form to interface and query the data. The performance of the form is unacceptable to me as it took nearly 7
minutes to load. So, my question: are there alternatives to custom code that will work for my situation? Can I somehow dynamically set the content type filter through an InfoPath field so that I need not query all 100,000 records? I
know I can dynamically adjust a querystring directly to SQL through C# or VB but I'm trying to avoid that because I want to publish my form as a site content type (as opposed to an administrator approved form template).
Thanks in advance.
Andy
Hi,
According to your post, my understanding is that you wanted to dynamic query from Infopath.
I recommend to add code to the "click" event of a button to modify a SQL Server secondary data connection to use a "filter" from your form.
Here is a similar thread for your reference:
http://social.technet.microsoft.com/Forums/en-US/5aa4519c-b8e0-4a7c-85b4-09f7e1d0747a/dynamic-sql-data-connection-in-infopath?forum=sharepointcustomizationprevious
Best Regards,
Linda Li
Linda Li
TechNet Community Support
Similar Messages
-
XSQL File - Dynamic query from standard Browser - XML response.
Hi, this is my first post !
I need to query an Oracle DB from the web browser and get the data in XML format.
I've made some progress but they're still not enough.
I wrote a FIXED query from JDeveloper XSQL File (here is my big lack of knowledge) and then I compiled it, and run it. Doing so, a tcp service listening to specific port was created. (I also have a program called lsnrctl running at server side). For example:
http://IP:PORT/Application1-test1-context-root/query.xsql
Ok, pointing that address from explorer, I happily have the result of my FIXED query in XML format:
<?xml version="1.0" encoding="windows-1252"?>
<ROWSET>
<ROW NUM = '1'>
<field_1>value_1</field_1>
<field_2>value_2</field_2>
<field_3>value_3</field_3>
<field_4>value_4</field_4>
</ROW>
<ROW NUM = '2'>
<field_1>value_A</field_1>
<field_2>value_B</field_2>
<field_3>value_C</field_3>
<field_4>value_D</field_4>
</ROW>
</ROWSET>
BUT I need to pass the query as a DYNAMIC parameter. Something like:
http:IP:PORT/...?SQL="SELECT * FROM MY_TABLE WHERE my_condition ORDER BY my_column" from the browser.
Please, I will appreciate any suggestion, to put me in the right way!!
I am struggling to find out the solution since last two weeks!
Thank you in advance !
JMOk,what I needed was this xsql file:
<?xml version = '1.0' encoding = 'windows-1252'?>
<page xmlns:xsql="urn:oracle-xsql" connection="jdbc/user_xsql_1DS">
<xsql:query max-rows="-1" null-indicator="no" tag-case="lower">
{@sql}
</xsql:query>
</page>
So, from the web browser i can pass ?sql=MY_GENERIC_QUERY. And it works just as I expect.
BUT. I tried this running Embedded OC4J Server (from the IDE). The last step I need is to achive the same result but from a generic web server like Apache.
If I copy the .xsql file to ../htdocs/ the root apache directory for documents, and I ask for http://localhost/query.xsql what I get is the QUERY but not the RESPONSE. I don't get the values from the selected table, what I get again is:
<?xml version = '1.0' encoding = 'windows-1252'?>
<page xmlns:xsql="urn:oracle-xsql" connection="jdbc/user_xsql_1DS">
<xsql:query max-rows="-1" null-indicator="no" tag-case="lower">
{@sql}
</xsql:query>
</page>
Can anybody guide me to configure Apache in order to get the resulting XML, not my query!!
Thank you in advance!
Juan Manuel -
How to dynamically query from an LOV CO?
Hi,
I have a page and AM
I also have an LOVVO linked to LOVAM.
The LOV Vo is query based and contains a whereclause like user_id = :1
I have created a LovRN and LovCO based on the RN
I want to filter LOV values based on logged in user ID during PR
How to dynamicaly invoke the execute query from Lov CO PR() ?
I have written a method in LOV AM and when I try to invoke it from Lov CO, i get an error 'Method does not exist'. Should I write the method in Room AM?
In case I write the method in Root AM (linked to OA pages), how can I access the LOV VO as it is assigned to LOv AM only.
Thanks,
KamathHi
write this code in CO
OAApplicationModuleImpl am =
(OAApplicationModuleImpl) pageContext.getApplicationModule(webBean);
System.out.println("Inside CO");
am.invokeMethod("initEmpVO");
write this code in AM
public void initEmpVO()
VacancyVOImpl vo = getVacancyVO();
System.out.println("Inside initEmpVO");
if(vo == null)
MessageToken errTokens[] = {
new MessageToken("OBJECT_NAME", "VacancyVO")
throw new OAException("AK", "FWK_TBX_OBJECT_NOT_FOUND", errTokens);
} else
vo.executeQuery();
System.out.println("Execute Query");
Thanks
Nilesh -
Finding minimum value in each row using dynamic query
need to find the minimum and maximum value from each row using dynamic query
[from curr] will be given as input
TukyDECLARE @t TABLE(a INT,b INT,c INT);
INSERT @t VALUES(1,2,3),(9,8,7),(4,6,5);
SELECT *
, ( SELECT MAX(val)
FROM (VALUES (a)
, (b)
, (c)
) AS value(val)
) AS MaxVal
, ( SELECT MIN(val)
FROM (VALUES (a)
, (b)
, (c)
) AS value(val)
) AS MinVal
FROM @t;
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
i am calling a report from a 10g form. i wanna to pass a dynamic query from form to report. I am able to perform this with 6i but can't using 10g. is there any way to create a dynamic query in reports 10g
thanksActually, i am creating the whole query upon based on a condition in form, then i am passing this query to report via a data parameter. following is the some part of code, which i am using
IF :CONTROL.VOUCHER_FORMAT='S' THEN
V_QUERY:=('select bvno vno,bvdate vdate from bvrm where bvno ='''||:vno||''' AND bvrm.bvdate='''||:VDATE||''' and ccode='''||:PARAMETER.ccode||''' and fycode='''||:PARAMETER.fycode||''' AND BVRM.BVTYPE='''||:VTYPE||''' GROUP by bvdate,bvno');
else
V_QUERY:=('select bvno vno,bvdate vdate from bvrm where bvrm.bvdate BETWEEN '''||TO_DATE(:FROMDATE,'DD/MM/YYYY')||''' AND '''||to_date(TO_DATE(:TODATE,'DD/MM/YYYY')+1)||''' and ccode='''||:PARAMETER.ccode||''' and fycode='''||:PARAMETER.fycode||''' AND BVRM.BVTYPE = '''||:VTYPE||''' GROUP by bvdate,bvno');
end if;
RG_ID:=CREATE_GROUP_FROM_QUERY(RG_NAME,V_QUERY);
NUM:=POPULATE_GROUP(RG_NAME);
ADD_PARAMETER(PL_ID,'Q_MAIN',DATA_PARAMETER,RG_NAME);
after this code, i am calling the run_report_object normally. this code works fine with 6i, but doesn't with 10g
thanks -
Duplicate records for Dynamic Query in WLS 7
I am getting duplicate records back when I run a dynamic query. If I run the same
query via a finder method, I get the correct results.
Here's the query:
SELECT DISTINCT OBJECT(a) FROM Company AS a, b IN a.userRole WHERE b.userId = ?1
AND a.deptId IN ('1', '2', '3')
Company EJB maps to LU_Company (look up table for company)
Company to UserRole is a one-to-many relationship.
The number of duplicates is equal to the number of records I have for the same company_id
in User_Role table.
The ids for the object I should get back are 1, 2, 3.
Instead I get back 1, 1, 2, 2, 2, 2, 2, 3, 3, 3
In the database, company_id 1 occurs twice in user_role table; company_id 2 occurs
five times.
Any ideas of why the dynamic query has this problem whereas the same query for a
finder method works fine?
Thanks for your help.Thanks Greg, that worked!
"Greg Nyberg" <greg.nyberg.at.objectpartners.com> wrote:
You can supply properties on the query request, perhaps there is a
SQL_SELECT_DISTINCT property:
Properties p = new Properties();
p.setProperty("GROUP_NAME", "fieldgroup");
p.setProperty("INCLUDE_UPDATES", "true");
p.setProperty("SQL_SELECT_DISTINCT", "true");
Collection people = myQuery.find(
"SELECT OBJECT(o) FROM PersonCMPEJB o WHERE o.lastName = 'Smith'", p);
-Greg
Check out my WebLogic 6.1 Workbook for O'Reilly EJB Third Edition
www.amazon.com/exec/obidos/ASIN/1931822468 or www.titan-books.com
"Mike" <[email protected]> wrote in message
news:[email protected]...
Matt,
<sql-select-distinct> needs to be set in <weblogic-query> element. I amgenerating
a dynamic query from within a local client. So I don't have a finderdefined for
this method. (I don't want to define a finder for this method). How doyou suggest
I can use this? Thanks again for your help.
Matthew Shinn <[email protected]> wrote:
Hi Mike,
I just filed a bug report for this (CR079471). As a work around, you
can
use the
setSQLSelectDistinct flag so the database will weed out the duplicates.
The only thing to
look out for when using this flag is that Oracle will not allow the use
of 'SELECT DISTINCT'
in conjunction with a 'FOR UPDATE' clause, thus,<sql-select-distinct>True
CANNOT be used if
any Bean in the calling chain has a method with <transaction-isolation>
set to
<isolation-level>TRANSACTION_READ_COMMITTED_FOR_UPDATE. Sorry for theinconvenience.
- Matt
Mike wrote:
I am getting duplicate records back when I run a dynamic query. If
I
run
the same
query via a finder method, I get the correct results.
Here's the query:
SELECT DISTINCT OBJECT(a) FROM Company AS a, b IN a.userRole WHERE
b.userId
= ?1
AND a.deptId IN ('1', '2', '3')
Company EJB maps to LU_Company (look up table for company)
Company to UserRole is a one-to-many relationship.
The number of duplicates is equal to the number of records I have forthe same company_id
in User_Role table.
The ids for the object I should get back are 1, 2, 3.
Instead I get back 1, 1, 2, 2, 2, 2, 2, 3, 3, 3
In the database, company_id 1 occurs twice in user_role table;
company_id
2 occurs
five times.
Any ideas of why the dynamic query has this problem whereas the same
query
for a
finder method works fine?
Thanks for your help. -
Returning a result set/record from a dynamic query
There seems to be plenty of examples for using Native Dynamic Sql to formulate and execute a dynamic query, however there are no examples of returning a result set or records which contain the rows of data that are retrieved by executing the query. Could someone give us an example?
Welcome to the Oracle forum....
CREATE OR REPLACE PACKAGE curspkg_join AS
TYPE t_cursor IS REF CURSOR ;
Procedure open_join_cursor1 (n_EMPNO IN NUMBER, io_cursor IN OUT t_cursor);
END curspkg_join;
Create the following Oracle package body on the Oracle server:
CREATE OR REPLACE PACKAGE BODY curspkg_join AS
Procedure open_join_cursor1 (n_EMPNO IN NUMBER, io_cursor IN OUT t_cursor)
IS
v_cursor t_cursor;
BEGIN
IF n_EMPNO <> 0
THEN
OPEN v_cursor FOR
SELECT EMP.EMPNO, EMP.ENAME, DEPT.DEPTNO, DEPT.DNAME
FROM EMP, DEPT
WHERE EMP.DEPTNO = DEPT.DEPTNO
AND EMP.EMPNO = n_EMPNO;
ELSE
OPEN v_cursor FOR
SELECT EMP.EMPNO, EMP.ENAME, DEPT.DEPTNO, DEPT.DNAME
FROM EMP, DEPT
WHERE EMP.DEPTNO = DEPT.DEPTNO;
END IF;
io_cursor := v_cursor;
END open_join_cursor1;
END curspkg_join;
Dim Oraclecon As New OracleConnection("Password=pwd;" & _
"User ID=uid;Data Source=MyOracle;")
Oraclecon.Open()
Dim myCMD As New OracleCommand()
myCMD.Connection = Oraclecon
myCMD.CommandText = "curspkg_join.open_join_cursor1"
myCMD.CommandType = CommandType.StoredProcedure
myCMD.Parameters.Add(New OracleParameter("io_cursor", OracleType.Cursor)).Direction = ParameterDirection.Output
myCMD.Parameters.Add("n_Empno", OracleType.Number, 4).Value = 123
Dim myReader As OracleDataReader
Try
myCMD.ExecuteNonQuery()
Catch myex As Exception
MsgBox(myex.Message)
End Try
myReader = myCMD.Parameters("io_cursor").Value
Dim x, count As Integer
count = 0
Do While myReader.Read()
For x = 0 To myReader.FieldCount - 1
Console.Write(myReader(x) & " ")
Next
Console.WriteLine()
count += 1
Loop
MsgBox(count & " Rows Returned.")
myReader.Close()
Oraclecon.Close()
The above code is working in one of our application; which is using ref cursor as result set and get from procedure. I hope you can found more code by google and/or search in this forum as well; if above code is not useful to you.
HTH
Girish Sharma -
How to get 100 latest hits from dynamic query?
Hello,
using a dynamic query like BTQAct returns the 100 first results.
I know how to change the number of results by setting parameter MAX_HITS, but is there a possibility to get the latest 100 results without getting all results and delete the oldest till 100 remains?
In GENIL_BOL_BROWSER I see additional parameters MATCH_TYPE, DROP_SEL_PARAMS_ALLOWED and SELECTION_HINTS, but I don't know, how to use them and what they are doing.
regards
MartinHi Martin,
All the bol parameters that you have mentione dwill not help you unfortunately.
The only facility provided in the wb ui as of now is to automatically customise the no of results (ie max hits),but not the order in which they are displayed.
Though there is a sort option in the table view,which can be enabled throguh html and you can sort the same on any of the date fields tha you have.BUt if you want to do any kind of xtra processing of the search results then you have to do it in eh_onsearch().Here after getting the results collection,you can filtre them on the basis that you want.If you do thsi,you will also be able to delete all the older from the result collection xcept for the 1st 100 like you said.This will ensure that the results are filetred only on the Ui level and no harm is done to the database entires as such. -
How to fetch indivdual rows from a dynamic query.
Hi,
I wish to fetch the individual rows returned from a dynamic query.
if my dynamic query is:
dyn_stmt := select col1, col2, col3
from tab1;
The query returns multiple rows.
Then how to fetch individual rows of this query ?
Please explain.declare
cur_test sys_refcursor;
c1 varchar2(30);
c2 number;
c3 date;
begin
dyn_stmt := select col1, col2, col3 from tab1;
OPEN cur_test FOR dyn_stmt;
LOOP
FETCH cur_test INTO c1, c2, c3;
IF cur_test%NOTFOUND THEN
EXIT;
END IF;
-- Process this row
END LOOP;
CLOSE cur_test;
END; -
Display results from dynamic query created and executed inside procedure
Hi;
I have created this code:
CREATE OR REPLACE PROCEDURE RunDynamicQuery(Var1 IN VARCHAR2, Var2 IN VARCHAR2, VAR3 IN VARCHAR2) AS
-- Do something
-- That ends up with a variable holding a query.... (just an example)
MainQuery :='select sysdate from dual';
end RunDynamicQuery;
How can I run this procedure and see the result on the dymanic query generated inside it?
BEGIN
compare_tables_content('VAR1','VAR2','VAR3');
END;
Expected Output for this given example:
20-05-2009 11:04:44 ( the result of the dymanic query inside the procedure variable MainQuery :='select sysdate from dual';)
I tested with 'execute immediate':
CREATE OR REPLACE PROCEDURE RunDynamicQuery(Var1 IN VARCHAR2, Var2 IN VARCHAR2, filter IN VARCHAR2) AS
-- Do something
-- That ends up with a variable holding a query.... (just an example)
MainQuery :='select sysdate from dual';
execute immediate (MainQuery );
end RunDynamicQuery;
BEGIN
compare_tables_content('VAR1','VAR2','VAR3');
END;
Output:"Statement processed'' (no sysdate displayed ! )
Please consider that the collums in the query are always dynamic... PIPELINE Table would not work because I would need to define a container, example:
CREATE OR REPLACE TYPE emp_tabtype AS TABLE OF emp_type;
FUNCTION RunDynamicQuery (p_cursor IN sys_refcursor)
RETURN emp_tabtype PIPELINED
IS
emp_in emp%ROWTYPE;
BEGIN
LOOP
FETCH p_cursor
INTO emp_in;
EXIT WHEN p_cursor%NOTFOUND;
PIPE ROW (...)That would be a nice solution, thanks :)
''For now'' I implemented like this:
My dynamic query now returns a single string ( select col1 || col2 || col3 from bla)
This way I don't have dynamic collumns issue, and from business side, this ''string'' format works for them.
This way I can use the pipelines to get the result out...
OPEN myCursor FOR MainQuery;
FETCH myCursor
INTO myRow;
WHILE (NOT myCursor%notFound) LOOP
PIPE ROW(myRow);
FETCH myCursor
INTO myRow;
END LOOP;
CLOSE myCursor; -
How to dynamically query oracle from SAPGUI
hi all,
there are so many facilities available in SAPGUI to query the database for checking it status etc etc. but these queries i guess are based on the last database check done using db13. if it is true can any body tell me how can i dynamically query the database as and when required. eg to check the status of the datafile etc.
if i check the "space statistics" in db02 is is based on the db13 database check. "refresh" is not feasible as it takes much longer time and puts load on produciton system.
regards
AijazYou could do a cost analysis on a SQL Statement to get to a screen where you can put in a straight SQL Statement (I think ST04 can get you there somehow, I don't know, I've move from Basis to BI, so I can't check to confirm if that's the right transaction). But I don't know if it will allow you access to non-schema owned tables such as dba_data_files.
Your best bet would be to have your Oracle DBA or OS or Basis group write a simple SQL query that is triggered at the OS level via sqlplus and maybe tie it to a command you could run ad-hoc via immediate job execution. -
Get alias name from dynamic query
Hi All,
I would make a plsql function using dynamic query.
And the function takes a whole sql query as a parameter.
The main issue is that the function should get what alias or columns were queried.
For example,
FUNCTION_GET_QUERY_ALIAS('SELECT 1 AS col1, 2 AS col2 FROM DUAL')
Inside the function, it should find the alias name COL1 and COL2.
I'd appreciate for any help.I have modified print_table as function and made it to satisfy your needs.
SQL> CREATE OR REPLACE TYPE my_column_object AS OBJECT(ruw_number integer, column_name VARCHAR2(1000), column_val VARCHAR2(1000))
2 /
Type created.
SQL> CREATE OR REPLACE TYPE my_table_type AS TABLE OF my_column_object
2 /
Type created.
SQL> CREATE OR REPLACE FUNCTION print_table( p_query in varchar2 ) RETURN my_table_type PIPELINED
2 AS
3 l_theCursor INTEGER DEFAULT DBMS_SQL.OPEN_CURSOR;
4 l_columnValue VARCHAR2(4000);
5 l_status INTEGER;
6 l_descTbl DBMS_SQL.DESC_TAB;
7 l_colCnt NUMBER;
8 l_rcount INTEGER := 0;
9 BEGIN
10 DBMS_SQL.PARSE( l_theCursor, p_query, dbms_sql.native );
11
12 DBMS_SQL.DESCRIBE_COLUMNS( l_theCursor, l_colCnt, l_descTbl );
13
14 FOR i IN 1 .. l_colCnt
15 LOOP
16 DBMS_SQL.DEFINE_COLUMN(l_theCursor, i, l_columnValue, 4000);
17 end loop;
18
19 l_status := DBMS_SQL.EXECUTE(l_theCursor);
20
21 WHILE ( DBMS_SQL.FETCH_ROWS(l_theCursor) > 0 )
22 LOOP
23 l_rcount := l_rcount + 1;
24 FOR i IN 1 .. l_colCnt
25 LOOP
26 DBMS_SQL.COLUMN_VALUE( l_theCursor, i, l_columnValue );
27
28 PIPE ROW(my_column_object(l_rcount,l_descTbl(i).col_name,l_columnValue));
29 END LOOP;
30 END LOOP;
31
32 RETURN;
33 end;
34 /
Function created.
SQL> select * from table(print_table('select * from emp'))
2 /
RUW_NUMBER COLUMN_NAME COLUMN_VAL
1 EMPNO 7369
1 ENAME SMITH
1 JOB CLERK
1 MGR 7902
1 HIREDATE 17-DEC-80
1 SAL 800
1 COMM
1 DEPTNO 20
1 DIV 10
2 EMPNO 7499
2 ENAME ALLEN
RUW_NUMBER COLUMN_NAME COLUMN_VAL
2 JOB SALESMAN
2 MGR 7698
2 HIREDATE 20-FEB-81
2 SAL 1600
2 COMM 300
2 DEPTNO 30
2 DIV 10
3 EMPNO 7521
3 ENAME WARD
3 JOB SALESMAN
3 MGR 7698
RUW_NUMBER COLUMN_NAME COLUMN_VAL
3 HIREDATE 22-FEB-81
3 SAL 1250
3 COMM 500
3 DEPTNO 30
3 DIV 10
4 EMPNO 7566
4 ENAME JONES
4 JOB MANAGER
4 MGR 7839
4 HIREDATE 02-APR-81
4 SAL 2975
RUW_NUMBER COLUMN_NAME COLUMN_VAL
4 COMM
4 DEPTNO 20
4 DIV 10
5 EMPNO 7654
5 ENAME MARTIN
5 JOB SALESMAN
5 MGR 7698
5 HIREDATE 28-SEP-81
5 SAL 1250
5 COMM 1400
5 DEPTNO 30
RUW_NUMBER COLUMN_NAME COLUMN_VAL
5 DIV 10
6 EMPNO 7698
6 ENAME BLAKE
6 JOB MANAGER
6 MGR 7839
6 HIREDATE 01-MAY-81
6 SAL 2850
6 COMM
6 DEPTNO 30
6 DIV 10
7 EMPNO 7782
RUW_NUMBER COLUMN_NAME COLUMN_VAL
7 ENAME CLARK
7 JOB MANAGER
7 MGR 7839
7 HIREDATE 09-JUN-81
7 SAL 2450
7 COMM
7 DEPTNO 10
7 DIV 10
8 EMPNO 7788
8 ENAME SCOTT
8 JOB ANALYST
RUW_NUMBER COLUMN_NAME COLUMN_VAL
8 MGR 7566
8 HIREDATE 19-APR-87
8 SAL 3000
8 COMM
8 DEPTNO 20
8 DIV 10
9 EMPNO 7839
9 ENAME KING
9 JOB PRESIDENT
9 MGR
9 HIREDATE 17-NOV-81
RUW_NUMBER COLUMN_NAME COLUMN_VAL
9 SAL 5000
9 COMM
9 DEPTNO 10
9 DIV 10
10 EMPNO 7844
10 ENAME TURNER
10 JOB SALESMAN
10 MGR 7698
10 HIREDATE 08-SEP-81
10 SAL 1500
10 COMM 0
RUW_NUMBER COLUMN_NAME COLUMN_VAL
10 DEPTNO 30
10 DIV 10
11 EMPNO 7876
11 ENAME ADAMS
11 JOB CLERK
11 MGR 7788
11 HIREDATE 23-MAY-87
11 SAL 1100
11 COMM
11 DEPTNO 20
11 DIV 10
RUW_NUMBER COLUMN_NAME COLUMN_VAL
12 EMPNO 7900
12 ENAME JAMES
12 JOB CLERK
12 MGR 7698
12 HIREDATE 03-DEC-81
12 SAL 950
12 COMM
12 DEPTNO 30
12 DIV 10
13 EMPNO 7902
13 ENAME FORD
RUW_NUMBER COLUMN_NAME COLUMN_VAL
13 JOB ANALYST
13 MGR 7566
13 HIREDATE 03-DEC-81
13 SAL 3000
13 COMM
13 DEPTNO 20
13 DIV 10
14 EMPNO 7934
14 ENAME MILLER
14 JOB CLERK
14 MGR 7782
RUW_NUMBER COLUMN_NAME COLUMN_VAL
14 HIREDATE 23-JAN-82
14 SAL 1300
14 COMM
14 DEPTNO 10
14 DIV 10
126 rows selected.
SQL>Thanks,
Karthick.
Edited by: Karthick_Arp on Sep 23, 2008 12:11 AM -
I have a site collection with multiple subsites. All of the subsites have a list called "Status" which is using content types for its column management.
I want to use a content query web part in the parent site level to query 1 item from everyone of these subsites. Is there a way to do this?
The only way I can do this is if I create an individual content query web part for each subsite as I did not find an option for my content query to query from multiple subsites at once.You can do it using CQWP. For instance, if you have a site column called 'Rollup' that is part of your content type, that will be part of all your subsites custom list 'Status'. On the root site CQWP set the source to 'Show item from the following site and
all subsites' and choose your root site (first image below). Then add 'additional filters' and set the value to 'Yes' as shown in second figure below; you will be able to roll up all the data to the root site like below. Now, you need to decide what query
field you will use that is unique and that can roll up.
Srini Sistla Twitter: @srinisistla Blog: http://blog.srinisistla.com -
How to find table name(s) in a dynamic query
In one of our (9iAS PORTAL)applications, any user can able to run their query statment and get output. All queries will be executed as dynamic SQL thru' a common shema/user who has 'SELECT' privilege on all tables but all users don't have this privilege on all tables. Now, before executing any query I need to find out what are the table name(s) used in this query to check the privilege for the respective user. How do I extract all table names being used in a dynamic query?.
Thanks
-KrishnamurthyI guess that his users log in to application first, then application uses one account to log in to database, so application are not direct database user since all users share the same account to database. If so, when a user lgins in, you may write it down from application to a database audit table, and you need to write down the dynamic query to the database audit table too, then you may query that audit table to find out. up to here, it looks that your application has to do more to assign what role to a user running the application, since database does not know what user is assessing it.
-
Hi all;
Can u please help me on the following dynamic query code ? I know I am missing the single quote around 2 dates but could not figure out where to put it ! I have tried putting 2 or 3 quotes around 2 bind vars but to no avail.
Want to create a dynamic query to simulate the the following:
select
EMPNO,ENAME,JOB,MGR,HIREDATE from emp where HIREDATE >= to_date('01/01/1981','MM/DD/YYYY') and HIREDATE <= to_date('12/31/1982','MM/DD/YYYY');
dynamic code:
declare
v_q varchar2(4000);
begin
v_q :='select EMPNO,ENAME,JOB,MGR,HIREDATE from emp ';
V_q := V_Q
|| 'where HIREDATE >= '
|| 'to_date(' || :P_DATE1 || ',' ||'''MM/DD/YYYY''' || ' )'
|| 'and HIREDATE <= '
|| 'to_date(' || :P_DATE2 || ',' ||'''MM/DD/YYYY''' || ' )';
-- end the sql
v_q := v_q ||';';
dbms_output.put_line ('V_Q is ' || V_Q);
end;
Thanks.
Zendeclare
v_q varchar2(4000);
v_rec emp%rowtype;
v_cur sys_refcursor;
begin
v_q :='select EMPNO,ENAME,JOB,MGR,HIREDATE from emp ';
V_q := V_Q || 'where HIREDATE >= to_date(:P_DATE1,''MM/DD/YYYY'') and HIREDATE <= to_date(:P_DATE2,''MM/DD/YYYY'')';
dbms_output.put_line ('V_Q is ' || V_Q);
open v_cur
for v_q
using '01/01/1981',
'12/31/1982';
loop
fetch v_cur
into v_rec.empno,
v_rec.ename,
v_rec.job,
v_rec.mgr,
v_rec.hiredate;
exit when v_cur%notfound;
dbms_output.put_line('empno = ' || v_rec.empno);
dbms_output.put_line('ename = ' || v_rec.ename);
dbms_output.put_line('job = ' || v_rec.job);
dbms_output.put_line('mgr = ' || v_rec.mgr);
dbms_output.put_line('hiredate = ' || to_char(v_rec.hiredate,'MM/DD/YYYY'));
dbms_output.put_line('====================');
end loop;
close v_cur;
end;
V_Q is select EMPNO,ENAME,JOB,MGR,HIREDATE from emp where HIREDATE >=
to_date(:P_DATE1,'MM/DD/YYYY') and HIREDATE <= to_date(:P_DATE2,'MM/DD/YYYY')
empno = 7499
ename = ALLEN
job = SALESMAN
mgr = 7698
hiredate = 02/20/1981
====================
empno = 7521
ename = WARD
job = SALESMAN
mgr = 7698
hiredate = 02/22/1981
====================
empno = 7566
ename = JONES
job = MANAGER
mgr = 7839
hiredate = 04/02/1981
====================
empno = 7654
ename = MARTIN
job = SALESMAN
mgr = 7698
hiredate = 09/28/1981
====================
empno = 7698
ename = BLAKE
job = MANAGER
mgr = 7839
hiredate = 05/01/1981
====================
empno = 7782
ename = CLARK
job = MANAGER
mgr = 7839
hiredate = 06/09/1981
====================
empno = 7839
ename = KING
job = PRESIDENT
mgr =
hiredate = 11/17/1981
====================
empno = 7844
ename = TURNER
job = SALESMAN
mgr = 7698
hiredate = 09/08/1981
====================
empno = 7900
ename = JAMES
job = CLERK
mgr = 7698
hiredate = 12/03/1981
====================
empno = 7902
ename = FORD
job = ANALYST
mgr = 7566
hiredate = 12/03/1981
====================
empno = 7934
ename = MILLER
job = CLERK
mgr = 7782
hiredate = 01/23/1982
====================
PL/SQL procedure successfully completed.
SQL> SY.
Maybe you are looking for
-
I purchased an album on itunes and three of the songs won't download. I get an error message saying they have been corrupted and to try redownloading them, which I have tried. Under status, the files say "- stopped (err = -100000). Plese help!
-
ISync works for iCal but not for Address Book
Another lost soul. Can anybody suggest where I should start looking for the problem. I've just successfully modified my iSync so that it sees my brand new Nokia 6300. I have got the phone and my iMac to sync my calendar, but absolutely zero activity
-
Conversion of planned order into prd order
Dear Gurus Is it possible to convert planned order to prd order automaticaly ?Is there any setting in customising? thanks kk
-
What is the best file format to use with imovie?
I am relatively new to Mac and got it for music production, but more recently I have been messing around with video and a I have difficulty dealing with Mpeg and some other file types with imovie. My question is this, what file format will automatica
-
Firefox and Inserting an image
Just noticed this one this morning when I tried to put a logo into one of my posts. Clicking the Insert Image button will bring up the dialog box. But clicking the Browse button will cause Firefox to freeze and become unresposive. The only way out