can u pls help?
Main Topics
Browse All TopicsSay you have four tables in the db like the following (those are the table name and the columns)
Sales Table- Product_ID, Area_ID, Date, Amount
Product Table- Product_ID, P_Name
Area Table- Area_ID, A_Name
Time Table- Date, Month_ID, Quater
There are 3 item types in the oracle 6i form I created.
1.I have all the above mentioned column names in check boxes,
2.I have a place to input the time period e.g.: _____________ to ____________
3.and a button called Execute
At runtime the user ticks the check boxes (column names) that he wants to merge, inputs the time period
(e.g.: 01-JAN-2003 to 21-FEB-2003) and then he clicks on the Execute button.
What I would like is the code for the above. The code that will take the user inputs at runtime (both column names and the time period) execute the query and outputs the result on another window.
Please please help
urgent
Priti
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
This is what I tried..
here you check if the checkbox is checked in the form. If it is checked, the column name is passed to the SQLSTR’s select statement in the EXEC_SQL. If not checked its ignored.
__________________________
IF Checkbox_Checked(Sales.Pro
IF Checkbox_Checked(Sales.Are
ELSE
ignore
END IF; .
.
.
IF Checkbox_Checked(Time.Quat
END IF; END; __________________________
DECLARE
CONNECTION_ID EXEC_SQL.CONNTYPE;
CURSOR_NAME EXEC_SQL.CURSTYPE;
SQLSTR VARCHAR2(2000);
BEGIN
CONNECTION_ID:= exec_sql.open_connection('
CURSOR_NAME := exec_sql.open_cursor(CONNE
SQLSTR :=( SELECT Sales.Product_ID, Sales.Area_ID, Sales.Date, Sales.Amount,
Product.Product_ID, Product.P_Name,
Area.Area_ID, Area.A_Name,
Time.Date, Time.Month_ID, Time.Quater
FROM Sales, Product, Area, Time
WHERE ‘Sales.Product_ID= Product.Product_ID’||
‘AND Sales.Area_ID = Area.Area_ID ’||
‘AND Sales.Date = Time.Date ’||
‘AND DATE BETWEEN :D1 AND :D2';
exec_SQL.parse(CONNECTION_
rows_processed := exec_sql.execute( CONNECTION_ID,CURSOR_NAME)
exec_sql.close_cursor(CONN
exec_sql.close_connection(
END;
__________________________
I don’t know how to write the code to pass the chosen columns names from the checkbox checked statements to the SQLSTR in the EXEC_SQL and
EXEC_SQL’s SQLSTR to accept the parameters I’m sending using the checkbox checked statements. As you can see I am really lost. I have been trying for the last whole week but am not getting anywhere. Due the shear desperation I came here hoping for some help. Pls help me with the code.
Priti
I created one oracle 6i form, data block called “SALES_FACT” with columns from 4 tables. All these columns were taken to the form in the form of checkboxes. (The form also has a button). When a checkbox is clicked it has the value “Y”
I added the below coding in a WHEN-BUTTON-PRESSED trigger and it compiled without any errors.
My question is how do I write the EXEC_SQL’s SQLSTR..? Can I write it like the one I have shown? Please help?
DECLARE
v_select VARCHAR2(32000) := 'SELECT';
DATE_ID VARCHAR2(80) := 'SALES_FACT.DATE_ID';
MONTHI VARCHAR2(80) := 'SALES_FACT.MONTHI';
QUATER VARCHAR2(80) := 'SALES_FACT.QUATER';
PRODUCT_ID VARCHAR2(80) := 'SALES_FACT.PRODUCT_ID';
P_NAME VARCHAR2(80) := 'SALES_FACT.P_NAME';
AREA_ID VARCHAR2(80) := 'SALES_FACT.AREA_ID';
A_CATEGORY VARCHAR2(80) := 'SALES_FACT.A_CATEGORY';
QTY VARCHAR2(80) := 'SALES_FACT.QTY';
BEGIN
IF Checkbox_Checked(DATE_ID) THEN /* DATE CHECKBOXES*/
v_select := v_select || ' SALES_FACT.DATE_ID,';
END IF;
IF Checkbox_Checked(MONTHI) THEN
v_select := v_select || ' TIME_DIMEN.MONTH,';
END IF;
IF Checkbox_Checked(QUATER) THEN
v_select := v_select || ' TIME_DIMEN.QUATER,';
END IF;
IF Checkbox_Checked(PRODUCT_I
v_select := v_select || 'SALES_FACT.PRODUCT_ID,';
END IF;
IF Checkbox_Checked(P_NAME) THEN
v_select := v_select || ' PRODUCT_DIMEN.P_NAME,';
END IF;
IF Checkbox_Checked(AREA_ID) THEN /* AREA CHECKBOXES*/
v_select := v_select || ' SALES_FACT.AREA_ID,';
END IF;
IF Checkbox_Checked(A_CATEGOR
v_select := v_select || ' AREA_DIMEN.A_CATEGORY,';
END IF;
IF Checkbox_Checked(QTY) THEN /* QTY CHECKBOXES*/
v_select := v_select || ' SALES_FACT.QTY,';
END IF;
v_select := RTRIM( v_select, ',' );
How do you do this part ?
DECLARE
CONNECTION_ID EXEC_SQL.CONNTYPE;
CURSOR_NAME EXEC_SQL.CURSTYPE;
SQLSTR VARCHAR2(2000);
BEGIN
CONNECTION_ID:= exec_sql.open_connection('
CURSOR_NAME := exec_sql.open_cursor(CONNE
SQLSTR :=( SELECT
FROM Sales, Product, Area, Time
WHERE ‘Sales.Product_ID= Product.Product_ID’||
‘AND Sales.Area_ID = Area.Area_ID ’||
‘AND Sales.Date = Time.Date ’||
‘AND DATE BETWEEN :D1 AND :D2';
exec_SQL.parse(CONNECTION_
rows_processed := exec_sql.execute( CONNECTION_ID,CURSOR_NAME)
exec_sql.close_cursor(CONN
exec_sql.close_connection(
END;
ie:
SQLSTR :=( SELECT :v_select
FROM Sales, Product, Area, Time
WHERE Sales.Product_ID= Product.Product_ID||
AND Sales.Area_ID = Area.Area_ID ||
AND Sales.Date = Time.Date ||
AND DATE BETWEEN :D1 AND :D2';
I can see where some of the code might cause some errors to occur. But that you'll learn to overcome as you get more practice.
Can someone please tell me where the code is wrong. This code is placed in a WHEN-BUTTON-PRESSED trigger.
What I want is for a user inputs at runtime (both column names and the time period) then when the user presses the button to execute the query and outputs the result on another window. Please help me.
__________________________
DECLARE
v_select VARCHAR2(32000) := 'SELECT';
DATE_ID VARCHAR2(80) := 'SALES_FACT.DATE_ID';
MONTHI VARCHAR2(80) := 'SALES_FACT.MONTHI';
QUATER VARCHAR2(80) := 'SALES_FACT.QUATER';
PRODUCT_ID VARCHAR2(80) := 'SALES_FACT.PRODUCT_ID';
P_NAME VARCHAR2(80) := 'SALES_FACT.P_NAME';
AREA_ID VARCHAR2(80) := 'SALES_FACT.AREA_ID';
A_CATEGORY VARCHAR2(80) := 'SALES_FACT.A_CATEGORY';
QTY VARCHAR2(80) := 'SALES_FACT.QTY';
connected boolean;
errcode number :=error_code;
cursor_name exec_sql.curstype;
rows_processed pls_integer;
connection_id exec_sql.conntype;
BEGIN
IF Checkbox_Checked(DATE_ID) THEN /* DATE CHECKBOXES*/
v_select := v_select || ' SALES_FACT.DATE_ID,';
END IF;
IF Checkbox_Checked(MONTHI) THEN
v_select := v_select || ' TIME_DIMEN.MONTH,';
END IF;
IF Checkbox_Checked(QUATER) THEN
v_select := v_select || ' TIME_DIMEN.QUATER,';
END IF;
IF Checkbox_Checked(PRODUCT_I
v_select := v_select || 'SALES_FACT.PRODUCT_ID,';
END IF;
IF Checkbox_Checked(P_NAME) THEN
v_select := v_select || ' PRODUCT_DIMEN.P_NAME,';
END IF;
IF Checkbox_Checked(AREA_ID) THEN /* AREA CHECKBOXES*/
v_select := v_select || ' SALES_FACT.AREA_ID,';
END IF;
IF Checkbox_Checked(A_CATEGOR
v_select := v_select || ' AREA_DIMEN.A_CATEGORY,';
END IF;
IF Checkbox_Checked(QTY) THEN /* QTY CHECKBOXES*/
v_select := v_select || ' SALES_FACT.QTY,';
END IF;
IF Checkbox_Checked(NPS) THEN
v_select := v_select || ' SALES_FACT.NPS,';
END IF;
v_select := RTRIM( v_select, ',' ); /* TO REMOVE THE , IN THE LAST SELECT STATEMENT */
connection_id := exec_sql.open_connection('
connected := exec_sql.is_connected(conn
if connected = TRUE then
message ('Connected ');
else
message ('NOT connnected');
end if;
cursor_name := EXEC_sql.open_cursor(conne
SQLSTR :=( SELECT :v_select
FROM Sales, Product, Area, Timei
WHERE 'Sales.Product_ID= Product.Product_ID'||
'AND Sales.Area_ID = Area.Area_ID '||
'AND Sales.Date = Time.Date '||
'AND DATE BETWEEN :D1 AND :D2';
exec_SQL.parse(connection_
rows_processed := exec_sql.execute( connection_id,cursor_name)
exec_sql.close_cursor(conn
exec_sql.close_connection(
end;
prito_81
ok. I feel bad for you. I think you are using a roundabout logic for your program.
Here is an example program from Oracle. This program will not be the complete solution to your program. But it does show you the basics. Re-write your program and then report back. The steps you are trying to do is good just using the wrong functions.
This is a bulletin from Metalink:
PASSING RECORD GROUPS TO ORACLE REPORTS & GRAPHICS
Introduction
============
This bulletin explains the processes involved in creating a record
group in Oracle Forms and then passing it to Oracle Reports and Oracle
Graphics. This bulletin is divided into three main parts. The first
part describes the creation of a record group and passing it to Oracle
Reports and Oracle Graphics. The second part describes how to create
a report that will run with the data based on a record group. The
third part describes how to create a graph that will run with the data
based on a record group.
For the following sections, the emp table must be available in the current
login of Oracle Forms, Reports, and Graphics. The emp table is a part of the
standard demo tables. However, if you do not have access to the emp
table, you can create and populate the emp table as follows:
Name Type
--------------------------
EMPNO NUMBER(4)
ENAME VARCHAR2(10)
JOB VARCHAR2(9)
MGR NUMBER(4)
HIREDATE DATE
SAL NUMBER(7,2)
COMM NUMBER(7,2)
DEPTNO NUMBER(2)
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
----- ------ --------- ----- --------- --------- --------- ---------
7839 KING PRESIDENT 17-NOV-81 5000 10
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7566 JONES MANAGER 7839 02-APR-81 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7900 JAMES CLERK 7698 03-DEC-81 950 30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7902 FORD ANALYST 7566 03-DEC-81 3000 20
7369 SMITH CLERK 7902 17-DEC-80 800 20
7788 SCOTT ANALYST 7566 09-DEC-82 3000 20
7876 ADAMS CLERK 7788 12-JAN-83 1100 20
7934 MILLER CLERK 7782 23-JAN-82 1300 10
Oracle Forms
============
The following code will create a record group and call Oracle Reports and/or
Oracle Graphics. You can implement this code in any trigger. In this example,
the SELECT statement is built as a fixed string. You may change the
SELECT statement by changing the WHERE or ORDER BY clause, but the number of
columns, data types, and column names must remain the same.
DECLARE
groupname VARCHAR2(30) := 'RG1';
paramlistname VARCHAR2(30) := 'PLIST1';
qname VARCHAR2(30) := 'Q_EMP';
qry VARCHAR2(2000) := 'SELECT ename, sal, comm' ||
'FROM emp' ||
'WHERE sal < 2000';
rgid RECORDGROUP;
plid PARAMLIST;
n NUMBER;
BEGIN
/*
Make sure the group does not already exists.
*/
rgid := FIND_GROUP(groupname);
/*
If the group exists, then delete it.
*/
IF NOT ID_NULL(rgid) THEN
DELETE_GROUP(rgid);
END IF;
/*
Create the group.
*/
rgid := CREATE_GROUP_FROM_QUERY(gr
/*
Make sure the record group is empty.
*/
DELETE_GROUP_ROW(rgid, ALL_ROWS);
/*
Retrieve the data.
*/
n := POPULATE_GROUP_WITH_QUERY(
/*
Make sure the list does not already exist.
*/
plid := GET_PARAMETER_LIST(paramli
/*
If the list exists, then delete it.
*/
IF NOT ID_NULL(plid) THEN
DESTROY_PARAMETER_LIST(par
END IF;
plid := CREATE_PARAMETER_LIST(para
ADD_PARAMETER(plid, qname, DATA_PARAMETER, groupname);
/*
Suppress the parameter form.
*/
ADD_PARAMETER(plid, 'paramform', TEXT_PARAMETER, 'NO');
/*
The following command will call Oracle Reports in SYNCHRONOUS mode.
To call Oracle Graphics, replace the REPORTS with GRAPHICS.
*/
RUN_PRODUCT(REPORTS, 'RG', SYNCHRONOUS, RUNTIME, FILESYSTEM, plid, NULL);
DESTROY_PARAMETER_LIST(pli
DELETE_GROUP(rgid);
END;
Note:
1. DATA_PARAMETER can only be passed in SYNCHRONOUS mode. For further
information, see the RUN_PRODUCT description in the Forms reference manual.
2. If you are experiencing an error like FRM-40105, FRM-41072, FRM-41076, or
FRM-41077, check how the SELECT statement was built.
Oracle Reports
==============
As mentioned in the previous section, the name, data type, and number of
columns in the report must be the same as the record group in the form. After
building the following report, you will be able to run it successfully from
the Designer. When you use RUN_PRODUCT to run this report, this creates the
report based on the data queried by the record group.
Use the following steps to create the report:
1. Create a Query with the following properties:
Name : Q_EMP
SELECT Statement : SELECT ename, sal, comm FROM emp
2. Create a Tabular Default Layout.
3. Generate and Save the Report as RG.
Oracle Graphics
===============
The same will apply for Oracle Graphics as mentioned in the Oracle Reports
section above. Use the following steps to create the chart:
1. Create a Query with the following properties:
Name : Q_EMP
SELECT Statement : SELECT ename, sal, comm FROM emp
2. Create a Chart based on the Q_EMP query.
3. Generate and Save the Display as RG.
I coded the following and compiled no errors. But when I run there is an error saying : argument 2 to builtin CREATE_GROUP_FROM_QUERY cannot be null. In the example under ORACLE REPORT it say that the name, data type, and number of columns in the report must be the same as the record group in the form. I dont know how I can do this? How to create a record group. Please help
I modified qry VARCHAR2(2000) := 'SELECT ename, sal, comm' ||
'FROM emp' || to qry VARCHAR2(2000) := SQLSTR I hope that can be done..?
__________________________
DECLARE
v_select VARCHAR2(32000) := 'SELECT';
DATE_ID VARCHAR2(80) := 'SALES_FACT.DATE_ID';
MONTHI VARCHAR2(80) := 'SALES_FACT.MONTHI';
QUATER VARCHAR2(80) := 'SALES_FACT.QUATER';
PRODUCT_ID VARCHAR2(80) := 'SALES_FACT.PRODUCT_ID';
P_NAME VARCHAR2(80) := 'SALES_FACT.P_NAME';
AREA_ID VARCHAR2(80) := 'SALES_FACT.AREA_ID';
A_CATEGORY VARCHAR2(80) := 'SALES_FACT.A_CATEGORY';
QTY VARCHAR2(80) := 'SALES_FACT.QTY';
SQLSTR VARCHAR2(2000);
groupname VARCHAR2(30) := 'RG1';
paramlistname VARCHAR2(30) := 'PLIST1';
qname VARCHAR2(30) := 'Q_EMP';
qry VARCHAR2(2000) := SQLSTR ; --(THIS IS THE QUERRY THAT WAS CREATED USING THE CHECKBOXES.
-- ACCORDING TO THE EXAMPLE THE qry SHOULD MATCH THE rgid RECORDGROUP. -- BUT I DONT KNOW HOW TO DO THAT)
rgid RECORDGROUP;
plid PARAMLIST;
n NUMBER;
BEGIN
--(TRYING TO GET THE USER INPUTS (CLOMN NAMES) AT RUNTIME TO PASS ON TO THE SELECT STATMENT)-----------------
IF Checkbox_Checked(DATE_ID) THEN /* DATE CHECKBOXES*/
v_select := v_select || ' SALES_FACT.DATE_ID,';
END IF;
IF Checkbox_Checked(MONTHI) THEN
v_select := v_select || ' TIME_DIMEN.MONTH,';
END IF;
IF Checkbox_Checked(QUATER) THEN
v_select := v_select || ' TIME_DIMEN.QUATER,';
END IF;
IF Checkbox_Checked(PRODUCT_I
v_select := v_select || 'SALES_FACT.PRODUCT_ID,';
END IF;
IF Checkbox_Checked(P_NAME) THEN
v_select := v_select || ' PRODUCT_DIMEN.P_NAME,';
END IF;
IF Checkbox_Checked(AREA_ID) THEN /* AREA CHECKBOXES*/
v_select := v_select || ' SALES_FACT.AREA_ID,';
END IF;
IF Checkbox_Checked(A_CATEGOR
v_select := v_select || ' AREA_DIMEN.A_CATEGORY,';
END IF;
IF Checkbox_Checked(QTY) THEN /* QTY CHECKBOXES*/
v_select := v_select || ' SALES_FACT.QTY,';
END IF;
v_select := RTRIM( v_select, ',' ); /* THIS IS TO REMOVE THE COMMA IN THE LAST SELECT STATEMENT */
--(TRYING TO CREATE A GROUP,PASS THE SELECT STATEMENT AND THEN GET THE OUTPUT IN ANOTHER WINDOW/REPORT/GRAPHICS)---
SQLSTR :=( 'SELECT' ||v_select||
'FROM Sales, Product, Area, Timei'||
'WHERE Sales.Product_ID= Product.Product_ID'||
'AND Sales.Area_ID = Area.Area_ID'||
'AND Sales.Date = Time.Date'||
'AND DATE BETWEEN :D1 AND :D2');
-- Make sure the group does not already exists.
rgid := FIND_GROUP(groupname);
-- If the group exists, then delete it.
IF NOT ID_NULL(rgid) THEN
DELETE_GROUP(rgid);
END IF;
-- Create the group.
rgid := CREATE_GROUP_FROM_QUERY(gr
-- Make sure the record group is empty.
DELETE_GROUP_ROW(rgid, ALL_ROWS);
-- Retrieve the data.
n := POPULATE_GROUP_WITH_QUERY(
-- Make sure the list does not already exist.
plid := GET_PARAMETER_LIST(paramli
-- If the list exists, then delete it.
IF NOT ID_NULL(plid) THEN
DESTROY_PARAMETER_LIST(par
END IF;
plid := CREATE_PARAMETER_LIST(para
ADD_PARAMETER(plid, qname, DATA_PARAMETER, groupname);
-- Suppress the parameter form.
ADD_PARAMETER(plid, 'paramform', TEXT_PARAMETER, 'NO');
-- The following command will call Oracle Reports in SYNCHRONOUS mode.
-- To call Oracle Graphics, replace the REPORTS with GRAPHICS.
RUN_PRODUCT(REPORTS, 'RG', SYNCHRONOUS, RUNTIME, FILESYSTEM, plid, NULL);
DESTROY_PARAMETER_LIST(pli
DELETE_GROUP(rgid);
end;
i did the change but still the same error.. "argument 2 to builtin CREATE_GROUP_FROM_QUERY cannot be null".
i'm really stuck can someone pls. help me..
__________________________
DECLARE
v_select VARCHAR2(32000) := 'SELECT';
DATE_ID VARCHAR2(80) := 'SALES_FACT.DATE_ID';
MONTHI VARCHAR2(80) := 'SALES_FACT.MONTHI';
QUATER VARCHAR2(80) := 'SALES_FACT.QUATER';
PRODUCT_ID VARCHAR2(80) := 'SALES_FACT.PRODUCT_ID';
P_NAME VARCHAR2(80) := 'SALES_FACT.P_NAME';
AREA_ID VARCHAR2(80) := 'SALES_FACT.AREA_ID';
A_CATEGORY VARCHAR2(80) := 'SALES_FACT.A_CATEGORY';
QTY VARCHAR2(80) := 'SALES_FACT.QTY';
SQLSTR VARCHAR2(2000);
groupname VARCHAR2(30) := 'RG1';
paramlistname VARCHAR2(30) := 'PLIST1';
qname VARCHAR2(30) := 'Q_EMP';
qry VARCHAR2(2000);
rgid RECORDGROUP;
plid PARAMLIST;
n NUMBER;
BEGIN
--(TRYING TO GET THE USER INPUTS (CLOMN NAMES) AT RUNTIME TO PASS ON TO THE SELECT STATMENT)-----------------
IF Checkbox_Checked(DATE_ID) THEN /* DATE CHECKBOXES*/
v_select := v_select || ' SALES_FACT.DATE_ID,';
END IF;
IF Checkbox_Checked(MONTHI) THEN
v_select := v_select || ' TIME_DIMEN.MONTH,';
END IF;
IF Checkbox_Checked(QUATER) THEN
v_select := v_select || ' TIME_DIMEN.QUATER,';
END IF;
IF Checkbox_Checked(PRODUCT_I
v_select := v_select || 'SALES_FACT.PRODUCT_ID,';
END IF;
IF Checkbox_Checked(P_NAME) THEN
v_select := v_select || ' PRODUCT_DIMEN.P_NAME,';
END IF;
IF Checkbox_Checked(AREA_ID) THEN /* AREA CHECKBOXES*/
v_select := v_select || ' SALES_FACT.AREA_ID,';
END IF;
IF Checkbox_Checked(A_CATEGOR
v_select := v_select || ' AREA_DIMEN.A_CATEGORY,';
END IF;
IF Checkbox_Checked(QTY) THEN /* QTY CHECKBOXES*/
v_select := v_select || ' SALES_FACT.QTY,';
END IF;
v_select := RTRIM( v_select, ',' ); /* THIS IS TO REMOVE THE COMMA IN THE LAST SELECT STATEMENT */
--(TRYING TO CREATE A GROUP,PASS THE SELECT STATEMENT AND THEN GET THE OUTPUT IN ANOTHER WINDOW/REPORT/GRAPHICS)---
qry := SQLSTR ; --(THIS IS THE QUERRY THAT WAS CREATED USING THE CHECKBOXES.
-- ACCORDING TO THE EXAMPLE THE qry SHOULD MATCH THE rgid RECORDGROUP.
-- BUT I DONT KNOW HOW TO DO THAT)
SQLSTR :=( 'SELECT' ||v_select||
'FROM Sales, Product, Area, Timei'||
'WHERE Sales.Product_ID= Product.Product_ID'||
'AND Sales.Area_ID = Area.Area_ID'||
'AND Sales.Date = Time.Date'||
'AND DATE BETWEEN :D1 AND :D2');
-- Make sure the group does not already exists.
rgid := FIND_GROUP(groupname);
-- If the group exists, then delete it.
IF NOT ID_NULL(rgid) THEN
DELETE_GROUP(rgid);
END IF;
-- Create the group.
rgid := CREATE_GROUP_FROM_QUERY(gr
-- Make sure the record group is empty.
DELETE_GROUP_ROW(rgid, ALL_ROWS);
-- Retrieve the data.
n := POPULATE_GROUP_WITH_QUERY(
-- Make sure the list does not already exist.
plid := GET_PARAMETER_LIST(paramli
-- If the list exists, then delete it.
IF NOT ID_NULL(plid) THEN
DESTROY_PARAMETER_LIST(par
END IF;
plid := CREATE_PARAMETER_LIST(para
ADD_PARAMETER(plid, qname, DATA_PARAMETER, groupname);
-- Suppress the parameter form.
ADD_PARAMETER(plid, 'paramform', TEXT_PARAMETER, 'NO');
-- The following command will call Oracle Reports in SYNCHRONOUS mode.
-- To call Oracle Graphics, replace the REPORTS with GRAPHICS.
RUN_PRODUCT(REPORTS, 'RG', SYNCHRONOUS, RUNTIME, FILESYSTEM, plid, NULL);
DESTROY_PARAMETER_LIST(pli
DELETE_GROUP(rgid);
end;
sigh...
listen.. your query needs to be valid.. and it isn't...
this i copied from your answer:
I modified “qry VARCHAR2(2000) := 'SELECT ename, sal, comm' ||
'FROM emp' ||” to qry VARCHAR2(2000) := SQLSTR I hope that can be done..?
if you put your string together, this is your result:
SELECT ename, sal, commFROM emp
you have to put in a space either after comm or before FROM .. that way your query-string will be valid..
swap these two statements. fix the sql.
qry := SQLSTR ; --(THIS IS THE QUERRY THAT WAS CREATED USING THE CHECKBOXES.
-- ACCORDING TO THE EXAMPLE THE qry SHOULD MATCH THE rgid RECORDGROUP.
-- BUT I DONT KNOW HOW TO DO THAT)
SQLSTR :=( 'SELECT' ||v_select||
'FROM Sales, Product, Area, Timei'||
'WHERE Sales.Product_ID= Product.Product_ID'||
'AND Sales.Area_ID = Area.Area_ID'||
'AND Sales.Date = Time.Date'||
'AND DATE BETWEEN :D1 AND :D2');
Also, look at the from clause. you have Timei instead of Time.
You initially set your v_select var to 'Select', the you set you8r sqlstr to
SQLSTR :=( 'SELECT' ||v_select||'FROM Sales, Product, Area, Timei'|| 'WHERE Sales.Product_ID= Product.Product_ID'|| 'AND Sales.Area_ID = Area.Area_ID'||
'AND Sales.Date = Time.Date'|| 'AND DATE BETWEEN :D1 AND :D2');
It looks to me like you have a syntax problem. When you pass sqlstr to exec_SQL.parse(connection_
hi priti,
i looked to the query statement u built ,that is
SQLSTR :=( 'SELECT' ||v_select||'FROMSales,Pro
Area, Timei'||'WHERE Sales.Product_ID=Product.P
'AND Sales.Area_ID = Area.Area_ID'||'AND Sales.Date = Time.Date'||'AND DATE BETWEEN :D1 AND :D2');
what i find that is in the where clause there is no condition to join the time table to any other table.
u have one form where u just check the check boxes to determine which columns from which tables should be selected,suppose u checked the
boxes for the columns Product_ID, P_Name from the product table.but u see,here u r not giving a value for a where cluse that means u r selecting all the rows from the product table.so suppose u checked all the boxes for all the columns for all the tables,then a select statement will be constructed which will look like the one i mentioned above.here u see there is no where condition for a specific table in the where cluse,so the joining conditions between the tables forming the entire where cluse but there is no joining condition between the time table and any other table.so to make ur select statement correct u have to have relations between all tables.i mean there should be atleaset one primary ,foreign key relationship between time table and any other table so that u can use that relation in the join condition.
what i feel if u correct ur select statement according to my suggestion ,u may become successfull.
thanks
mehbub
Business Accounts
Answer for Membership
by: lmedfoPosted on 2003-03-05 at 07:21:02ID: 8072369
This looks like homework for a class. Is it?
LM