Ssrs expression to sql query
Hi,
I am unable to convert the below ssrs expression to sql query. can you guys help.
-- IIF(Parameters!parameter1.Value Is Nothing,
-- " 3>2 ",
-- "column1 NOT LIKE
-- Replace(IIF(Left(Parameters!parameter1.Value, 1) = "'",
-- Parameters!parameter1.Value,
-- "'" & Replace(Parameters!parameter1.Value, "'", "''") "'"),
Thanks.
Thank you for your response Carnegie,
I actually have two stored procedures as below. (columns and joined tables are excluded)
I need to change the dates of @DateFrom and @DateTo parameter, I am passing @DateFrom_FD and @DateTo_LD as well.
CREATE ROCEDURE [dbo].[Test]
(@DateFrom
SMALLDATETIME
, @DateTo
SMALLDATETIME
, @program
VARCHAR(MAX))
AS
DECLARE
@DateFrom_FD
SMALLDATETIME
, @DateTo_LD
SMALLDATETIME
SET @DateFrom_FD = DATEADD(MONTH,DATEDIFF(MONTH,0,@DateFrom),0)
SET @DateTo_LD = DATEADD(DAY,-1,DATEADD(MONTH,DATEDIFF(MONTH,0,@DateTo)+1,0))
SELECT
DimDate.[Year]
, DimDate.[Month]
, DimDate.PK_Date
, CustomerID
FROM DimDate
WHERE DimDate.PK_Date BETWEEN @DateFrom_FD AND @DateTo_LD
Now I am using one of the SP as a main report and the other SP as a subreport.
In order to configure the main report and the subreport, I believe that I need to link them with parameters.
However, in the parameters of subreport properties, the option given are only @DateFrom and @DateTo.
No @DateFrom_FD AND @DateTo_LD
Therefore, I am thinking to use expressions to convert @DateFrom and @DateTo the same way I did in SQL.
I am not sure if this works....but this is the only thing that I could think of.
Thank you,
YJB5151
Similar Messages
-
[SQL QUERY] Select TCP Port Monitors and their related Watcher Node
Hi everybody,
I'm working on a SSRS report and SQL Query, I have no problem to find all my TCP Port Monitor (SCOM 2012 R2) based on the DisplayName, but I can't figure out how to get their related watcher nodes (in my case only 1 computer is a watcher node).
I can't find which table, which field, contains this information..?
Here is the query i started to write (i select * since i still searching for the right column):
SELECT
FROM StateView s
INNER JOIN BaseManagedEntity me on me.BaseManagedEntityId=s.BaseManagedEntityId
INNER JOIN MonitorView mv on mv.Id=s.MonitorId
INNER JOIN ManagedTypeView mtv on mtv.Id=s.TargetManagedEntityType
--where mv.DisplayName like 'Ping Target Status Check%'
AND me.IsDeleted = '0'
where mv.DisplayName like '%tcpmon%'
and mv.LanguageCode = 'ENU'
--and s.HealthState in (@state)
ORDER BY s.Lastmodified DESC
It would be great if someone can help me !
Thanks,
JulienHi,
After creating a TCP port monitor, we can find a table for this monitor under operationsmanager database :
SELECT *
FROM [OperationsManager].[dbo].[MT_TCPPortCheck_******WatcherComputersGroup]
You will find the warcher computer group.
Regards,
Yan Li
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected] -
How can I convert the below two queries in SQL to SSRS expression?
1) DATEADD(MONTH,DATEDIFF(MONTH,0,@DateFrom),0)
2) DATEADD(DAY,-1,DATEADD(MONTH,DATEDIFF(MONTH,0,@DateTo)+1,0))
Thank you,Thank you for your response Carnegie,
I actually have two stored procedures as below. (columns and joined tables are excluded)
I need to change the dates of @DateFrom and @DateTo parameter, I am passing @DateFrom_FD and @DateTo_LD as well.
CREATE ROCEDURE [dbo].[Test]
(@DateFrom
SMALLDATETIME
, @DateTo
SMALLDATETIME
, @program
VARCHAR(MAX))
AS
DECLARE
@DateFrom_FD
SMALLDATETIME
, @DateTo_LD
SMALLDATETIME
SET @DateFrom_FD = DATEADD(MONTH,DATEDIFF(MONTH,0,@DateFrom),0)
SET @DateTo_LD = DATEADD(DAY,-1,DATEADD(MONTH,DATEDIFF(MONTH,0,@DateTo)+1,0))
SELECT
DimDate.[Year]
, DimDate.[Month]
, DimDate.PK_Date
, CustomerID
FROM DimDate
WHERE DimDate.PK_Date BETWEEN @DateFrom_FD AND @DateTo_LD
Now I am using one of the SP as a main report and the other SP as a subreport.
In order to configure the main report and the subreport, I believe that I need to link them with parameters.
However, in the parameters of subreport properties, the option given are only @DateFrom and @DateTo.
No @DateFrom_FD AND @DateTo_LD
Therefore, I am thinking to use expressions to convert @DateFrom and @DateTo the same way I did in SQL.
I am not sure if this works....but this is the only thing that I could think of.
Thank you,
YJB5151 -
Can anyoone help me out to convert this SQL query in SSRS.
create table tickets_every_hour_ict(ddate datetime,dgroup varchar(50))
Insert into tickets_every_hour_ict
Select
--incident.actie,
incident.dataanmk ,
incident.ref_operatorgroup
/*,incident.ref_status as "Status",
incident.datumaangemeld as "Datum aanmelding" */
From incident
WHERE incident.dataanmk >= DATEADD(day,-7, GETDATE())
AND incident.ref_operatorgroup in ('Automatisering')
order by incident.dataanmk desc
Select ddate1,[00:00],[01:00],[02:00],[03:00],[04:00],[05:00],[06:00],[07:00],[08:00],[09:00],[10:00],[11:00],[12:00],
[13:00],[14:00],[15:00],[16:00],[17:00],[18:00],[19:00],[20:00],[21:00],[22:00],[23:00]
From
Select dgroup 'dgroup',cast(Convert(varchar(10),ddate,101)+' '+ convert(varchar(3),ddate,108) +'00' as date) ddate1,convert(varchar(3),ddate,108) +'00' dtime From tickets_every_hour_ict
)p
PIVOT
Count(dgroup) for dtime in([00:00],[01:00],[02:00],[03:00],[04:00],[05:00],[06:00],[07:00],[08:00],[09:00],[10:00],[11:00],[12:00],
[13:00],[14:00],[15:00],[16:00],[17:00],[18:00],[19:00],[20:00],[21:00],[22:00],[23:00])
)PVTIn SSRS you just need to use matrix container and use query as below
Select dgroup 'dgroup',cast(Convert(varchar(10),ddate,101)+' '+ convert(varchar(3),ddate,108) +'00' as date) ddate1,convert(varchar(3),ddate,108) +'00' dtime From tickets_every_hour_ict
Then in report add dtime column inside column group of matrix and add
=Count(Fields!dgroup.value)
as expression inside data area.
add
ddate1 to row group and you'll get pivoted values
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs
I created it your way but then it will not show the tables with 0. I want it to show all hours even if the count is 0. -
I am having trouble with passing dynamic string to sql query for executing SSRS reports.
I am using oracle database and I want to pass where clause parameter as "where LAND_NR = 6" to my select query.
For example: I want to execute Select * from employee :p_where.
where p_where parameter holds value "where LAND_NR = 6"
So it will treat as "Select * from employee where LAND_NR = 6" statement which will give me the list of records to display in my reports.
But it's not taking correct sql command throwing an error as "SQLcommand not properly ended."
How can I achieve this?You need to use dynamic sql
But please keep in mind that since you're using Oracle you may be better off posting this in some Oracle forums
This forum is specifically for SQL Server
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
SQL QUERY to create new schema in Oracle 10g Express
Can anyone provide the SQL query to create a new schema in Oracle 10g Express edition.
Can anyone provide a SQl query to create a
schema/user named 'test' with username as 'system'
and password as 'manager'system user is created during database creation, it's internal Oracle admin user that shouldn't be used as schema holder.
In Oracle database, Oracle user is schema holder there's no seperate schema name to be defined other than username. -
XSU and CURSOR expression in the sql query
Platform: oracle 8.X on ibm aix and java client code from
windows NT.
JDBC DRIVER: JDBC Oracle thin driver version 1.2.
when i execute a Sql satement with Cursor expression from the
java client code with XSU it returns an XML DOM But if the
CURSOR EXPRESSION IN THE SQL QUERY RETURNS EMPTY ROWS i get
back an error node with "ORA-01001 Invalid Cursor" error
message.i had aslo set the setNullAttributes(true) property
on oraclexmlquery.
Interestingly, if i exceute the same query in the SQL plus
it returns the column names with no rows.
is there any way where i can get xml document with table
structure, when there are no rows instead of ORA error message.Ok.
I assume that you have for one activity several asset PNR and for one asset several activity.
The factPNR is on this way a real bridge table. It's a way to be able to design a many-to-many relationship.
Have a look here for more detail on how to build a many-to-many relationship :
http://gerardnico.com/wiki/dw/data_quality/relationships#many-to-many
Therefore I assume that you want this design :
DimActivity -< FactActivity >- < FactPNR >- DimPNR and you will have :
DimActivity -< FactActivity >- < BridgeTable >- DimPNR How to build your bridge table ?
In the physical layer, :
* create a new table BridgeActivityPNR, open it and select "statement"
* enter your sql statement
SELECT DISTINCT A.ROW_WID ACTIVIDAD_WID, B.ROW_WID ASSET_WID
FROM W_ACTIVITY_F A,
W_ASSET_D B,
W_SRVREQ_D C,
X_S_CMPT_MTRC_F D,
X_S_ASSET_FEA_D E
WHERE A.X_SRA_SR_ID=C.INTEGRATION_ID AND
C.X_VLG_FLIGHT_ID=D.X_ROW_ID AND
D.X_ROW_ID=E.X_CM_ID AND
E.X_ASSET_ID=B.X_ROW_ID* add two columns in the column tab : ACTIVIDAD_WID and ASSET_WID
* create the physical join with the table FactActivity and DimPNR
* drag and drop in the business model your table BridgeActivityPNR
* in the BMM, create the complex join like this :
DimActivity -< FactActivity >- < BridgeTable >- DimPNR * open your logical bridge table and check the bridge table option.
And you are done if I didn't forget anything.
A complete example here :
http://gerardnico.com/wiki/dat/obiee/obiee_bridge_table -
SQL query from toplink expression
Hi,
I have a oracle.toplink.expressions.Expression object with me which has been created using oracle.toplink.expressions.ExpressionBuilder. I want to find its equivalent SQL query(say select emp.empname,emp.empId from employee emp) which will be fired in order to fetch data i.e. find its equivalent Statement/PreparedStatement or anything which will help me obtain the raw SQL statement about to be fired.
Please let me know if there is any soln.
Thanks,
Adithya.You can create ReadAllQuery with the expression and get the query's SQL using query.prepareCall() and then query.getSQLString().
James : http://www.eclipselink.org -
SSRS - Stored procedure with Dynamic SQL Query
Am calling stored procedure in SSRS report. I have used Dynamic SQL query in stored procedure as I don't know the column name and column count. And I have used like below at end of the stored procedure "select * from ##temptable".
As I have used dynamic column, am not able to create report with this stored procedure. Can someone help me out to resolve this issue.
It will be highly appreciated if I get help.
ThanksI have tried everything. But nothing has worked out.
If I get solution for below issue, it would be highly appreciated.
"An error occurred during local report processing.
The definition of the repport 'Main Report' is invalid.
The report defintion is not valid. Details: The report definition has an invalid target namespace 'http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition' which cannot be upgraded.
Thanks
Hello,
I would suggest you post the complete error message to us for further investigation, if you preview the report before you deploy you may get a more detailed error that will help diagnose the source of the problem.
This issue is more related to SQL Server Reporting Services, it's more appropriate to discuss it in the forum below:
https://social.technet.microsoft.com/Forums/sqlserver/en-US/home?forum=sqlreportingservices
Don't forget to elaborate your issue with more detail.
For the manual column, it might be the calculated field in SSRS. Here is the article for your reference, please see:
http://technet.microsoft.com/en-us/library/dd239322(v=sql.110).aspx
Regards,
Elvis Long
TechNet Community Support -
SSRS Report Viewer 2012 Cancel Link on loading spinner not stopping SQL Query
Hi
I searched the forum for this one and didn't find anything germane, so here goes.
In SSRS 2012 when running a report interactively if you hit cancel it basically does nothing but stop the spinner and prevent the request from completing.
I'd like to kill the SQL Query (dataset refresh) when the Cancel link is pressed.
I recall seeing on article somewhere about doing a callback and calling some other method on the web service to kill the query, but I can't find it now.
Any help is much appreciated!
ThanksHi James,
In SQL Server Reporting Services, a job will be created by SQL Server Agent if any of the following processes is underway:
query execution on a remote or local database server
report processing
report rendering
To cancel a job that is running on the report server, we can cancel the job directly or reduce the report execution time-out value in the SQL Server Management Studio. Please refer to the steps below:
Open SQL Server Management Studio, and connect to "Reporting Services".
Under the Report Server node, right-click on the "Jobs" folder and select "Refresh". Then, right-click on "Jobs" again and click "Cancel All Jobs".
Right-click on the Report Server node and open the "Server Properties" dialog.
Click the "Execution" option, and set the "Limit report execution to the following number of seconds:" to a much smaller number. After this issue is resolved, this configuration should revert to the previous state.
Reference:
Managing a Running Process
Setting Time-out Values for Report and Shared Dataset Processing
In addition, we can also use the KILL Transact-SQL statement to terminate a normal connection by terminating the transactions that are associated with the specified session ID. For the details information, you can refer to:
KILL (Transact-SQL)
If you still have any problem, please feel free to ask.
Regards,
Vicky Liu
Vicky Liu
TechNet Community Support -
Hi,
I tried to read data using the following SQL Query,
fp_work = 'ABCD'.
EXEC SQL PERFORMING WRITE_TO_ITAB .
SELECT fp_code, bank_acc_code, bank_acc_num,
INTO :gs_cds_data-FP_CODE,
:gs_cds_data-BANK_ACC_CODE,
:gs_cds_data-BANK_ACC_NUM,
FROM BANK_TABLE
WHERE fp_code = :fp_wrk
ENDEXEC.
*& Form WRITE_to_itab
FORM write_to_itab.
To move the data into the Internal Table.
APPEND gs_cds_data TO gt_cds_data.
CLEAR gs_cds_data.
ENDFORM. "WRITE_to_itab
and im getting the run time error..
What happened?
The error occurred in the current database connection "SAPABC".
How to correct the error
Database error text........: "ORA-00936: missing expression"
Triggering SQL statement...: "FETCH NEXT "
Internal call code.........: "[DBDS/NEW DSQL]"
Please check the entries in the system log (Transaction SM21).
You may able to find an interim solution to the problem
in the SAP note system. If you have access to the note system yourself,
use the following search criteria:
"DBIF_DSQL2_SQL_ERROR" C
If you cannot solve the problem yourself, please send the
following documents to SAP:
Can anyone give me a solution to correct this error?
In addition, Can i omit the WHERE clause, as i need to get all the data in the oracle database?BUT,
EXEC SQL.
connect to :LV_DB_NAME as :sy-uname
ENDEXEC.
EXEC SQL.
SET CONNECTION :sy-uname
ENDEXEC.
check sy-subrc..
connection is happening.. with sy-subrc value as ZERO -
How do I Send in a value to the SQL Query Expression's variable created using Declare in Power Query
I have gone through the other posts where in a parameter is sent to query created by power query but my ask is a bit different.
I am using a sql query to retrieve data using Power query which has 2 variables declared in the DECLARE section in the query.
Ex:
declare @Name varchar(1000)
SET @Name= 'Alpha'
declare @location nvarchar(1000)
SET @location= 'Bravo'
Select * from Infotable where Name = @Name and location = @location.
Now in the following query I would want to send in the values for the declared variables using a table in my worksheet. I have followed the stuff present in the following post
http://blog.oraylis.de/2013/05/using-dynamic-parameter-values-in-power-query-queries/
but when using the value name (let Name_parameter = Excel.Currentworkbook(), Name_Value = Name_Parameter [0][value]) in the Advance Editor as mentioned in the above post I am being thrown an error stating Name_Value column doesn't exist.
I am having a tough time figuring out what the problem could be..I have gone through the other posts where in a parameter is sent to query created by power query but my ask is a bit different.
I am using a sql query to retrieve data using Power query which has 2 variables declared in the DECLARE section in the query.
Ex:
declare @Name varchar(1000)
SET @Name= 'Alpha'
declare @location nvarchar(1000)
SET @location= 'Bravo'
Select * from Infotable where Name = @Name and location = @location.
Now in the following query I would want to send in the values for the declared variables using a table in my worksheet. I have followed the stuff present in the following post
http://blog.oraylis.de/2013/05/using-dynamic-parameter-values-in-power-query-queries/
but when using the value name (let Name_parameter = Excel.Currentworkbook(), Name_Value = Name_Parameter [0][value]) in the Advance Editor as mentioned in the above post I am being thrown an error stating Name_Value column doesn't exist.
I am having a tough time figuring out what the problem could be.. -
Using a SQL Query in an Alert and Matching a String
I've created an alert in 12.0.4 using a SQL Query and the field that I'm trying to match is a string. Originally the query returned multiple rows but when the alert still didn't fire, I modified the query WHERE clause to return only one row:
NAME RESPONSE
Are area lights working? No
My expression in the metric is RESPONSE. In the Monitor I'm matching a string equal to No. (Do I need double quotes around the matchvalue? Single quotes? No quotes?) The metric is in the 15min scan group, the role is xMII Developers and I'm in that role. The monitor alert string is ' = '. Both metric and monitor are active and I've subscribed to the monitor. Other alerts in the 15min scan group (all based on tag queries) are firing off properly.
Why is nothing showing up in the Alert Log?
David MacindoeDavid,
Did you figure out the answer? If not, I will try to find someone to address your question.
Mike -
Use realational operators in an SQL query??????
does any one knows how to use realational operators in an SQL query??????
i wud like to do something like
select decode(2<3,sysdate,sydate +1) from dual
but i know decode does not supports relational operators......
thanx and Regards
amytYou can use a CASE statement which does support relational operators, or if you must use DECODE, then you can use something like:
SELECT DECODE(SIGN(2 - 3),-1,sysdate,sysdate - 1)
FROM dual;The SIGN function returns -1 if the expression is < 0, 1 if the expression is > 0 and 0 if the expression is 0. This works for numeric comparisions. You can use the GREATEST or LEAST functions in a similar fashion for character comparisions.
TTFN
John -
PL/SQL function body returning SQL Query Problem
I have wandered around the forums and found quite a bit of helpful information that has gotten me to the point I am now at. Unfortuntely, PL/SQL is not my strongest point and I am getting an error when I attempt to run my report.
This is what I have for my package:
CREATE OR REPLACE PACKAGE LIB2.report_query
is
function create_report2(v1 IN varchar2) RETURN VARCHAR2;
end report_query;
CREATE OR REPLACE PACKAGE BODY LIB2.report_query
as
function create_report2(v1 in varchar2) return varchar2
is
l_vc_format HTMLDB_APPLICATION_GLOBAL.VC_ARR2 := HTMLDB_UTIL.STRING_TO_TABLE(v1);
l_format varchar2(255) := HTMLDB_UTIL.TABLE_TO_STRING(l_vc_format);
q1 varchar2(32767) := ' ';
begin
q1 :=
'select b.BOOK_ID, bk.book_id bkid, bkk.book_id bkkid, b.TITLE, b.SUBTITLE, b.SERIES, b.VOLUME, b.ISBN, f.FORMAT_RET, b.DESCRIPTION, .PUBLISHED,'
||'b.PURCHASED_FROM, b.COMMENTS, b.WEBSITE, c.LENGTH_MINS, stragg(p.last_name || '', '' || p.first_name) Author, '
||'stragg(p.person_id) person_id, '
||'pb.name PUBLISHER, decode(b.abridged, ''Y'',''Abridged'',''N'',''Unabridged'') Abridged,'
||'(nvl(d.disk01,0)+nvl(d.disk02,0)+nvl(d.disk03,0)+nvl(d.disk04,0)+nvl(d.disk05,0)+nvl(d.disk06,0)+nvl(d.disk07,0)+nvl(d.disk08,0)+'
||'nvl(d.disk09,0)+nvl(d.disk10,0)+nvl(d.disk11,0)+nvl(d.disk12,0)+nvl(d.disk13,0)+nvl(d.disk14,0)+nvl(d.disk15,0)+nvl(d.disk16,0)+nvl(d.disk17,0)+'
||'nvl(d.disk18,0)+nvl(d.disk19,0)+nvl(d.disk20,0)+nvl(d.disk21,0)+nvl(d.disk22,0)+nvl(d.disk23,0)+nvl(d.disk24,0)+nvl(d.disk25,0)+nvl(d.disk26,0)+'
||'nvl(d.disk27,0)+nvl(d.disk28,0)+nvl(d.disk29,0)+nvl(d.disk30,0)+nvl(d.disk31,0)+nvl(d.disk32,0)+nvl(d.disk33,0)+nvl(d.disk34,0)+nvl(d.disk35,0)+'
||'nvl(d.disk36,0)+nvl(d.disk37,0)+nvl(d.disk38,0)+nvl(d.disk39,0)+nvl(d.disk40,0)+nvl(d.disk41,0)+nvl(d.disk42,0)+nvl(d.disk43,0)+nvl(d.disk44,0)+'
||'nvl(d.disk45,0)+nvl(d.disk46,0)+nvl(d.disk47,0)+nvl(d.disk48,0)+nvl(d.disk49,0)+nvl(d.disk50,0)) total_tracks'
||'from book b, '
||'book bk,'
||'book bkk,'
||'person p,'
||'lkup_book_author la,'
||'lkup_book_publisher lp,'
||'lkup_book_format lkf,'
||'format f,'
||'publisher pb,'
||'conversion_info_audio c,'
||'lkup_book_disk_info d'
||'where b.book_id = la.book_id'
||'and b.book_id = bk.book_id'
||'and b.book_id = bkk.book_id'
||'and p.person_id = la.author_id'
||'and b.book_id = lp.book_id'
||'and b.book_id = c.book_id'
||'and b.book_id = d.book_id'
||'and b.book_id = lkf.book_id'
||'and lkf.format_id = f.format_id'
||'and pb.publisher_id(+) = lp.publisher_id'
||'and b.wishlist = ''N'''
||'and (upper(b.book_id) like ''%'' || upper(:P40_SEARCH) || ''%'''
||'or upper(b.title) like ''%'' || upper(:P40_SEARCH) || ''%'''
||'or upper(b.subtitle) like ''%'' || upper(:P40_SEARCH) || ''%'''
||'or upper(b.series) like ''%'' || upper(:P40_SEARCH) || ''%'''
||'or upper(b.volume) like ''%'' || upper(:P40_SEARCH) || ''%'''
||'or upper(b.isbn) like ''%'' || upper(:P40_SEARCH) || ''%'''
||'or upper(b.format) like ''%'' || upper(:P40_SEARCH) || ''%'''
||'or upper(b.description) like ''%'' || upper(:P40_SEARCH) || ''%'''
||'or upper(b.published) like ''%'' || upper(:P40_SEARCH) || ''%'''
||'or upper(b.purchased_from) like ''%'' || upper(:P40_SEARCH) || ''%'''
||'or upper(b.comments) like ''%'' || upper(:P40_SEARCH) || ''%'''
||'or upper(b.website) like ''%'' || upper(:P40_SEARCH) || ''%'''
||'or upper(p.last_name) like ''%'' || upper(:P40_SEARCH) || ''%'''
||'or upper(p.first_name) like ''%'' || upper(:P40_SEARCH) || ''%'''
||'or upper(pb.name) like ''%'' || upper(:P40_SEARCH) || ''%'''
||'or upper(:P40_SEARCH) is null)'
||'and ((upper(b.title) like ''%'' || upper(:P40_TITLE) || ''%'' or upper(:P40_TITLE) is null))'
||'and ((upper(b.series) like ''%'' || upper(:P40_SERIES) || ''%'' or upper(:P40_SERIES) is null))'
||'and ((upper(p.last_name) like ''%'' || upper(:P40_LASTNAME) || ''%'' or upper(:P40_LASTNAME) is null))'
||'and ((upper(p.first_name) like ''%'' || upper(:P40_FIRSTNAME) || ''%'' or upper(:P40_FIRSTNAME) is null))'
||'and ((upper(f.format_ret) in (upper(l_vc_format)) or upper(:P40_FORMAT) is null))'
||'group by b.BOOK_ID, bk.book_id, bkk.book_id, b.TITLE, b.SUBTITLE, b.SERIES, b.VOLUME, b.ISBN, f.FORMAT_ret, b.DESCRIPTION, '
||'b.PUBLISHED, b.PURCHASED_FROM, b.COMMENTS, b.WEBSITE, c.LENGTH_MINS, pb.name, b.abridged, '
||'(nvl(d.disk01,0)+nvl(d.disk02,0)+nvl(d.disk03,0)+nvl(d.disk04,0)+nvl(d.disk05,0)+nvl(d.disk06,0)+nvl(d.disk07,0)+nvl(d.disk08,0)+'
||'nvl(d.disk09,0)+nvl(d.disk10,0)+nvl(d.disk11,0)+nvl(d.disk12,0)+nvl(d.disk13,0)+nvl(d.disk14,0)+nvl(d.disk15,0)+nvl(d.disk16,0)+nvl(d.disk17,0)+'
||'nvl(d.disk18,0)+nvl(d.disk19,0)+nvl(d.disk20,0)+nvl(d.disk21,0)+nvl(d.disk22,0)+nvl(d.disk23,0)+nvl(d.disk24,0)+nvl(d.disk25,0)+nvl(d.disk26,0)+'
||'nvl(d.disk27,0)+nvl(d.disk28,0)+nvl(d.disk29,0)+nvl(d.disk30,0)+nvl(d.disk31,0)+nvl(d.disk32,0)+nvl(d.disk33,0)+nvl(d.disk34,0)+nvl(d.disk35,0)+'
||'nvl(d.disk36,0)+nvl(d.disk37,0)+nvl(d.disk38,0)+nvl(d.disk39,0)+nvl(d.disk40,0)+nvl(d.disk41,0)+nvl(d.disk42,0)+nvl(d.disk43,0)+nvl(d.disk44,0)+'
||'nvl(d.disk45,0)+nvl(d.disk46,0)+nvl(d.disk47,0)+nvl(d.disk48,0)+nvl(d.disk49,0)+nvl(d.disk50,0))';
RETURN q1;
EXCEPTION
WHEN OTHERS THEN
RETURN q1;
end create_report2;
end;
And here is what I have for my Region Source on my report:
return lib2.report_query.create_report2(v('P40_FORMAT'));
Here is my error when I run the page:
failed to parse SQL query:
ORA-00936: missing expression
I have tried the region source line in many variations, this is just my latest one. None of them have worked. I am quite obviously missing something quite important and probably extremely silly. Any ideas?
Thanks!
ChrissyChrissy,
This is what the package returns as a query:
select b.BOOK_ID, bk.book_id bkid, bkk.book_id bkkid,
b.TITLE, b.SUBTITLE, b.SERIES, b.VOLUME, b.ISBN, f.FORMAT_RET,
b.DESCRIPTION, .PUBLISHED,b.PURCHASED_FROM, b.COMMENTS, b.WEBSITE,
c.LENGTH_MINS, stragg(p.last_name || ', ' || p.first_name) Author,
stragg(p.person_id) person_id, pb.name PUBLISHER, decode(b.abridged,
'Y','Abridged','N','Unabridged') Abridged,
(nvl(d.disk01,0)+nvl(d.disk02,0)+nvl(d.disk03,0)+nvl(d.disk04,0)+nvl(d.disk05,0)
nvl(d.disk06,0)nvl(d.disk07,0)+nvl(d.disk08,0)+nvl(d.disk09,0)+nvl(d.disk10,0)
nvl(d.disk11,0)nvl(d.disk12,0)+nvl(d.disk13,0)+nvl(d.disk14,0)+nvl(d.disk15,0)
nvl(d.disk16,0)nvl(d.disk17,0)+nvl(d.disk18,0)+nvl(d.disk19,0)+nvl(d.disk20,0)
nvl(d.disk21,0)nvl(d.disk22,0)+nvl(d.disk23,0)+nvl(d.disk24,0)+nvl(d.disk25,0)
nvl(d.disk26,0)nvl(d.disk27,0)+nvl(d.disk28,0)+nvl(d.disk29,0)+nvl(d.disk30,0)
nvl(d.disk31,0)nvl(d.disk32,0)+nvl(d.disk33,0)+nvl(d.disk34,0)+nvl(d.disk35,0)
nvl(d.disk36,0)nvl(d.disk37,0)+nvl(d.disk38,0)+nvl(d.disk39,0)+nvl(d.disk40,0)
nvl(d.disk41,0)nvl(d.disk42,0)+nvl(d.disk43,0)+nvl(d.disk44,0)+nvl(d.disk45,0)
nvl(d.disk46,0)nvl(d.disk47,0)+nvl(d.disk48,0)+nvl(d.disk49,0)+nvl(d.disk50,0)) total_tracksfrom book b,
book bk,book bkk,person p,lkup_book_author la,lkup_book_publisher lp,
lkup_book_format lkf,format f,publisher pb,conversion_info_audio c,
lkup_book_disk_info dwhere b.book_id = la.book_idand b.book_id = bk.book_idand b.book_id = bkk.book_idand p.person_id = la.author_idand
b.book_id = lp.book_idand b.book_id = c.book_idand b.book_id = d.book_idand
b.book_id = lkf.book_idand lkf.format_id = f.format_idand pb.publisher_id(+) = lp.publisher_idand
b.wishlist = 'N'and (upper(b.book_id) like '%' || upper(:P40_SEARCH) || '%'
or upper(b.title) like '%' || upper(:P40_SEARCH) || '%'or upper(b.subtitle) like '%' ||
upper(:P40_SEARCH) || '%'or upper(b.series) like '%' || upper(:P40_SEARCH) || '%'or
upper(b.volume) like '%' || upper(:P40_SEARCH) || '%'or upper(b.isbn) like '%' ||
upper(:P40_SEARCH) || '%'or upper(b.format) like '%' || upper(:P40_SEARCH) || '%'or upper(b.description) like '%' || upper(:P40_SEARCH) || '%'or upper(b.published)
like '%' || upper(:P40_SEARCH) || '%'or upper(b.purchased_from) like '%' ||
upper(:P40_SEARCH) || '%'or upper(b.comments) like '%' || upper(:P40_SEARCH)
|| '%'or upper(b.website) like '%' || upper(:P40_SEARCH) || '%'or
upper(p.last_name) like '%' || upper(:P40_SEARCH) || '%'or upper(p.first_name)
like '%' || upper(:P40_SEARCH) || '%'or upper(pb.name) like '%' ||
upper(:P40_SEARCH) || '%'or upper(:P40_SEARCH) is null)and
((upper(b.title) like '%' || upper(:P40_TITLE) || '%' or
upper(:P40_TITLE) is null))and ((upper(b.series) like '%' ||
upper(:P40_SERIES) || '%' or upper(:P40_SERIES) is null))and
((upper(p.last_name) like '%' || upper(:P40_LASTNAME) || '%' or
upper(:P40_LASTNAME) is null))and ((upper(p.first_name) like '%' ||
upper(:P40_FIRSTNAME) || '%' or upper(:P40_FIRSTNAME) is null))and
((upper(f.format_ret) in (upper(l_vc_format)) or upper(:P40_FORMAT) is null))
group by b.BOOK_ID, bk.book_id, bkk.book_id, b.TITLE, b.SUBTITLE, b.SERIES, b.VOLUME,
b.ISBN, f.FORMAT_ret, b.DESCRIPTION, b.PUBLISHED, b.PURCHASED_FROM, b.COMMENTS, b.WEBSITE,
c.LENGTH_MINS, pb.name, b.abridged, (nvl(d.disk01,0)+nvl(d.disk02,0)+nvl(d.disk03,0)
nvl(d.disk04,0)nvl(d.disk05,0)+nvl(d.disk06,0)+nvl(d.disk07,0)+nvl(d.disk08,0)
nvl(d.disk09,0)nvl(d.disk10,0)+nvl(d.disk11,0)+nvl(d.disk12,0)+nvl(d.disk13,0)
nvl(d.disk14,0)nvl(d.disk15,0)+nvl(d.disk16,0)+nvl(d.disk17,0)+nvl(d.disk18,0)
nvl(d.disk19,0)nvl(d.disk20,0)+nvl(d.disk21,0)+nvl(d.disk22,0)+nvl(d.disk23,0)
nvl(d.disk24,0)nvl(d.disk25,0)+nvl(d.disk26,0)+nvl(d.disk27,0)+nvl(d.disk28,0)
nvl(d.disk29,0)nvl(d.disk30,0)+nvl(d.disk31,0)+nvl(d.disk32,0)+nvl(d.disk33,0)
nvl(d.disk34,0)nvl(d.disk35,0)+nvl(d.disk36,0)+nvl(d.disk37,0)+nvl(d.disk38,0)
nvl(d.disk39,0)nvl(d.disk40,0)+nvl(d.disk41,0)+nvl(d.disk42,0)+nvl(d.disk43,0)
nvl(d.disk44,0)nvl(d.disk45,0)+nvl(d.disk46,0)+nvl(d.disk47,0)+nvl(d.disk48,0)
nvl(d.disk49,0)nvl(d.disk50,0))
This query will never work. I marked only couple of errors you have there. Actually,
I meant "formating" errors rather than "syntactical" errors. You are missing spaces
all over the place. This is why I suggested to use a CLOB column in a test table
to return the query for debugging purposes - this is how I do it at least, when I need
to escape and concatenate a lot of code.
If you are referencing item values from a user session in a function or a procedure,
then you need to use the v('ITEM') syntax instead of :ITEM syntax. However, if the
output of this procedure will be used as a function returning SQL query, you will
be fine with :ITEM.
Denes Kubicek
http://deneskubicek.blogspot.com/
http://htmldb.oracle.com/pls/otn/f?p=31517:1
-------------------------------------------------------------------
Maybe you are looking for
-
Can two frames use the same SessionInfo object?
Hi, I have some questions on using InfoBus Frame. Do parent frame and child frame HAVE TO make use the same SessionInfo object? I tried to show Master table and Detailed table in seperate frame without login twice. I am lucky it works since I happene
-
How do I move a photo into an album in the new Photos application?
How do I move a photo into an album in the new Photos application?
-
Export webi report to excel print on 1 page
is there anyway in BO for a webi report when exported to excel to automatically print on one page? THe work around is to set the print area in excel itself wondering if it can be done in BO itself BO Edge XI 3.0 SQL 2005
-
Generating thumbnails when shuttling down timeline crashes FCP
Hi again! I'm having a multitude of problems (each in a different post for lack of confusion). When I open a project in FCP, and try to move down the timeline with the sliderbar at the bottom, FCP crashes. It seems to be related to FCP not being able
-
OWSM content routing issue (fs/crouter)
Hi, I am using OWSM console to implement content routing. I am following the steps mentioned in the administrator guide for OWSM. However, I am getting stuck at the very last step of content routing. Replace the endpoint URL with the following URL: h