Problem use SQL query in coding report with SBO
Hi everyone!
I have problem in execute query to delete and create a report with SQL 2000 in SAP.
Try
oForm.DataSources.DataTables.Item(0).ExecuteQuery("DELETE FROM rptReport")
Catch ex As Exception
End Try
oForm.DataSources.DataTables.Add("TestReport")
oForm.DataSources.DataTables.Item(0).ExecuteQuery("SELECT Number, RefDate, Memo into rptReport FROM dbo.OJDT")
oTable = oForm.DataSources.DataTables.Item("TestReport")
This code is error. I don't know how to execute 2 this sql command. Hope everyone help me hix hix! .
/Invalid query tree [300-33]. The SQL error is 8180/
But search in SQL book hasn't got that err. Some person spoke ExecuteQuery property wasn't support Table Delete and Create, it only support simple Select... I tried to use Recordset but don't success. Can I use "Delete" and "Select ... Into..." query another style??? Help me, please...!!!
Similar Messages
-
How to Use SQL Query having IN Clause With DB Adapter
Hi,
I am using 11.1.1.5 want to find out how to Use SQL Query having IN Clause With DB Adapter. I want to pass the IN values dynamically. Any ideas.
Thanksinvoke a stored procedure, it's safer than trying to put together an arbitrary SQL statement in the JCA adapter
-
Using SQL Query Values as Report Parameters
Why can I not use a page item to pass a value to a report when that page item is populated by a SQL query? If the item is populated as a database item, it can be passed, but not otherwise. Is there a way to work around this problem so that I can pass parameters to a report?
Hi, Jeff
Thanks for asking about this problem. This issue involves two tables mainly and others peripherally. I have a person table with borrower names and addresses, and each record in this table has an identifier in a column called IDENT. There is also a loan table with essential data on the loan, e.g.., loan identifier (DKTNR), the amount, interest rate, maturity date, etc., and also the IDENT linking to the person table. The borrower can be identified from any table that has the DKTNR in it by querying the borrower's name from the person table via the IDENT in the loan table. E.g., select borrower's name from loan_table, person_table where loan_table.ident = person_table.ident and the dktnr here equals the dktnr in the loan table.
I put the borrower's name on each APEX page using this query. I have one table, for example, which stores default accountings (i.e., accountings on loans that have defaulted and, generally, on which the lender has had to expend money to maintain the loan's maritine collateral). The records in this table are identified by the DKTNR. So on the reports page which shows this accounting, there is a non-database_column field (page item) populated via this query. If I want to use the value of this page item on an Oracle report that can be printed, I cannot do so. I place it into a variable (I forgot the name of the variable type, but it is the &PX_ITEM_NAME. type) in the URL which calls the report, but it will not be placed in the report. It is as if I have put a null value into the variable.
Ideas? -
How to use SQL Query in OBIEE Reports
Hi all,
I need to use direct sql query in report function column.. How can I implement that.
For example
Our report name is /shared/Automotive/Vehicle Services/Most Serviced Vehicle Models
we have to eliminate /shared/Automotive/Vehicle Services/ part from above report name.. I have done this in sql using the Query SUBSTR(COL,INSTR(COL,'/',1,4)+1).
So kindly help how to implement above sql query in Obiee.. Urgent.
Thanx in advance796797 wrote:
Hi all,
I need to use direct sql query in report function column.. How can I implement that.
For example
Our report name is /shared/Automotive/Vehicle Services/Most Serviced Vehicle Models
we have to eliminate /shared/Automotive/Vehicle Services/ part from above report name.. I have done this in sql using the Query SUBSTR(COL,INSTR(COL,'/',1,4)+1).
So kindly help how to implement above sql query in Obiee.. Urgent.
Thanx in advanceArrggh. I wish people wouldn't just answer a question without taking the time to actually think about what the user is asking for and if it makes sense. I like Diney's response best: Why not use the Title View? (i.e., asking questions until it is clear what is needed.) So along those lines, why are you trying to put the name of your report in a column of your report?? And why do you need to use direct sql to do this??
Kindly or not, urgent or not, state what you are trying to achieve and why you need it (if the obvious answer like "using the Title View" doesn't work for you), instead of simply assuming your method is right and you need to know how to do what envision. Your method may not be correct or necessary. -
How to numberformat when using sql:query alogn with c:forEach JSTL tags
Is there anyway to format the numeric values returned from the database when using <sql:query> alogn with <c:forEach> tags
Here is my jsp code
<sql:query..../>
<c:forEach var="row" items="${queryResults.rows}">
<tr>
<td><c:out value="${row.COL1}" /></td>
<td><c:out value="${row.COL2}" /></td>
</tr>
</c:forEach>
Col1 values are numeric without any formats Eg: 1000, 10000, 1000000 etc.
how can i format them to 1,000 , 10,1000 , 100,000 etcIt is polite to mention what your answer was. These posts are not just here for you to ask questions, but to be used as a resource for other people to find answers. Saying "I solved it" with no details helps noone.
I presume you discovered the JSTL <fmt:formatNumber> tag? -
Problem using SQL Loader with ODI
Hi,
I am having problems using SQL Loader with ODI. I am trying to fill an oracle table with data from a txt file. At first I had used "File to SQL" LKM, but due to the size of the source txt file (700MB), I decided to use "File to Oracle (SQLLDR)" LKM.
The error that appears in myFile.txt.log is: "SQL*Loader-101: Invalid argument for username/password"
I think that the problem could be in the definition of the data server (Physical architecutre in topology), because I have left blank Host, user and password.
Is this the problem? What host and user should I use? With "File to SQL" works fine living this blank, but takes to much time.
Thanks in advanceI tried to use your code, but I couldn´t make it work (I don´t know Jython). I think the problem could be with the use of quotes
Here is what I wrote:
import os
retVal = os.system(r'sqlldr control=E:\Public\TXTODI\PROFITA2/Profita2Final.txt.ctl log=E:\Public\TXTODI\PROFITA2/Profita2Final.txt.log userid=MYUSER/myPassword @ mySID')
if retVal == 1 or retVal > 2:
raise 'SQLLDR failed. Please check the for details '
And the error message is:
org.apache.bsf.BSFException: exception from Jython:
Traceback (innermost last):
File "<string>", line 5, in ?
SQLLDR failed. Please check the for details
at org.apache.bsf.engines.jython.JythonEngine.exec(JythonEngine.java:146)
at com.sunopsis.dwg.codeinterpretor.k.a(k.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.scripting(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSqlC.treatTaskTrt(SnpSessTaskSqlC.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand(DwgCommandSession.java)
at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
at com.sunopsis.dwg.cmd.e.i(e.java)
at com.sunopsis.dwg.cmd.h.y(h.java)
at com.sunopsis.dwg.cmd.e.run(e.java)
at java.lang.Thread.run(Unknown Source) -
ReportViewer using SQL Query error states: Incorrect syntax near ','.
Hello Community
Using Visual Studio 2008 and SQL Server 2008 I created a Windows Application
that uses SQL Server Reporting Services. The application uses ReportViewer and
calls a method written using SQL query.
1-First I created the form.
2-Next I dragged the ReportViewer (Toolbox) and Table (from DataSource) onto the form.
The problem is that when it reaches the last line of the SQL query (ie, da.Fill(ds, "TableOne");)
the code fails stating the error message:
"Incorrect syntax near ','."
The following is the code behind the form containing the query:
private void ReportPgm1_Load(object sender, EventArgs e)
// TODO: This line of code loads data into the 'ReportDBDataSet.TableOne' table. You can move, or remove it, as needed.
this.TableOneTableAdapter.Fill(this.ReportDBDataSet.TableOne);
reportViewer1.ProcessingMode = ProcessingMode.Local;
LocalReport ReportOneLocalReport = reportViewer1.LocalReport;
DataSet ds = new DataSet("ReportDBDataSet.TableOne");
pgmReportOne(FromDate, ToDate, ds);
ReportDataSource ds = new ReportDataSource("ReportDBDataSet.TableOne");
ds.Value = dataset.Tables["TableOne"];
ReportOneLocalReport.DataSources.Clear();
ReportOneLocalReport.DataSources.Add(ds);
this.reportViewer1.RefreshReport();
private void pgmReportOne(DateTime FromDate, DateTime ToDate, DataSet ds)
SqlConnection connection = new SqlConnection("Data Source=ReportDBServer;Initial Catalog=ReportDB;Uid=sa;pwd=Password");
string sqlReportOne = "Select ([InDate], [FirstName], [LastName], [AGe]" +
"from TableOne";
SqlCommand command = new SqlCommand(sqlReportONe, connection);
command.Parameters.Add(new SqlParameter("paramFDate", FromDate));
command.Parameters.Add(new SqlParameter("paramTDate", ToDate));
SqlDataAdapter da = new SqlDataAdapter(command);
da.Fill(ds, "TableOne");
Why does the last line throw an error?
Thank you
Shabeaut--NOTE: The statement below cannot be run on SQL Server 2012
--If you have an earlier version and can set the compatibility
--level to 80, it can be run.
SELECT sso.SpecialOfferID, Description, DiscountPct, ProductID
FROM Sales.SpecialOffer sso,
Sales.SpecialOfferProduct ssop
WHERE sso.SpecialOfferID *= ssop.SpecialOfferID
AND sso.SpecialOfferID != 1
Hi Scott
The *= is old syntax and not compatible with SQL Server 2012 (as stated in the comments).
You could do something like this instead
SELECT sso.SpecialOfferID
,Description
,DiscountPct
,ProductID
FROM Sales.SpecialOffer sso
left outer join Sales.SpecialOfferProduct ssop on sso.SpecialOfferID = ssop.SpecialOfferID
WHERE sso.SpecialOfferID != 1 -
How to get tax break up of TDS using SQL query ?
Hi all,
We are developing a TDS report using SQL query
Report will contain VendorCode,Date(ap inv date),Vendor name,
Bill value,TDS Amount,
Bill Value 100.000,
TDS (2%) - 2.000,
TDS Surcharge(10% on TDS) - 0.2,
TDS Cess(2%(TDS+TDS Surcharge)) - 0.044,
TDS HeCess(1%(TDS+TDS Surcharge)) - 0.022.
We have developed this report which displays upto
VendorCode,Date(ap inv date),Vendor name,
Bill value,TDS Amount.
How to show tax break up of TDS in SQL query ?
Thanks,
With regards,
Jeyakanthan.Hi gauraw,
Thank for your reply.
I modified the query , pasted the query
as below in query generator,
Select T0.DocNum,T0.DocDate,T0.CardCode as 'Ledger',T1.TaxbleAmnt As 'Bill value',T1.WTAmnt as 'TDSAmt',(TDSAmt * 0.1) as 'TDS_Surch',
(((TDSAmt0.1) + TDSAmt)0.02) as 'TDSCess',
(((TDSAmt0.1) + TDSAmt)0.01) as 'TDSHCess'
FROM OPCH T0 INNER JOIN PCH5 T1 ON T0.DocEntry = T1.AbsEntry
WHERE (T0.DocDate >= '[%0]' and T0.DocDate <= '[%1]')
on clicking execute its showing error message invalid column
name 'TDSAmt'.
With regards,
Jeyakanthan -
hi i am face with problem that is i want to show the how much approximate space required for backup or .bak file to get backup using sql query because i want to show the required memory for backup file on my java application
Hi FIROZ
TENNALI
Is this still an issue, or can we close the thread?
* closing a thread by marking the answer/s (there is a link beneath each response) and you can vote for useful responses as well (there is a link to vote on the left of each response)
Ronen Ariely
[Personal Site] [Blog] [Facebook] -
How to enable show SQL Query in Crystal report tool
Hi,
How can we enable the show SQL Query under Database tab in crystal report...
We have a requirement to modify the SQL query in Crystal reports.
Thanks,
GanaGana,
CR has an "Add Command" feature that will allow you to use hand-coded SQL as your data source.
Look at Defining an SQL Command in CR's online help (F1).
If a command was used in the original report creation, it's a simple matter to go in and edit that SQL.
If the report was not originally built w/ a Command you may find it difficult to switch over. In most cases it easier to start over from scratch, creating a new, blank report, that uses the command.
Jason -
List of Project Permission in PS 2010 Using SQL query
Hi
Is there any way to get a list of Project permissions associated with user using sql query. If i go manually Project center --> select project plan --> project permission it would take lot of time to find out for each user
Regards
SantoshBefore you continue (which you probably will overlook) - please understand that you should only be querying the REPORTING database and not the published database. A recommendation is to use a select statement statement to insert the tables into a table
int the reporting database, then query that table for your results/report.
The following page I believe has what you're looking for (Users with direct permissions- query below)
and more
http://pmpspecialists.com/Blog/2013/10/
SELECT MSP_RESOURCES.RES_NAME AS Resourcename, CONV.CONV_STRING AS Permission, MSP_WEB_SECURITY_SP_CAT_PERMISSIONS.WSEC_DENY AS Denied,
MSP_WEB_SECURITY_SP_CAT_PERMISSIONS.WSEC_ALLOW AS Allowed
FROM MSP_WEB_SECURITY_SP_CAT_PERMISSIONS INNER JOIN
MSP_WEB_SECURITY_SP_CAT_RELATIONS ON
MSP_WEB_SECURITY_SP_CAT_PERMISSIONS.WSEC_REL_UID = MSP_WEB_SECURITY_SP_CAT_RELATIONS.WSEC_REL_UID INNER JOIN
MSP_WEB_SECURITY_FEATURES_ACTIONS ON
MSP_WEB_SECURITY_FEATURES_ACTIONS.WSEC_FEA_ACT_UID = MSP_WEB_SECURITY_SP_CAT_PERMISSIONS.WSEC_FEA_ACT_UID INNER JOIN
MSP_WEB_CONVERSIONS AS CONV ON CONV.CONV_VALUE = MSP_WEB_SECURITY_FEATURES_ACTIONS.WSEC_FEA_ACT_NAME_ID INNER JOIN
MSP_RESOURCES ON MSP_WEB_SECURITY_SP_CAT_RELATIONS.WSEC_SP_GUID = MSP_RESOURCES.RES_SECURITY_GUID
WHERE (CONV.LANG_ID = 1033)
ORDER BY Resourcename, Permission -
See sql query from crystal report without crystal report
see sql query from crystal report without crystal report
Hi,
Depends on datasource type but you could have a look at ODBC trace or if you have access to the SQL Server you could use profiler to monitor the session.
Regards,
Craig
And this will only be of use if you know which Server/Insstance/Database the Report is connecting to...
Please click "Mark As Answer" if my post helped. Tony C. -
Dear All,
I am having some problem in SQL query. I am trying to get total sum of one inventory using the following query it works fine:
sum(case when mt.transaction_quantity > 0 then (mt.transaction_quantity) else 0 end) "TOT_IN"
,sum(case when mt.transaction_quantity >= 0 then 0 else (abs(mt.transaction_quantity)) end) "TOT_OUT"
But when I breakup the total sum into monthly breakup it fails to return the correct some could any one help what is wrong in the following query which is returning incorrect monthly sum. Following is that query. Your help in this regard would highly be appreciated.
sum(case when mt.transaction_quantity > 0 then (decode (floor (floor (to_date('17-MAR-2009')- mt.transaction_date) / 30), 0, mt.transaction_quantity, null)) else 0 end) "MONTH1_IN"
,sum(case when mt.transaction_quantity >= 0 then 0 else (decode (floor (floor (to_date('17-MAR-2009')- mt.transaction_date) / 30), 0, abs(mt.transaction_quantity), null)) end) "MONTH1_OUT"
ThanksHi,
Sorry, I don't really understand what you want.
Whenever you have a question, it helps to post:
(1) The version of Oracle (and any other relevant software) you're using
(2) A little sample data (just enough to show what the problem is) from all the relevant tables
(3) The results you want from that data
(4) Your best attempt so far (formatted)
(5) The full error message (if any), including line number
Executable SQL statements (like "CREATE TABLE AS ..." or "INSERT ..." statements) are best for (2).
If you can present your problem using commonly available tables (for example, tables in scott schema, or views in the data dictionary), then you can omit (2).
Formatted tabular output is okay for (3). Type these 6 characters
{code}
(small letters only, inside curly brackets) before and after the tabular text, to preserve spacing.
What exactly do you mean by "monthly breakup"?
If you want separate figures for each calendar month, Blushadow's suggestion (TRUNC (mt.transaction_date, 'MM')) is what you want.
If you want separate figures for the last 30 days before today, then something like what you posted ("FLOOR ((:target_date - mt.transaction_date) / 30)": the extra FLOOR doesn't help any) should work, so if you ran the query on March 17, 2009, the first "month" would be February 16 through March 17.
In a CASE statement, there's rarely any need to use DECODE. The following is equivalent to the last line of code you posted:
, SUM ( CASE
WHEN mt.transaction_quantity >= 0
THEN 0
WHEN TO_DATE ('17-MAR-2009', 'DD-MON-YYYY') - mt.transaction_date
BETWEEN 0
AND 29.99999 -- 30 days minus a fraction of a second
THEN ABS (mt.transaction_quantity)
END
) AS month1_outDon't you find this easier to understand (and debug)? -
Can I use custom query in DB Adapter with Polling
Hi All,
I am getting problem while using db adapter with polling. Can I use custom query in db adapter with polling.
I am using 2 tables; table 1 and table2
Structure of table1 is as:
File_name
Batch_id
Creation_date
Status
Structure of table2 is as:
Batch_id
Employee_ID
Last_Name
First_Name
Middle_Name
Group_ID
Site_ID
Dept_Num
Report_id
I have to use below query while polling to table1
Select count(*) as NOSEXP, Report_id
from table1, table2
where table2.batch_id =
table2.batch_id
and table1.Status= 0
group by Report_id;
I mean, when I use DB adapter to poll table1, I have to use above query.
Can you Please suggest on this.
Thanks in advance.I will check for existance not based on Primary key but based on three other fields in the table. I think , by default DB adapter configured for MERGE checks for existance based on PK. Can we change the Primary Key in the mapping file after the DB adapter is configured. In that case , will it check for existance based on the fields , I mention.
Edited by: user12020809 on Sep 16, 2012 6:08 PM -
Modify SQL query in Crystal Reports 2013
Bonjour,
Je voulais savoir s'il était possible de modifier la requête SQL dans Crystal Reports 2013, car les bases de données de notre application pour bibliothèque utilise un format de date particulier qu'il nous faut corriger directement dans la requête SQL.
Merci pour vos informations.
Cordialement
Claude Marcilly
Cannes - France
Hello,
I wanted to know if it was possible to modify the SQL query in Crystal Reports 2013. Databases of our application library indeed use a particular date format that we need to fix directly into the SQL query.
Thank you for your information.
Best regards
Claude Marcilly
Cannes - FranceHi Claude,
If you are creating reports using tables then go in Database menu and click on show SQL query, this will show the SQL generated by crystal reports. Now go in database expert and expend your connection and double click on Add Command and past the query which was generated by Crystal and try to modify the date format and click OK.
Now you need to redesign your reports based on Add command.
or
If your reports datasource is Add command you can directly go in add command and change it.
-Sastry
Maybe you are looking for
-
Runtime error while executing Tcode FAGLL03
Hello experts we have 2 clients in PRD 100,200 In 100 if i execute the tcode FAGLL03 it is showing the line items within 100 sec. where as in 200 if i execute FAGLL03 it is showing runtime error. if this executed in background it takes 1300 sec and f
-
Hi, I need to have a dynamic selsction of fields in a select query. I am using the same trick used in the where clause for te SELECT clause as follows: concatenate 'RBUKRS' 'RACCT' 'RZZRCNTR' v_field into v_sel separated by space . sel
-
Preserving Illustrator Elements in Multipage Document
Hi all, My employer just recently upgraded our Design Team to CS5. Previously, we had been making individual Illustrator documents and combining them in Acrobat. When we do that now, and reopen in Illustrator to edit the document, the elements break
-
Defaut Item Category 'U' coming in Purchase Requisition.
Hi, I am trying to create a Stock PO from Purchase Requisition through MD04. The purchase requisition has Item category "U" by default. Hence, whenever I try to create a Stock PO it is giving an error. I can only create a STO for those purchase requi
-
Is it possible to set a default option in product attributes?
Not a default in that customers don't need to select one, but also that --Please Select-- doesn't even show up? I've been looking into the CSS but I can't figure out where this is.