Sql statement in a table not accepting variable
I have the following problem on 10.1.0.3.0 with varialbe in an execute immediate statement
here is the code that I am using
declare
remote_data_link varchar2(25) := 'UDE_DATATRANSFER_LINK';
FROM_SCHEMA VARCHAR2(40) := 'UDE_OLTP';
l_last_process_date date := to_date(to_char(sysdate,'mm-dd-yyyy hh:mi:ss'),'mm-dd-yyyy hh:mi:ss') - 1;
stmt varchar2(4000) := 'MERGE into applicant_adverseaction_info theTarget USING (select * from '||FROM_SCHEMA||'.applicant_adverseaction_info@'||remote_data_link||' where last_activity > :l_last_process_date ) theSource ON(theTarget.applicant_id = theSource.applicant_id) WHEN MATCHED THEN UPDATE SET theTarget.cb_used = theSource.cb_used, theTarget.cb_address = theSource.cb_address, theTarget.scoredmodel_id = theSource.scoredmodel_id, theTarget.last_activity = theSource.last_activity WHEN NOT MATCHED THEN INSERT(CB_USED, CB_ADDRESS, SCOREDMODEL_ID, APPLICANT_ID, LAST_ACTIVITY) values(theSource.cb_used, theSource.cb_address, theSource.scoredmodel_id, theSource.applicant_id, theSource.last_activity)';
stmt2 varchar2(4000) := 'MERGE into edm_application theTarget USING (select * from '||from_schema||'.edm_application@'||remote_data_link||' where last_activity > :l_last_process_date) theSource ON (theTarget.edm_appl_id = theSource.edm_appl_id) WHEN MATCHED THEN UPDATE SET theTarget.APP_REF_KEY = theSource.APP_REF_KEY, theTarget.IMPORT_REF_KEY = theSource.IMPORT_REF_KEY, theTarget.LAST_ACTIVITY = theSource.LAST_ACTIVITY WHEN NOT MATCHED THEN INSERT (EDM_APPL_ID, APP_REF_KEY, IMPORT_REF_KEY, LAST_ACTIVITY) values(theSource.EDM_APPL_ID, theSource.APP_REF_KEY, theSource.IMPORT_REF_KEY, theSource.LAST_ACTIVITY)';
v_error varchar2(4000);
T_MERGE VARCHAR2(4000);
stmt3 varchar2(4000);
BEGIN
select merge_sql
INTO T_MERGE
from transfertables
where table_name= 'edm_application';
remote_data_link:= 'UDE_DATATRANSFER_LINK';
FROM_SCHEMA := 'UDE_OLTP';
--DBMS_OUTPUT.PUT_LINE(SUBSTR(stmt2,1,200));
--STMT2 := T_MERGE;
dbms_output.put_line(from_schema||' '||remote_data_link||' '||l_last_process_date);
EXECUTE IMMEDIATE stmt2 using l_last_process_date;
--execute immediate stmt3 ;
dbms_output.put_line(from_schema||' '||remote_data_link||' '||l_last_process_date);
dbms_output.put_line(substr(stmt2,1,200));
commit;
EXCEPTION
WHEN OTHERS THEN
V_ERROR := SQLCODE||' '||SQLERRM;
v_ERROR := V_ERROR ||' '||SUBSTR(stmt2,1,200);
DBMS_OUTPUT.PUT_LINE(V_ERROR);
--dbms_output.put_line(substr(stmt2,1,200));
END;
This works perfectly
but if I change it to get the same statement in a db table
declare
remote_data_link varchar2(25) := 'UDE_DATATRANSFER_LINK';
FROM_SCHEMA VARCHAR2(40) := 'UDE_OLTP';
l_last_process_date date := to_date(to_char(sysdate,'mm-dd-yyyy hh:mi:ss'),'mm-dd-yyyy hh:mi:ss') - 1;
stmt varchar2(4000) := 'MERGE into applicant_adverseaction_info theTarget USING (select * from '||FROM_SCHEMA||'.applicant_adverseaction_info@'||remote_data_link||' where last_activity > :l_last_process_date ) theSource ON(theTarget.applicant_id = theSource.applicant_id) WHEN MATCHED THEN UPDATE SET theTarget.cb_used = theSource.cb_used, theTarget.cb_address = theSource.cb_address, theTarget.scoredmodel_id = theSource.scoredmodel_id, theTarget.last_activity = theSource.last_activity WHEN NOT MATCHED THEN INSERT(CB_USED, CB_ADDRESS, SCOREDMODEL_ID, APPLICANT_ID, LAST_ACTIVITY) values(theSource.cb_used, theSource.cb_address, theSource.scoredmodel_id, theSource.applicant_id, theSource.last_activity)';
stmt2 varchar2(4000) := 'MERGE into edm_application theTarget USING (select * from '||from_schema||'.edm_application@'||remote_data_link||' where last_activity > :l_last_process_date) theSource ON (theTarget.edm_appl_id = theSource.edm_appl_id) WHEN MATCHED THEN UPDATE SET theTarget.APP_REF_KEY = theSource.APP_REF_KEY, theTarget.IMPORT_REF_KEY = theSource.IMPORT_REF_KEY, theTarget.LAST_ACTIVITY = theSource.LAST_ACTIVITY WHEN NOT MATCHED THEN INSERT (EDM_APPL_ID, APP_REF_KEY, IMPORT_REF_KEY, LAST_ACTIVITY) values(theSource.EDM_APPL_ID, theSource.APP_REF_KEY, theSource.IMPORT_REF_KEY, theSource.LAST_ACTIVITY)';
v_error varchar2(4000);
T_MERGE VARCHAR2(4000);
stmt3 varchar2(4000);
BEGIN
select merge_sql
INTO T_MERGE
from transfertables
where table_name= 'edm_application';
remote_data_link:= 'UDE_DATATRANSFER_LINK';
FROM_SCHEMA := 'UDE_OLTP';
--DBMS_OUTPUT.PUT_LINE(SUBSTR(stmt2,1,200));
STMT2 := T_MERGE;
dbms_output.put_line(from_schema||' '||remote_data_link||' '||l_last_process_date);
EXECUTE IMMEDIATE stmt2 using l_last_process_date;
--execute immediate stmt3 ;
dbms_output.put_line(from_schema||' '||remote_data_link||' '||l_last_process_date);
dbms_output.put_line(substr(stmt2,1,200));
commit;
EXCEPTION
WHEN OTHERS THEN
V_ERROR := SQLCODE||' '||SQLERRM;
v_ERROR := V_ERROR ||' '||SUBSTR(stmt2,1,200);
DBMS_OUTPUT.PUT_LINE(V_ERROR);
--dbms_output.put_line(substr(stmt2,1,200));
END;
I get ora-00900 invalid sql statement
can somebody explain why this happens
Thanks
I agree with jan and anthony. Your post is too long and ill-formatted. However here's my understanding of your problem (with examples though slightly different ones).
1- I have a function that returns number of records in a any given table.
1 CREATE OR REPLACE FUNCTION get_count(p_table varchar2)
2 RETURN NUMBER IS
3 v_cnt number;
4 BEGIN
5 EXECUTE IMMEDIATE('SELECT count(*) FROM '||p_table) INTO v_cnt;
6 RETURN v_cnt;
7* END;
SQL> /
Function created.
SQL> SELECT get_count('emp')
2 FROM dual
3 /
GET_COUNT('EMP')
14
2- I decide to move the statement to a database table and recreate my function.
SQL> CREATE TABLE test
2 (stmt varchar2(2000))
3 /
Table created.
SQL> INSERT INTO test
2 VALUES('SELECT count(*) FROM p_table');
1 row created.
SQL> CREATE OR REPLACE FUNCTION get_count(p_table varchar2)
2 RETURN NUMBER IS
3 v_cnt number;
4 v_stmt varchar2(4000);
5 BEGIN
6 SELECT stmt INTO v_stmt
7 FROM test;
8 EXECUTE IMMEDIATE(v_stmt) INTO v_cnt;
9 RETURN v_cnt;
10 END;
11 /
Function created.
SQL> SELECT get_count('emp')
2 FROM dual
3 /
SELECT get_count('emp')
ERROR at line 1:
ORA-00942: table or view does not exist
ORA-06512: at "SCOTT.GET_COUNT", line 8
ORA-06512: at line 1
--p_table in the column is a string and has nothing to do with p_table parameter in the function. And since there's no p_table table in my schema function returns error on execution. I suppose this is what you mean by "sql statement in a table not accepting variable"
3- I rectify the problem by recreating the function.
1 CREATE OR REPLACE FUNCTION get_count(p_table varchar2)
2 RETURN NUMBER IS
3 v_cnt number;
4 v_stmt varchar2(4000);
5 BEGIN
6 SELECT replace(stmt,'p_table',p_table) INTO v_stmt
7 FROM test;
8 EXECUTE IMMEDIATE(v_stmt) INTO v_cnt;
9 RETURN v_cnt;
10* END;
SQL> /
Function created.
SQL> SELECT get_count('emp')
2 FROM dual
3 /
GET_COUNT('EMP')
14
Hope this gives you some idea.-----------------------
Anwar
Similar Messages
-
Execute the sql statement stored in table
friends i m in complication that, how can i execute sql statement which is stored in database table.
how can i fetch that particular statement from table and make it execute!!!
Thanks in advanceI think we should stop at this point and have a little think.
My understanding is that your plan is to do the following
-Execute a Dynamic SQL statement which is constructed from values in several columns in a table (Bad idea to begin with)
-The result of the execution is then loaded into PL/SQL.....not sure how you are handling different column lists but I'll assume you are not having to convert every column value to a VARCHAR2
-The values returned are then used in an INSERT statement
So basically your goal here is to take some data from one table and insert it into another table by moving data from SQL to PL/SQL then back to SQL in an elaborate, dynamic way. This is a costly waste of resources and will not scale (this is before we get to the problem of having to read the SQL statement from a table in the first place)
I would recommend looking the INSERT SELECT statement here: http://psoug.org/reference/insert.html
This will get the job done in one go. If you really do need it to be dynamic (which you don't, trust me) then you can still store this statement in your "dynamic SQL" table and execute it using EXECUTE IMMEDIATE although I can say for sure that you're going to run into more problems down the line with this architecture, it won't scale very well, and you'll probably waste at least *1* day of your time every week trying to fix a bug caused by the removal of a table, change to a column name etc.......
However if you believe that storing SQL in a table is the best solution to your problem then go ahead.....at least when you find out that it isn't you'll have learned a valuable lesson. -
Sql statement for a table name with a space in between
Hi,
I just noticed that one of my tables for Access is consisted of two word. It is called "CURRENT CPL". How would I put this table name into an sql statement. When I did what I normally do, it only reads the CURRENT and thinks that's the table name.
Thanks
FengI just noticed that one of my tables for Access is
consisted of two word. It is called "CURRENT CPL".
How would I put this table name into an sql
statement. When I did what I normally do, it only
reads the CURRENT and thinks that's the table name.That is called a quoted identifier. The SQL (not java) for this would look like this....
select "my field" from "CURRENT CPL"
The double quote is the correct character to use. Note that quoted identifiers are case sensitive, normal SQL is not. -
hi there..i need ur helps
Here are my tables n column name for each tables
a) rep_arrngt
Name
REP_ARRNGT_ID
REP_ARRNGT_DESC
REP_ARRNGT_TYPE
ACCT_CAT
DEF_INDUSTRY_CODE
MEDIA_ID
LANGUAGE_ID
CURRENCY
PAGE_ID
b) bci_rep_arrng
Name
REP_ARRNGT_ID
BCI
SUB_SUM_CODE
DP_SUB_SUM_CODE
c) acct_rep_arrngt_link
Name
ACCT_NO
REP_ARRNGT_ID
DOC_TYPE
LAST_BILL_DATE
BILL_FREQUENCY
SCALING
EFF_FROM_DATE
EFF_TO_DATE
MEDIA_ID
Actually, i want to get the unique value for sub_sum_code according to the bci..
i already use join tables n here is my sql statement :
SELECT T1.SUB_SUM_CODE,T1.BCI,T1.REP_ARRNGT_ID,T2.REP_ARRNGT_ID,T3.REP_ARRNGT_ID FROM BCI_REP_ARRNG T1, REP_ARRNGT T2, ACCT_REP_ARRNGT_LINK T3 WHERE T1.REP_ARRNGT_ID=T2.REP_ARRNGT_ID AND T2.REP_ARRNGT_ID=T3.REP_ARRNGT_ID AND BCI='TTA00F06'
n my results is :
SUB_SUM_CODE BCI REP_ARRNGT_ID
TBGSR TTA00F06 R1
TBGSR TTA00F06 R1
TBGSR TTA00F06 R1
TBGSR TTA00F06 R1
I get the repeated results for sub_sum_code..
so, what i need to do if i want only 1 row results like this :
[u]SUB_SUM_CODE BCI REP_ARRNGT_ID
TBGSR TTA00F06 R1
i try to use group by, but i get the error..plz help meIf you only want "to get the unique value for sub_sum_code according to the bci" then why are you joining the tables in the first place? Not knowing PKs etc you could just use DISTINCT in your select statement.
SELECT DISTINCT T1.SUB_SUM_CODE,
T1.BCI
FROM BCI_REP_ARRNG T1
AND BCI='TTA00F06' -
How to store sql statement in oracle table?
I tried it in this way:
SQL> insert into sql_text values('select invoice,invoice_dt,DT_INVOICED from PS_BI_HDR where DT_INVOICED= '21
JAN-2010' and BILL_STATUS='INV'');
insert into sql_text values('select invoice,invoice_dt,DT_INVOICED from PS_BI_HDR where DT_INVOICED= '21-JAN-
010' and BILL_STATUS='INV'')
ERROR at line 1:
ORA-00917: missing comma
Please help to solve it, i can't use concatenation (||),
coz
'select invoice,invoice_dt,DT_INVOICED from PS_BI_HDR where DT_INVOICED= '21-JAN-2010' and BILL_STATUS='INV' 'it is dynamic.user2060331 wrote:
No sql statement is a dynamic value inserted by a user for executing it on SQl prompt.Then use q-literals:
SQL> ACCEPT stmt PROMPT "Enter statement: "
Enter statement: select invoice,invoice_dt,DT_INVOICED from PS_BI_HDR where DT_INVOICED= '21-JAN-2010' and BILL_STATUS='INV'
SQL> insert into sql_text values('&stmt');
old 1: insert into sql_text values('&stmt')
new 1: insert into sql_text values('select invoice,invoice_dt,DT_INVOICED from PS_BI_HDR where DT_INVOICED= '21-JAN-2010' and BILL_STATUS='INV'')
insert into sql_text values('select invoice,invoice_dt,DT_INVOICED from PS_BI_HDR where DT_INVOICED= '21-JAN-2010' and BILL_STATUS='INV'')
ERROR at line 1:
ORA-00917: missing comma
SQL> insert into sql_text values(q'[&stmt]');
old 1: insert into sql_text values(q'[&stmt]')
new 1: insert into sql_text values(q'[select invoice,invoice_dt,DT_INVOICED from PS_BI_HDR where DT_INVOICED= '21-JAN-2010' and BILL_STATUS='INV']')
1 row created.
SQL> SY. -
I just downloaded the HP laserjet driver from their website and received an error stating my OS Yosemite system will not accept any driver version at or below 10.6. Is their a driver within the Apple site that I can use or do I have to go back to my older OS version?
Thanks.What is the version of the driver you downloaded?
Which printer?
Apple menu > App store and click Updates.
See this -> OS X Yosemite: Add or remove a printer -
Outputting SQL statement into HTML table
ok, my problem is that i can only output the first row from my table in my DB and i want to be able to display all the rows from that table which are of a particular type..maybe someone here can help..
and if anyone thinks the code is a bit pants please say why..cheers
import java.lang.*;
import java.util.*;
import java.io.*;
import java.util.Vector;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class StockStats3 extends HttpServlet
String totalStock = "";
String itemName = "";
int type = 0;
int itemId = 0;
Statement stmt = null;
ResultSet rs = null;
Connection con = null;
String query;
PrintWriter out;
String url = "jdbc:mysql://macneill.cs.tcd.ie/odriscoi_db";
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
out= response.getWriter();
response.setContentType("text/html");
out.println("<HTML>");
out.println("<HEAD>");
out.println("<TITLE> Check Current Stock </TITLE>");
out.println("</HEAD>");
out.println("<body bgcolor=#FFFFFF background=\"U:/back.jpg\" link = white vlink = white>");
out.println("<font color=#FFFFFF face=COMIC SANS MS size=3>");
out.print("<form action=\"");
out.print("StockStats3\" ");
out.println("method=POST>");
out.println("<TD><h3><LEFT><font color=#FFFFFF face=COMIC SANS MS size=5>Click on Relevant Button to view Current Stock: </h3></TD>");
out.println("<TD><h3><LEFT><font color=#FFFFFF face=COMIC SANS MS size=3>KITCHEN FOODS: </h3></TD>");
out.println("<input type=submit name=action value=\"Meat \">");
out.println("<input type=submit name=action value=\"Fish\">");
out.println("<input type=submit name=action value=\"Fruit\">");
out.println("<input type=submit name=action value=\"Veg\">");
out.println("<input type=submit name=action value=\"Dairy\">");
out.println("<input type=submit name=action value=\"Herbs\">");
out.println("<input type=submit name=action value=\"Pasta\">");
out.println("<input type=submit name=action value=\"Sauces\">");
out.println("<input type=submit name=action value=\"Condiments\">");
out.println("<input type=submit name=action value=\"Total Food\">");
out.println("<TD><h3><LEFT><font color=#FFFFFF face=COMIC SANS MS size=3>BAR DRINKS: </h3></TD>");
out.println("<input type=submit name=action value=\"Soda\">");
out.println("<input type=submit name=action value=\"Water\">");
out.println("<input type=submit name=action value=\"Beer\">");
out.println("<input type=submit name=action value=\"Wine\">");
out.println("<input type=submit name=action value=\"Total Drink\">");
out.println("<PRE>");
out.println("<CENTER><TH><h3><A HREF= \"ManageOption \"><FONT face=arial>Back to Options</FONT></A></h3></TH><BR>");
out.println("</PRE>");
out.println("<PRE>");
out.println("<CENTER><TH><h3><A HREF= \"log \"><FONT face=arial>logout</FONT></A></h3></TH><BR>");
out.println("</PRE>");
out.println("<BR>");
out.println("</TR>");
out.println("</BODY>");
out.println("</HTML>");
out.close();
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
String msg11 = "";
String msg12 = "";
String msg13 = "";
String msg14 = "";
String msg15 = "";
String msg16 = "";
String msg17 = "";
String msg18 = "";
String msg19 = "";
String msg20 = "";
String msg2 = "";
String msg3 = "";
String msg4 = "";
String msg5 = "";
String msg6 = "";
String msg7 = "";
String msg8 = "";
String msg9 = "";
if (request.getParameter("action").equals("Meat"))
msg11 = getItemName(1);
msg12 = getStock(1);
msg13 = getItemName(1);
msg14 = getStock(1);
msg15 = getItemName(2);
msg16 = getStock(2);
msg17 = getItemName(3);
msg18 = getStock(3);
msg19 = getItemName(4);
msg20 = getStock(4);
//im only trying to work on one table at the moment
if (request.getParameter("action").equals("Fish"))
msg2 = getStock(5);
if (request.getParameter("action").equals("Fruit"))
msg3 = getStock(6);
if (request.getParameter("action").equals("Veg"))
msg4 = getStock(7);
if (request.getParameter("action").equals("Dairy"))
msg5 = getStock(8);
if (request.getParameter("action").equals("Herbs"))
msg6 = getStock(9);
if (request.getParameter("action").equals("Pasta"))
msg7 = getStock(10);
if (request.getParameter("action").equals("Sauces"))
msg8 = getStock(11);
if (request.getParameter("action").equals("Condiments"))
msg9 = getStock(12);
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<HTML>");
out.println("<HEAD>");
out.println("<TITLE>Stock Results </TITLE>");
out.println("</HEAD>");
out.println("<body bgcolor=#FFFFFF background=\"U:/back.jpg\" link = white vlink = white>");
out.println("<font color=#FFFFFF face=COMIC SANS MS size=3>");
out.print("<form action=\"");
out.print("StockStats3\" ");
out.println("method=POST>");
out.println("<BR>");
out.println("</H2><TABLE BORDER='1' CELLSPACING='2' CELLPADDING='2'>");
out.println("<font color=#FFFFFF face=COMIC SANS MS size=3>");
out.println("<TR><TH><B>Item Name</B></TH><TH><B>Portions</B></TH></TR>");
out.println("<TR><TD>"+getItemName(itemId)+"</TD><TD>"+getStock(itemId)+"</TD></TR>");
out.println("</TABLE>");
out.println("<BR>");
out.println("<CENTER><TH><h3><A HREF= \"StockStats3 \"><FONT face=arial>Back</FONT></A></h3></TH><BR>");
out.println("</PRE>");
out.println("<PRE>");
out.println("<CENTER><TH><h3><A HREF= \"ManageOption \"><FONT face=arial>Back to Options</FONT></A></h3></TH><BR>");
out.println("</PRE>");
out.println("<PRE>");
out.println("<CENTER><TH><h3><A HREF= \"log \"><FONT face=arial>logout</FONT></A></h3></TH><BR>");
out.println("</PRE>");
out.println("<BR>");
out.println("</FORM>");
out.println("");
out.println("</BODY>");
out.println("</HTML>");
//This method is used to retrieve the total stock of each item
private String getStock(int itemId) throws ServletException, IOException
String result = "";
try
String driver = "org.git.mm.mysql.Driver";
try
Class.forName(driver).newInstance();
//out.println("Driver Called!");
catch(java.lang.ClassNotFoundException e)
System.err.print("Couldn't find ClassNotFoundException: ");
System.err.println(e.getMessage());
out.println(e.getMessage());
catch(Exception ex)
ex.printStackTrace();
Connection con = DriverManager.getConnection(url, "odriscoi", "3vk7WgdO");
//out.println("Connection made!");
Statement stmt = con.createStatement();
//get stock of items
String query = "SELECT Portions FROM Kitchen WHERE Item_ID = '"+itemId+"';";
result = query;
ResultSet rs = stmt.executeQuery(query);
while(rs.next())
totalStock = rs.getString("Portions");
rs.close();
stmt.close();
con.close();
catch(SQLException ex)
out.println("SQLException: " + ex.getMessage());
return totalStock;
//Ths method is used to retrieve the name of each item
private String getItemName(int itemId) throws ServletException, IOException
String result = "";
try
String driver = "org.git.mm.mysql.Driver";
try
Class.forName(driver).newInstance();
//out.println("Driver Called!");
catch(java.lang.ClassNotFoundException e)
System.err.print("Couldn't find ClassNotFoundException: ");
System.err.println(e.getMessage());
out.println(e.getMessage());
catch(Exception ex)
ex.printStackTrace();
Connection con = DriverManager.getConnection(url, "odriscoi", "3vk7WgdO");
//out.println("Connection made!");
Statement stmt = con.createStatement();
//get name of item
String query = "SELECT item FROM Kitchen WHERE item_ID = '"+itemId+"';";
result = query;
ResultSet rs = stmt.executeQuery(query);
while(rs.next())
itemName = rs.getString("item");
rs.close();
stmt.close();
con.close();
catch(SQLException ex)
out.println("SQLException: " + ex.getMessage());
return itemName;the following is my code to retrieve a table, maybe it gives u some ideas.
Wolf
==========================================================================
import java.io.*;
import java.sql.*;
import javax.naming.*;
import javax.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class Test extends HttpServlet {
public void service(ServletRequest request, ServletResponse response)
throws ServletException, IOException {
Context initCtx=null;
Context envCtx=null;
DataSource ds=null;
Connection conn=null;
Statement stmt=null;
ResultSet rs=null;
response.setContentType("text/html");
PrintWriter out = response.getWriter();
try {
initCtx = new InitialContext();
envCtx = (Context)initCtx.lookup("java:comp/env");
ds = (DataSource)envCtx.lookup("jdbc/Bookingcomputer");
conn = ds.getConnection();
stmt=conn.createStatement();
// rs=stmt.executeQuery("SELECT s_code, description FROM computer");
rs=stmt.executeQuery("SELECT * FROM computer");
out.println("<HTML><HEAD><TITLE>Computer List</TITLE></HEAD>");
out.println("<BODY>");
out.println("<UL>");
out.println("<CENTER><FONT SIZE=\"4\"><B>ERC Computer List</B></FONT></CENTER>");
out.println("<center><table border=\"1\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse\" bordercolor=\"#111111\" width=\"80%\" id=\"AutoNumber1\">");
while(rs.next()) {
out.println("<tr>");
out.print("<td width=\"10\">");
out.print("<LI>");
out.print("</td>");
out.print("<td width=\"25%\"><B>");
out.print(rs.getString("s_code"));
out.print("</B></td>");
out.print("<td width=\"50%\">");
out.print(rs.getString("description"));
out.print("</td>");
out.print("<td width=\"25%\">");
out.print(rs.getString("capacity"));
out.print("</td>");
// out.println("<LI>"+rs.getString("s_code")+" "+rs.getString("description") );
out.println("</tr>");
out.println("</table></center>");
out.println("</UL>");
// out.println("Hi Arthur, How are you doing?");
out.println("</BODY></HTML>");
catch(SQLException ex) {
System.err.println("SQLException:"+ex.getMessage());
} catch (NamingException e) {
e.printStackTrace();
finally {
try {
if (conn!=null)
conn.close();
}catch(SQLException e){
e.printStackTrace(); -
I am unable to change my credit card number because my apple profile shows me as a resident of the United States, although I live in Switzerland. Consequently I cannot edit my area code, zip number, State info, etc. Please advise me how to do it. Many thanks.
Hello Luis,
To update your billing information, you would need to change your iTunes Store country to be able to enter the information for Switzerland. I found an article with the steps to update this:
Change your iTunes Store country
Sign in to the account for the iTunes Store region you'd like to use. Tap Settings > iTunes & App Stores > Apple ID: > View Apple ID > Country/Region.
Follow the onscreen process to change your region, agree to the terms and conditions for the region if necessary, and then change your billing information.
You can find the full article here:
iOS: Changing the signed-in iTunes Store Apple ID account
http://support.apple.com/kb/ht1311
Thank you for posting in the Apple Support Communities.
Best,
Sheila M. -
SQL Statement Works In sqlplus, Not Grid Ctl For User Defined Metric
I'm trying these queries:
Query 1:
select '0', '0' from dual
union
SELECT
to_char(d.sid),
to_char(d.serial#)
FROM v$sql a,
dba_Users c,
v$session d
WHERE
c.Username = 'SYSADM'
AND (a.Elapsed_Time * 0.000001 > 5
OR a.Executions > 1000)
AND a.Executions > 0
AND c.User_Id = a.ParSing_User_Id
AND (Round(a.Elapsed_Time * 0.000001 / a.Executions)) > 10
AND a.last_active_time > (sysdate - 1)
and a.sql_id = d.sql_id
Query 2:
select 0, 0 from dual
union
SELECT
d.sid,
d.serial#
FROM v$sql a,
dba_Users c,
v$session d
WHERE
c.Username = 'SYSADM'
AND (a.Elapsed_Time * 0.000001 > 5
OR a.Executions > 1000)
AND a.Executions > 0
AND c.User_Id = a.ParSing_User_Id
AND (Round(a.Elapsed_Time * 0.000001 / a.Executions)) > 10
AND a.last_active_time > (sysdate - 1)
and a.sql_id = d.sql_id
As you can see, Query 1 is selecting character results, Query 2 is selecting numerical results. Both work from sqlplus on the host. Trying to run either of them in a user defined metric in Grid Control returns: ORA-00918: column ambiguously defined
1. Why is the error returned in Grid Control?
2. Is there a way to see exactly which column Grid Control has the issue with?Never mind, I got it.
-
Webform - List (Checkbox) Not accepting variables
I am having problems with a List (Checkbox) element on a webform where it will not save the text for the options that is entered. I enter the text i want and then save it and it shows with nothing. If it does save it properly and I go to edit or add any options it deletes everything.
Please investigate and advise.
RobHi Rob,
If making a change to the form you'll need to first apply it within the admin via site manager -> web forms.
In this case add the text for the checkbox then save. Go to the page with the form insert and replace with a fresh copy.
If still stuck please provide the form's url and the text information you want to add so we can assist further.
Cheers!
-Sidney -
Situation:
SSIS Package designed in SQL Server 2012 - SQL Server Data Tools
Windows 7 - 64 bit.
The package (32 bit) extracts data from a SQL Server db to an Excel Output file, via an OLE DB connection.
It uses 3 package variables:
*) SQLCommand (String) to specify the SQL Statement to be executed by the package
Property path: \Package.Variables[User::ExcelOutputFile].Properties[Value]
Value: f:\Output Data.xls
*) EXCELOutputFIle (String) to specify path and filename of the Excel output file
Property path: \Package.Variables[User::SQLCommand].Properties[Value]
Value: select * from CartOrder
*) VarObjectDataSet (Object) to hold the data returned by SQL Server)
Property path: \Package.Variables[User::VarObjectDataSet].Properties[Value]
Value: System.Object
It consists out of 2 components:
*) Execute SQL Task: executes the SQL Statement passed on via a package variable. The resultng rows are stored in the package variable VarObjectDataSet
*) Script Task: creates the physical output file and iterates VarObjectDataSet to populate the Excel file.
Outcome and issue:The package runs perfectly fine both in SQL Server Data Tools itself and in DTEXECUI.
However, whenever I run it via SQL Server Agent (with 32 bit runtime option set), it returns the errror message below.
This package contains 3 package variables but the error stating that a package variable can not be set, pops up for the VarObjectDataSet only. This makes me wonder if it is uberhaupt possible to set the value of a package variable
of type Object.
Can anybody help me on this please ?
Message
Executed as user: NT Service\SQLSERVERAGENT. Microsoft (R) SQL Server Execute Package Utility Version 11.0.2100.60 for 32-bit Copyright (C) Microsoft Corporation. All rights reserved. Started: 6:40:20 PM DTExec: Could
not set \Package.Variables[User::VarObjectDataSet].Properties[Value] value to System.Object. Started: 6:40:20 PM Finished: 6:40:21 PM Elapsed: 0.281 seconds. The package execution failed. The step failed.
Thank you very much in advance
JurgenHi Visakh,
thank you for your reply.
So, judging by your reply, not all package variables used inside a package need to be set a value for when run in DTEXEC ?
I already tried that but my package ended up in error (something to do with "... invocation ...." and that error is anything but clearly documented. Judging by the error message itself, it looks like it could be just about anything. that is why I asked my
first question about the object type package variable.
Now, I will remove it from the 'set values' list and try another go cracking the unclear error-message " ... invocation ...". Does an error message about " ... invocation ..." ring any bells, now that we are talking about it here ?
Thx in advance
Jurgen
Yes exactly
You need to set values only forthem which needs to be controlled from outside the package
Any variable which gets its value through expression set inside package or through a query inside execute sql task/script task can be ignored from DTExec
Ok I've seen the invocation error mostly inside script task. This may be because some error inside script written in script task. If it appeared after you removed the variable then it may because some reference of variable existing within script task.
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Adding a field to an sql statement in Oracle Reports error ORA-00933
We have been requested to add a field that already exists in the table referred to by the sql statement in Oracle Reports Builder. The report was set up by a consultant about 3 yrs ago and we don't really have much skill in this area. What is happening when I try to modify the SQL statement, either adding a field or deleting a field to the SELECT statement, causes an error message preventing the statement from being saved. The only way out of the error message is to click Cancel. The error message is
ORA-00933:SQL command not properly ended
ORDER BY Program ==> NAME
Even adding or deleting a space anywhere in the SQL statement causes the error (not adding any new fields). A coworker found that if we comment out the ORDER BY, the statement will accept the new field in the SELECT section, however then we lose the order by functionality. I would like to add one additional field before the FROM. Not sure if any additional data are needed. Thank you.
SELECT p.person_uid PIDM_KEY, p.id_number ID,
p.full_name_lfmi name,
p.BIRTH_DATE, p.GENDER Sex,
Decode(a.residency,'D',p.Primary_ethnicity,'F') Ethn,
a.academic_period TERM,
CASE WHEN :p_group_by = 'PROGRAM' THEN a.program
ELSE ' '
END AS Program,
a.COLLEGE, a.degree, a.major, ' ' rule,
a.STUDENT_POPULATION,a.STUDENT_LEVEL, a.application_status Status, a.application_status_date app_sts_dte,
ad.decision_date1 Last_Dec_Date,
ad.decision1||' '||ad.decision2||' '|| ad.decision3||' '|| ad.decision4||' '|| ad.decision5 Decisions,
/* Deposit Date uses the last term entered in :p_term parameter string */
(SELECT MAX(deposit_effective_date) FROM usf_as_deposit WHERE account_uid = a.person_uid &term_clause group by account_uid) AS "DEPOSIT DATE",
ph.phone as PHONE,
CASE WHEN PS.FIRST_CONTACT IN ('NET','PAP','COM','COP') THEN PS.First_Contact
ELSE CASE WHEN ps.latest_contact IN ('NET','PAP','COM','COP') THEN PS.Latest_Contact
ELSE ' '
END
END AS FIRST_CONTACT,
DECODE(:p_address,'Y',REPLACE(adr.street1||' '||adr.street2||' '||adr.street3||' '||adr.city||','||adr.state||' '||adr.nation||' '||adr.zip,' ',' '),' ') as address, adr.nation, adr.state,
goremal_email_address email, a.residency, a.application_date, p.primary_ethnicity, c.cohort
FROM MST_ADMISSIONS_APPLICATION A,
MST_PERSON p,mst_pre_student PS, Admissions_Cohort c, usf_v_phone_pr_ma ph,
MST_admissions_decision_slot AD, usf_v_email, usf_v_address_dr_lr_ma_pr adr
WHERE a.PERSON_UID = p.person_uid
AND a.curriculum_priority = 1
AND a.person_uid = ps.person_uid
AND a.person_uid = ad.person_Uid(+)
AND a.person_uid = goremal_pidm(+)
AND a.person_uid = adr.pidm(+)
AND a.person_uid = ph.pidm(+)
AND ph.rnum(+) = 1
AND a.person_uid = c.person_uid(+)
AND a.academic_period = c.academic_period(+)
&Where_Clause
/* TAKE OUT FOLLOWING LINE AFTER DATA IS CLEANED UP */
AND NOT(p.id_number = '00000000' OR SUBSTR(p.id_number,1,1) = 'B' OR UPPER(p.full_name_lfmi) LIKE '%TESTING%')
AND a.application_status_date >= NVL(:p_as_of_date,sysdate-8000)
AND a.academic_period = ad.academic_period(+)
AND a.application_number = ad.application_number(+)
AND a.degree <> 'ND' /* AND a.college <> 'LW' -- Does not need non-degree and law students */
&Cohort_Clause
ORDER BY Program &ORDER_CLAUSEHi Denis,
I tried your suggestion. The good thing is that adding the comma allowed me to be able to add a.campus to the select statement, unfortunately, another error message happened.
ORA-00936: missing expression SELECT p . person_uid PIDM_KEY ,
p . id_number , p . full_name_lfmi name , p . BIRTH_DATE , p . GENDER Sex ,
Decode ( a . residency , 'D' , p . Primary_Ethnicity , 'F' ) Ethn , a . academic_period TERM ,
CASE WHEN : P_group_by = 'PROGRAM THEN a I started over and tried only putting in the comma and get the same message even though I didn't add campus. After that, removed the comma which led to the ORA-00933 error message. So once again, I had to close the file without saving, in order for the report to run at all. -
DBIF_RSQL_INVALID_RSQL The maximum size of an SQL statement was exceeded
Dear,
I would appreciate a helping hand
I have a problem with a dump I could not find any note that I can help solve the problem.
A dump is appearing at various consultants which indicates the following.
>>> SELECT * FROM KNA1 "client specified
559 APPENDING TABLE IKNA1
560 UP TO RSEUMOD-TBMAXSEL ROWS BYPASSING BUFFER
ST22
What happened?
Error in the ABAP Application Program
The current ABAP program "/1BCDWB/DBKNA1" had to be terminated because it has
come across a statement that unfortunately cannot be executed.
Error analysis
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_OPEN_SQL_DB', was not caught
and
therefore caused a runtime error.
The reason for the exception is:
The SQL statement generated from the SAP Open SQL statement violates a
restriction imposed by the underlying database system of the ABAP
system.
Possible error causes:
o The maximum size of an SQL statement was exceeded.
o The statement contains too many input variables.
o The input data requires more space than is available.
o ...
You can generally find details in the system log (SM21) and in the
developer trace of the relevant work process (ST11).
In the case of an error, current restrictions are frequently displayed
in the developer trace.
SQL sentence
550 if not %_l_lines is initial.
551 %_TAB2[] = %_tab2_field[].
552 endif.
553 endif.
554 ENDIF.
555 CASE ACTION.
556 WHEN 'ANZE'.
557 try.
>>> SELECT * FROM KNA1 "client specified
559 APPENDING TABLE IKNA1
560 UP TO RSEUMOD-TBMAXSEL ROWS BYPASSING BUFFER
561 WHERE KUNNR IN I1
562 AND NAME1 IN I2
563 AND ANRED IN I3
564 AND ERDAT IN I4
565 AND ERNAM IN I5
566 AND KTOKD IN I6
567 AND STCD1 IN I7
568 AND VBUND IN I8
569 AND J_3GETYP IN I9
570 AND J_3GAGDUMI IN I10
571 AND KOKRS IN I11.
572
573 CATCH CX_SY_DYNAMIC_OSQL_SEMANTICS INTO xref.
574 IF xref->kernel_errid = 'SAPSQL_ESCAPE_WITH_POOLTABLE'.
575 message i412(mo).
576 exit.
577 ELSE.
wp trace:
D *** ERROR => dySaveDataBindingValue: Abap-Field= >TEXT-SYS< not found [dypbdatab.c 510]
D *** ERROR => dySaveDataBindingEntry: dySaveDataBindingValue() Rc=-1 Reference= >TEXT-SYS< [dypbdatab.c 430]
D *** ERROR => dySaveDataBinding: dySaveDataBindingEntry() Rc= -1 Reference=>TEXT-SYS< [dypbdatab.c 137]
Y *** ERROR => dyPbSaveDataBindingForField: dySaveDataBinding() Rc= 1 [dypropbag.c 641]
Y *** ERROR => ... Dynpro-Field= >DISPLAY_SY_SUBRC_TEXT< [dypropbag.c 642]
Y *** ERROR => ... Dynpro= >SAPLSTPDA_CARRIER< >0700< [dypropbag.c 643]
D *** ERROR => dySaveDataBindingValue: Abap-Field= >TEXT-SYS< not found [dypbdatab.c 510]
D *** ERROR => dySaveDataBindingEntry: dySaveDataBindingValue() Rc=-1 Reference= >TEXT-SYS< [dypbdatab.c 430]
D *** ERROR => dySaveDataBinding: dySaveDataBindingEntry() Rc= -1 Reference=>TEXT-SYS< [dypbdatab.c 137]
Y *** ERROR => dyPbSaveDataBindingForField: dySaveDataBinding() Rc= 1 [dypropbag.c 641]
Y *** ERROR => ... Dynpro-Field= >DISPLAY_FREE_VAR_TEXT< [dypropbag.c 642]
Y *** ERROR => ... Dynpro= >SAPLSTPDA_CARRIER< >0700< [dypropbag.c 643]
I thank you in advance
If you require other information please requestHi,
Under certain conditions, an Open SQL statement with range tables can be reformulated into a FOR ALL ENTRIES statement:
DESCRIBE TABLE range_tab LINES lines.
IF lines EQ 0.
[SELECT for blank range_tab]
ELSE.
SELECT .. FOR ALL ENTRIES IN range_tab ..
WHERE .. f EQ range_tab-LOW ...
ENDSELECT.
ENDF.
Since FOR ALL ENTRIES statements are automatically converted in accordance with the database restrictions, this solution is always met by means of a choice if the following requirements are fulfilled:
1. The statement operates on transparent tables, on database views or on a projection view on a transparent table.
2. The requirement on the range table is not negated. Moreover, the range table only contains entries with range_tab-SIGN = 'I'
and only one value ever occurs in the field range_tab OPTION.
This value is then used as an operator with operand range_tab-LOW or range_tab-HIGH.In the above example, case 'EQ range_tab-LOW' was the typical case.
3. Duplicates are removed from the result by FOR ALL ENTRIES.This must not falsify the desired result, that is, the previous Open SQL statement can be written as SELECT DISTINCT.
For the reformulation, if the range table is empty it must be handled in a different way:with FOR ALL ENTRIES, all the records would be selected here while this applies for the original query only if the WHERE clause consisted of the 'f IN range_tab' condition.
FOR ALL ENTRIES should also be used if the Open SQL statement contains several range tables.Then (probably) the most extensive of the range tables which fill the second condition is chosen as a FOR ALL ENTRIES table.
OR
What you could do in your code is,
prior to querying;
since your select options parameter is ultimately an internal range table,
1. split the select-option values into a group of say 3000 based on your limit,
2. run your query against each chunck of 3000 parameters,
3. then put together the results of each chunk.
For further reading, you might want to have a look at the Note# 13607 as the first suggestion is what I read from the note. -
http://www.egbolig.dk/drift_bo_syd.rpt (HERE IS THE REPORT)
We are using SAP Crystal Report .NET Runtime files (http://scn.sap.com/docs/DOC-7824 newest version 13.0.9.1312) in our web asp.net application. Everything have been working fine, but we have can into problems when showing the certain kinda reports.
In our code get the reports sql statement using getSQLStatement.
Dim gp As New GroupPath() Dim sql As String = report.ReportClientDocument.RowsetController.GetSQLStatement(gp)
This will get the sql, and we use this sql (getSqlStatement) and attach a sql WHERE clause from the code to only get a certain number of records.
The report Drift_bo_syd.rpt has 5 tables, and the following sql statement.
Database/Show Sql Statement
SELECT "rekvstam"."Sel", "rekvstam"."Afd", "rekvstam"."Levadresse", "rekvstam"."Rekvisition", "rekvstam"."Lejemaal", "rekvstam"."Lejer", "rekvstam"."Udfoertaf", "rekvstam"."Udfoertdato", "rekvstam"."Krit", "Selskab"."Adresse", "Selskab"."Postby", "Selskab"."Tlf", "Selskab"."Fax", "rekvstam"."Kontor", "rekvstam"."Hjemme", "rekvstam"."Rekvdato", "rekvstam"."Aftale", "rekvstam"."InitialRet", "rekvstam"."Arbejde", "kreditor"."Att", "rekvstam"."Konto", "Selskab"."Navn", "Selskab"."Email", "Interessentadresse"."Navn", "Interessentadresse"."Adresse", "Interessentadresse"."Postby", "Interessentadresse"."Email1", "Interessentadresse"."Telefon_Fax", "Interessentadresse"."Type", "Interessentadresse"."Tlf1", "rekvstam"."tlfLejer", "kreditor"."Kred", "Interessentadresse"."Interessentnr" FROM (("Rekvstam" "rekvstam" INNER JOIN "Selskab" "Selskab" ON "rekvstam"."Sel"="Selskab"."Sel") LEFT OUTER JOIN "Kreditor" "kreditor" ON "rekvstam"."Kred"="kreditor"."Kred") INNER JOIN "Interessentadresse" "Interessentadresse" ON "kreditor"."Interessentnr"="Interessentadresse"."Interessentnr" WHERE "Interessentadresse"."Type"='K'
But if we run the report from our asp.net code, we get the following error:
Cannot determine the queries necessary to get data for this report. Failed to retrieve data from the database. Error in File Drift_Bo_Syd {97FED382-1BAC-4DB1-970F-9E098ECE28F1}.rpt: Failed to retrieve data from the database.
After a long time searching for a solution, we found out that if we place the column kred from the kreditor table on the report, the report will work. (field explorer / database fields / kreditor (table) / kred (column)
Very important is that the field "kreditor.kred" is a primary key of the table kreditor, and also used in the linking.!
(We can get the report to work if we call the sql statement with the "kreditor"."kred" in the SELECT statement.
SELECT "kreditor"."kred", "rekvstam"."Sel", "rekvstam"."Afd", "rekvstam"."Levadresse", "rekvstam"."Rekvisition", "rekvstam"."Lejemaal", "rekvstam"."Lejer", "rekvstam"."Udfoertaf", "rekvstam"."Udfoertdato", "rekvstam"."Krit", "Selskab"."Adresse", "Selskab"."Postby", "Selskab"."Tlf", "Selskab"."Fax", "rekvstam"."Kontor", "rekvstam"."Hjemme", "rekvstam"."Rekvdato", "rekvstam"."Aftale", "rekvstam"."InitialRet", "rekvstam"."Arbejde", "kreditor"."Att", "rekvstam"."Konto", "Selskab"."Navn", "Selskab"."Email", "Interessentadresse"."Navn", "Interessentadresse"."Adresse", "Interessentadresse"."Postby", "Interessentadresse"."Email1", "Interessentadresse"."Telefon_Fax", "Interessentadresse"."Type", "Interessentadresse"."Tlf1", "rekvstam"."tlfLejer", "kreditor"."Kred", "Interessentadresse"."Interessentnr" FROM (("Rekvstam" "rekvstam" INNER JOIN "Selskab" "Selskab" ON "rekvstam"."Sel"="Selskab"."Sel") LEFT OUTER JOIN "Kreditor" "kreditor" ON "rekvstam"."Kred"="kreditor"."Kred") INNER JOIN "Interessentadresse" "Interessentadresse" ON "kreditor"."Interessentnr"="Interessentadresse"."Interessentnr" WHERE "Interessentadresse"."Type"='K'
But it should not be necessary to include this field (which is the primary key and used in linking the report) in the sql statement,
BECAUSE it is not used in the report. So maybe this is a bug?
It has not been necessary in RDC Crystal Report or RAS Crystal Report in a classic asp envoriment.
Here is the code we use to set the reports SQL Statement)
Try
Dim conn As New SqlConnection(connString)
conn.Open()
Dim sd As New SqlDataAdapter(New SqlCommand(nySQL, conn))
Dim ds As New Data.DataSet()
Dim navn As String = report.Database.Tables.Item(0).Name
sd.Fill(ds, navn)
report.SetDataSource(ds)
conn.Close()
Catch ex As Exception
Throw
End TryHi Jan
I understand your problem completely but we have asked R&D to be able to edit the SQL and they explained due to how the report Engine works it's simply not possible anymore. It would take a complete rewrite in all of our DB drivers and query dll's to be able to allow it. They did that in CR 9 when they rewrote the DB drivers and removed the SQL part of the code into separate dll's and that is when the ability was removed, it's been that way ever since.
One possibility is to get the SQL from the Report and then connect to your DB using a .NET and if the results from the SQL is less than 5K rows and not too many columns you could then set the Report data source to a Dataset.
As long as all of the field names are the same CR will run the report using this work flow.
For data larger than 5K rows, limit is due to memory resources, you could save the DS to an XML file and then set the reports data source to the XML file. We've seen 100meg XML's used so the amount of data should not be a problem, but of course there are limits to everything so test...
This should not affect performance much.
So the work flow would be:
Load the report
Get the SQL Statement
Paste it into a Dataset Query
Something like this should get you started:
//string connString = "Provider=SQLOLEDB;Data Source=MySQLServer;Database=xtreme;User ID=sa;Password=pw";
string connString = "Provider=SQLNCLI10;Server=MySQLServer;Database=xtreme;User ID=sa;Password=pw";
Detail"".""Quantity"" FROM ""xtreme"".""dbo"".""Orders Detail"" ""Orders Detail""";
string sqlString = @"SELECT top 10* FROM ""xtreme"".""dbo"".""Financials"" ""Financials""";
System.Data.OleDb.OleDbConnection oleConn = new System.Data.OleDb.OleDbConnection(connString);
System.Data.OleDb.OleDbCommand cmd = oleConn.CreateCommand();
cmd.CommandText = sqlString;
System.Data.DataSet ds = new System.Data.DataSet();
OleDbDataAdapter oleAdapter = new OleDbDataAdapter(sqlString, oleConn);
//OleDbDataAdapter oleAdapter2 = new OleDbDataAdapter(sqlString2, oleConn);
DataTable dt1 = new DataTable("Financials");
//DataTable dt2 = new DataTable("Orders Detail");
oleAdapter.Fill(dt1);
//oleAdapter2.Fill(dt2);
ds.Tables.Add(dt1);
//ds.Tables.Add(dt2);
ds.WriteXml("c:\\reports\\sc2.xml", XmlWriteMode.WriteSchema);
// as long as the field names match exactly Cr has no problems setting report to a DS.
try
rpt.SetDataSource(ds.Tables[0]); // incremtent [0] for more than 1 table.
rpt.SetDataSource(ds);
catch (Exception ex)
MessageBox.Show("ERROR: Schema Mismatch. Error reported by CR: " + ex.Message);
//Now check for subreport and set to same DS
foreach (CrystalDecisions.CrystalReports.Engine.Section section in rpt.ReportDefinition.Sections)
foreach (CrystalDecisions.CrystalReports.Engine.ReportObject reportObject in section.ReportObjects)
if (reportObject.Kind == ReportObjectKind.SubreportObject)
CrystalDecisions.CrystalReports.Engine.SubreportObject subReport = (CrystalDecisions.CrystalReports.Engine.SubreportObject)reportObject;
CrystalDecisions.CrystalReports.Engine.ReportDocument subDocument = subReport.OpenSubreport(subReport.SubreportName);
subDocument.SetDataSource(ds);
And for XML it would use this part, not above I am saving the data and structure in the XML file so it should match what is in the report:
foreach (CrystalDecisions.CrystalReports.Engine.Table rptTable in rpt.Database.Tables)
try
rptTable.Location = btrDataFile.ToString(); // @"D:\Atest\" + rptTable.Location + ".xml";
catch (Exception ex)
MessageBox.Show("ERROR: " + ex.Message);
Only issue you may run into is sometimes XML does not have a direct field type and your original data source but you'll get an error if that happens which could be trapped and handled.
If you have a report that only uses 2 tables I do have code that will convert it to use a Command Object. That is the limit the engine is capable of, there is a lot of logic to be able to do this in CRD and the SDK so that is all we could get for now.
I hope that helps
Don -
Hi currently i have a problem with the sql statement.
The field name and the table name of the sql statement will depend on what the user input. We need to find out what records is in tableA columnA and not in tableB columnB.
Below is my sql statement:
SELECT * FROM (TABLEA) INTO TABLE ITABA
WHERE (COLUMNA)
NOT IN ( SELECT (COLUMNB) FROM (TABLEB) ).
=============================================
ColumnA = "the user input the field name"
TableA = " the user input the table name"
TableB = " the user input the table name"
The problem lies at the WHERE clause. The system generate a sql error which says "unable to find the field name".Hi,
Check the following code:
For dynamic table name....
REPORT demo_select_dynamic_database .
DATA wa TYPE scarr.
DATA name(10) TYPE c VALUE 'SCARR'.
SELECT *
INTO wa
FROM (name) CLIENT SPECIFIED
WHERE mandt = '000'.
WRITE: / wa-carrid, wa-carrname.
ENDSELECT.
For dynamic field list
REPORT demo_select_dynamic_columns .
DATA: itab TYPE STANDARD TABLE OF spfli,
wa LIKE LINE OF itab.
DATA: line(72) TYPE c,
list LIKE TABLE OF line(72).
line = ' CITYFROM CITYTO '.
APPEND line TO list.
SELECT DISTINCT (list)
INTO CORRESPONDING FIELDS OF TABLE itab
FROM spfli.
IF sy-subrc EQ 0.
LOOP AT itab INTO wa.
WRITE: / wa-cityfrom, wa-cityto.
ENDLOOP.
ENDIF.
Regards,
Bhaskar
Maybe you are looking for
-
How to include the mysql-connector in a simple .jar file
Well I started up with java again. Just messing around. This project I'm making now is just plain simple, I have a program thats going to read a table in a database from a server I have here at home. It works fine if I do like this: java javafil to r
-
Tecra A11 - No Video via mini DisplayPor​t
Hi There, I've recently aquired a Tecra A11 through my company that has two external video ports: VGA and mini DisplayPort. With my previous laptop I ran two External displays while the laptop was closed and I would like to achieve this with my new
-
I tried everything mail says entourage is default but it still opens mail, for instance i want to email from numbers it opens mail not entourage why??
-
Create popup - Makes user to enter a valid date
I need to create a popup menu and I must make the user enters a valid date in order to continue processing. Thanks In-advance! JeffG
-
Agent Configuration Assistant failed during installation of Oracle 9i
Hi, Currently having problem with installing Oracle 9i R2 (9.2.0.4) on Redhat. Am getting this error: Parameter "orahome" = /apps/oracle/product/9.2.0.4/db_1 Parameter "nodeinfo" = NO_VALUE Agent Service Failed Does anyone has a solution on this? Tha