Standard sql statement v/s parameterized statement
Are standard sql statements more effiecient that parameterized sql statements (in former case binding happens at compile time and latter at run time?)
standard sql statement :
stmt->executeUpdate("INSERT INTO basket_tab
VALUES(`MANGOES', 3)");
parameterized sql statment :
stmt->setSQL("INSERT INTO basket_tab VALUES(:1, :2)");
stmt->setString(1, "Bananas");
stmt->setInt(2, 5);
stmt->executeUpdate();
Thanks much,
Nilofer
Parameterized SQL statements will be far more efficient. When you send a non-parameterized SQL statement to the database, Oracle has to do a hard parse of the statement in order to determine what sort of query plan to use. When the database sees a parameterized SQL statement, though, the parse step is much simpler-- it merely needs to find the previously cached query plan. Using parameterized statements is also much kinder on your shared pool, since you're not filling it up with a bunch of literal SQL statements that will never be reused.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC
Similar Messages
-
Why this SQL statement is wrong?
When I trying update my database using following statement:
String query = "UPDATE Flights" +
"SET AircraftType ='" + inputPanel.type.getText() +
"', EnterPoint = '" + inputPanel.point.getText() +
"',GroundSpeed = " + Integer.parseInt(inputPanel.speed.getText()) +
",Altitude =" + Integer.parseInt(inputPanel.altitude.getText()) +
"WHERE FlightNumber =" + inputPanel.flight.getText();
//where speep and altitude are ints
it always say:Syntax error in UPDATE statement.
I cannot understand why because this is a standard SQL statement I think.
Please help me!
Thanks in advancethis part is causing you problems:
"WHERE FlightNumber =" + inputPanel.flight.getText();
if FlightNumber is an integer then you should convert the text to an int:
"WHERE FlightNumber =" + Integer.parseInt(inputPanel.flight.getText());
or if it is a String then:
"WHERE FlightNumber ='" + inputPanel.flight.getText()+ "'";
Jamie -
Standard Sql scripting Vs CE built-in functions ? Which one should I need to choose?
Hello,
My source is csv files and I need to load these source files into HANA after doing some Transformations based on multiple validations (for example , based on grade, some new column has to be populated with some relevant hikes i.e. need to use if/else logic, case logic, either insert or update in target table …etc. This validation should be done for each and every row).
Assume some of the validations not possible through BODS and I need to implement this logic in HANA scripting (through procedures).
I know HANA supports two kinds of writing scripts i.e. HANA standard sql statements and CE_functions and I’ve heard from HANA documentation that CE functions gives more performance than standard sql statements and we should not mix together in a single block of code.
Please let me know which scenario should I go for? (I doubt if we can do all the functionalities using CE functions?
I am looking forward to your reply.
Thanks,
SreeMuch awaited reply.
Thanks a lot Jain !
But just one more point to bring out, if some of requirements can be done through both CE functions and Scripting, and some are possible through only scripting then we need to go for sql scripting only ..as we are not supposed to bring both the coding standards together, results in performance issues. ( Even your diagram shows either CE functions or Use SQL)
am i right?
Thanks,
Sree -
Selection Screen Parameters in SQL statements
Very new ABAP programmer here, so sorry if this is a really dumb question.
I'm trying to use my selection screen parameters to limit what is pulled in by my SQL statement (which seems to me to be a very logical thing to do). But I'm having a problem, that when no values are entered in the parameters, no data is returned in the table instead of all the data being returned.
Here is the code I have now:
SELECT cname1 akostl aorgeh asname apernr bbegda bendda bstatu
bconfl bmedcf breasn breman b~rqday
INTO CORRESPONDING FIELDS OF TABLE it_record
FROM ( ( pa0001 AS a
INNER JOIN pa0672 AS b ON bpernr = apernr )
INNER JOIN t500p AS c ON cpersa = awerks )
WHERE b~reman in so_reman
AND a~kostl in so_kostl
AND a~orgeh = p_orgeh
AND b~begda = p_begda
AND b~statu = p_statu
AND b~confl = p_confl
AND b~medcf = p_medcf
AND b~reasn = p_reasn
AND b~rqday = p_rqday
AND c~name1 = p_name1.
Can anyone tell me what I'd need to do to make it return properly?When you use parameters and no value is entered, it is treated as initial value. and the select statement looks for the initial values for those fields in the tabl;e...
you can make the parameters mandatory..then the user would be forced to enter something....
also you could do the following..
instead of parameters, use select-options with the addition no intervals and no extension, then practically it looks like a parameter but internally it is a select-option...
and in the select statement, give conditions like....field1 in <s_option name>....in this case if the user is not entering a value ...it is treated as *...
Thnaks & Regards,
Renjith -
JDBC sender adapter, ...Processing parameters, Update SQL statement
in JDBC sender adapter, ...Processing parameters, there is an Update SQL statement field, can u tell me ...why this is required,,,,,and in one of the example scenario...it was given as <TEST>..
Sudheep,
In the sender JDBC adapter you have the select query to select data from the database.
Let us summer 2 cases,
1. You have <test> in the UPDATE . In this case, during every polling interval the JDBC adapter will end up selecting the same data from the Database. This would not be needed in most f the cases. Why would you want to select the same data over an over again?
2. If you have an update Statement in the Update field you can make sure that the data selected in the selected statement is updated so that the same rows are not selected again.
Take a look at this blog,
/people/yining.mao/blog/2006/09/13/tips-and-tutorial-for-sender-jdbc-adapter
Regards
Bhavesh -
How to use reference parameters (BAPI Import Parameters) in SQL statements
Dear SAP gurus
I have a question on using parameters passed in a custom BAPI in SQL statements.
I am sending 2 parameters TABLENAME, COLUMNNAME into a custom bapi.
In the BAPI I need to give an sql command some thing like
select * from TABLENAME where COLUMNNAME = '100'.
Where TABLENAME and COLUMNAME may vary depend on what parameters are sent while calling this BAPI.
Even defining an internal table that has the structure of TABLENAME is not working.
I used the following statement 'data: ls_TABLENAME type TABLENAME', which generates error message saying TABLENAME is unknons.
Any feedback will be highly appreciated.
Thanks
RamAs far as I know you can not give parameter to a select query like that. You should describe the tablename and the columnname as string type. Then assign the values to them you want to use in query.
data: str_table type string.
data: str_column type string.
select * from (str_table) into <g_t_table> where (str_column) = '100'.
If the table name is not determined until runtime, you must specify an output area with INTO . -
Transaction or standard program for testing Open SQL statements
Hi experts,
Is there a standard program or transaction that can be used to test Open SQL statements?, I was thinking in something similar to a SQL client like sqlcli, but for Open SQL and within SAP GUI.
I know i can write a test ABAP program for this matter but I rather a standard testing facily in this case
Thank you for any help
regardsHi Ozcan
I tried DB02 -> Diagnosis -> SQL Command editor , but I couldn't made it work. It is for Open SQL or for Native SQL?
I tried the following simple Open SQL statements inside the SQL Code tab there were erros
SELECT *
FROM /BI0/PCOMP_CODE
error was: Incorrect syntax near '/'.
SELECT * FROM DD03L
error was: Invalid object name 'DD03L'.
Where is the mistake?
regards -
How could I investigate SQL statement from standard audit record ?
We use Oracle 11gR2.
We use standard audit , audit_trail=DB.
We found suspicious audit record but that SQL_BIND,SQL_TEXT colums were NULL.
How could I investigate that SQL statement from standard audit record ?Only "DB, EXTENDED" would cause the SQL statement to be captured.
If you have the Diagnostics Pack licence you could try querying DBA_HIST_SQLTEXT (joined to DBA_HIST_SNAPSHOT) -- but this would only list SQLs captured by AWR (i.e. the "Top 'N'" SQLs in that snapshot).
Hemant K Chitale -
SSIS The parameterized sql statement yields metadata which does not match the main SQL statement
Hi all,
I'm getting the above error when trying to execute a custom lookup. What I'm trying to do is lookup the minimum promotional price between date ranges. The SQL executes fine in SSMS
SELECT refTable.PRICE
FROM ( SELECT MIN(PRICE) AS PRICE ,
NAME ,
ITEMRELATION ,
FROMDATE ,
TODATE
FROM [dbo].[AllCustPrices]
GROUP BY NAME ,
ITEMRELATION ,
FROMDATE ,
TODATE
) [refTable]
WHERE [refTable].[NAME] = ?
AND [refTable].[ITEMRELATION] = ?
AND ? BETWEEN [refTable].[FROMDATE]
AND [refTable].[TODATE]
but errors in SSIS?Apologies, totally forgot i posted a question on here. I still haven't resolved this. full error text is TITLE: Package Validation Error
Package Validation Error
ADDITIONAL INFORMATION:
Error at Data Flow Task [Lookup MIN Price [440]]: The parameterized SQL statement yields metadata which does not match the main SQL statement.
Error at Data Flow Task [SSIS.Pipeline]: "Lookup MIN Price" failed validation and returned validation status "VS_ISBROKEN".
Error at Data Flow Task [SSIS.Pipeline]: One or more component failed validation.
Error at Data Flow Task: There were errors during task validation.
(Microsoft.DataTransformationServices.VsIntegration)
BUTTONS:
OK
If I take off the MIN function and just put * SSIS is quite happy, it does not like MIN for some reason?
I'm really stumped with this... checked metadata for third parameter which is W/C Date DT_DBTIMESTAMP which is same as FROMDATE, TODATE where i'm using BETWEEN... -
ABAP Standards for a SQL statement
Hi,
I have a Native SQL statement in my ABAP user exit, pls. edit into a Open SQL,
SELECT v1~tknum v1~tsnum
INTO TABLE t_vtts
FROM vtts AS v1
FOR ALL ENTRIES IN t_shipment_del
WHERE v1~tknum = t_shipment_del-tknum AND
v1~vstel = rv_shppt AND
v1~kunnz = rv_shipto AND
v1~tsrfo = c_one AND
EXISTS ( SELECT addrnumber
FROM adrc CLIENT SPECIFIED
WHERE client = v1~mandt AND
addrnumber = v1~adrnz AND
date_from <= sy-datum AND
date_to >= sy-datum AND
post_code1 = rv_post_code1 ).
Thank youHhmm, for proper performance analysis we'd need some further details. Looking at your query I doubt that the following alternative helps, but you can give it a try, because subqueries are not always optimal:
SELECT tknum tsnum INTO TABLE t_vtts
FROM vtts INNER JOIN adrc ON
vtts~adrnz = adrc~addrnumber
FOR ALL entries IN t_shipment_del
WHERE tknum = t_shipment_del-tknum AND
vstel = rv_shppt AND
kunnz = rv_shipto AND
tsrfo = c_one AND
post_code1 = rv_post_code1.
You might need to add the condition on the address dates, but in any system I've checked so far, the ADRC-FROM date was always 00010101 and there was only one entry per address number (so if required, add it back).
For performance tuning requests you should try to provide some background information, like:
<ol>
<li>How many entries are you your table T_SHIPMENT_DEL</li>
<li>How many entries match your conditions on VTTS</li>
<li>How many entries get dropped because of the condition on postal code</li>
<li>Do a SQL trace and provide information about the execution plan chosen by the database</li>
</ol>
Also, you might want to consider moving your question to the forum.
Cheers, harald -
How do I use SQL statements to perform calculations with form fields????
Please help!!! I don't know how to use a SQL statement within my APEX form......
My form is below. The user will enter the values in the form. Click on Submit. Then we need to run a SQL select statement with those values.
Our form looks like this:
Start_Date ____________
Per_Period ____________
Period ____________
[Submit Button]
The user will enter these 3 values in the form.
This is an example of an user providing the values:
Start_Date 03/14/08_______
Per_Period $200.00________
Period 4____________
[Submit Button]
Then they will click the Submit Button.
The SQL statement (BELOW) returns output based on the users selections:
START_DATE PER_PERIOD PERIOD
14-MAR-2008 00:00 200 Week 1 of 4
21-MAR-2008 00:00 200 Week 2 of 4
28-MAR-2008 00:00 200 Week 3 of 4
04-APR-2008 00:00 200 Week 4 of 4
Total 800
This is the full text of the SQL that makes the output above:
with criteria as (select to_date('03/14/08', 'mm/dd/rr') as start_date,
4 as periods,
'Week' as period,
200 per_period from dual),
periods as (select 'Week' period, 7 days, 0 months from dual
union all select 'BiWeek', 14, 0 from dual
union all select 'Month', 0, 1 from dual
union all select 'ByMonth', 0, 2 from dual
union all select 'Quarter', 0, 3 from dual
union all select 'Year', 0 , 12 from dual
t1 as (
select add_months(start_date,months*(level-1))+days*(level-1) start_date,
per_period,
c.period||' '||level||' of '||c.periods period
from criteria c join periods p on c.period = p.period
connect by level <= periods)
select case grouping(start_date)
when 1 then 'Total'
else to_char(start_date)
end start_date,
sum(per_period) per_period,
period
from t1
group by rollup ((start_date, period))
THANKS VERY MUCH!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!You're just doing a parameterized report, where the input fields are your parameters.
Check out the Advanced Tutorial titled Parameterized Report here:
http://download.oracle.com/docs/cd/E10513_01/doc/appdev.310/e10497/rprt_query.htm#BGBEEBJA
Good luck,
Stew -
HOW TO: Post a SQL statement tuning request - template posting
This post is not a question, but similar to Rob van Wijk's "When your query takes too long ..." post should help to improve the quality of the requests for SQL statement tuning here on OTN.
On the OTN forum very often tuning requests about single SQL statements are posted, but the information provided is rather limited, and therefore it's not that simple to provide a meaningful advice. Instead of writing the same requests for additional information over and over again I thought I put together a post that describes how a "useful" post for such a request should look like and what information it should cover.
I've also prepared very detailed step-by-step instructions how to obtain that information on my blog, which can be used to easily gather the required information. It also covers again the details how to post the information properly here, in particular how to use the \ tag to preserve formatting and get a fixed font output:
http://oracle-randolf.blogspot.com/2009/02/basic-sql-statement-performance.html
So again: This post here describes how a "useful" post should look like and what information it ideally covers. The blog post explains in detail how to obtain that information.
In the future, rather than requesting the same additional information and explaining how to obtain it, I'll simply refer to this HOW TO post and the corresponding blog post which describes in detail how to get that information.
*Very important:*
Use the \ tag to enclose any output that should have its formatting preserved as shown below.
So if you want to use fixed font formatting that preserves the spaces etc., do the following:
\ This preserves formatting
\And it will look like this:
This preserves formatting
. . .Your post should cover the following information:
1. The SQL and a short description of its purpose
2. The version of your database with 4-digits (e.g. 10.2.0.4)
3. Optimizer related parameters
4. The TIMING and AUTOTRACE output
5. The EXPLAIN PLAN output
6. The TKPROF output snippet that corresponds to your statement
7. If you're on 10g or later, the DBMS_XPLAN.DISPLAY_CURSOR output
The above mentioned blog post describes in detail how to obtain that information.
Your post should have a meaningful subject, e.g. "SQL statement tuning request", and the message body should look similar to the following:
*-- Start of template body --*
The following SQL statement has been identified to perform poorly. It currently takes up to 10 seconds to execute, but it's supposed to take a second at most.
This is the statement:
select
from
t_demo
where
type = 'VIEW'
order by
id;It should return data from a table in a specific order.
The version of the database is 11.1.0.7.
These are the parameters relevant to the optimizer:
SQL>
SQL> show parameter optimizer
NAME TYPE VALUE
optimizer_capture_sql_plan_baselines boolean FALSE
optimizer_dynamic_sampling integer 2
optimizer_features_enable string 11.1.0.7
optimizer_index_caching integer 0
optimizer_index_cost_adj integer 100
optimizer_mode string ALL_ROWS
optimizer_secure_view_merging boolean TRUE
optimizer_use_invisible_indexes boolean FALSE
optimizer_use_pending_statistics boolean FALSE
optimizer_use_sql_plan_baselines boolean TRUE
SQL>
SQL> show parameter db_file_multi
NAME TYPE VALUE
db_file_multiblock_read_count integer 8
SQL>
SQL> show parameter db_block_size
NAME TYPE VALUE
db_block_size integer 8192
SQL>
SQL> show parameter cursor_sharing
NAME TYPE VALUE
cursor_sharing string EXACT
SQL>
SQL> column sname format a20
SQL> column pname format a20
SQL> column pval2 format a20
SQL>
SQL> select
2 sname
3 , pname
4 , pval1
5 , pval2
6 from
7 sys.aux_stats$;
SNAME PNAME PVAL1 PVAL2
SYSSTATS_INFO STATUS COMPLETED
SYSSTATS_INFO DSTART 01-30-2009 16:25
SYSSTATS_INFO DSTOP 01-30-2009 16:25
SYSSTATS_INFO FLAGS 0
SYSSTATS_MAIN CPUSPEEDNW 494,397
SYSSTATS_MAIN IOSEEKTIM 10
SYSSTATS_MAIN IOTFRSPEED 4096
SYSSTATS_MAIN SREADTIM
SYSSTATS_MAIN MREADTIM
SYSSTATS_MAIN CPUSPEED
SYSSTATS_MAIN MBRC
SYSSTATS_MAIN MAXTHR
SYSSTATS_MAIN SLAVETHR
13 rows selected.Here is the output of EXPLAIN PLAN:
SQL> explain plan for
2 -- put your statement here
3 select
4 *
5 from
6 t_demo
7 where
8 type = 'VIEW'
9 order by
10 id;
Explained.
Elapsed: 00:00:00.01
SQL>
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
Plan hash value: 1390505571
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 60 | 0 (0)| 00:00:01 |
| 1 | TABLE ACCESS BY INDEX ROWID| T_DEMO | 1 | 60 | 0 (0)| 00:00:01 |
|* 2 | INDEX RANGE SCAN | IDX_DEMO | 1 | | 0 (0)| 00:00:01 |
Predicate Information (identified by operation id):
2 - access("TYPE"='VIEW')
14 rows selected.Here is the output of SQL*Plus AUTOTRACE including the TIMING information:
SQL> rem Set the ARRAYSIZE according to your application
SQL> set autotrace traceonly arraysize 100
SQL> select
2 *
3 from
4 t_demo
5 where
6 type = 'VIEW'
7 order by
8 id;
149938 rows selected.
Elapsed: 00:00:02.21
Execution Plan
Plan hash value: 1390505571
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 60 | 0 (0)| 00:00:01 |
| 1 | TABLE ACCESS BY INDEX ROWID| T_DEMO | 1 | 60 | 0 (0)| 00:00:01 |
|* 2 | INDEX RANGE SCAN | IDX_DEMO | 1 | | 0 (0)| 00:00:01 |
Predicate Information (identified by operation id):
2 - access("TYPE"='VIEW')
Statistics
0 recursive calls
0 db block gets
149101 consistent gets
800 physical reads
196 redo size
1077830 bytes sent via SQL*Net to client
16905 bytes received via SQL*Net from client
1501 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
149938 rows processed
SQL>
SQL> disconnect
Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing optionsThe TKPROF output for this statement looks like the following:
TKPROF: Release 11.1.0.7.0 - Production on Mo Feb 23 10:23:08 2009
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Trace file: orcl11_ora_3376_mytrace1.trc
Sort options: default
count = number of times OCI procedure was executed
cpu = cpu time in seconds executing
elapsed = elapsed time in seconds executing
disk = number of physical reads of buffers from disk
query = number of buffers gotten for consistent read
current = number of buffers gotten in current mode (usually for update)
rows = number of rows processed by the fetch or execute call
select
from
t_demo
where
type = 'VIEW'
order by
id
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 1501 0.53 1.36 800 149101 0 149938
total 1503 0.53 1.36 800 149101 0 149938
Misses in library cache during parse: 0
Optimizer mode: ALL_ROWS
Parsing user id: 88
Rows Row Source Operation
149938 TABLE ACCESS BY INDEX ROWID T_DEMO (cr=149101 pr=800 pw=0 time=60042 us cost=0 size=60 card=1)
149938 INDEX RANGE SCAN IDX_DEMO (cr=1881 pr=1 pw=0 time=0 us cost=0 size=0 card=1)(object id 74895)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 1501 0.00 0.00
db file sequential read 800 0.05 0.80
SQL*Net message from client 1501 0.00 0.69
********************************************************************************The DBMS_XPLAN.DISPLAY_CURSOR output:
SQL> -- put your statement here
SQL> -- use the GATHER_PLAN_STATISTICS hint
SQL> -- if you're not using STATISTICS_LEVEL = ALL
SQL> select /*+ gather_plan_statistics */
2 *
3 from
4 t_demo
5 where
6 type = 'VIEW'
7 order by
8 id;
149938 rows selected.
Elapsed: 00:00:02.21
SQL>
SQL> select * from table(dbms_xplan.display_cursor(null, null, 'ALLSTATS LAST'));
PLAN_TABLE_OUTPUT
SQL_ID d4k5acu783vu8, child number 0
select /*+ gather_plan_statistics */ * from t_demo
where type = 'VIEW' order by id
Plan hash value: 1390505571
| Id | Operation | Name | Starts | E-Rows | A-Rows | A-Time | Buffers | Reads |
| 0 | SELECT STATEMENT | | 1 | | 149K|00:00:00.02 | 149K| 1183 |
| 1 | TABLE ACCESS BY INDEX ROWID| T_DEMO | 1 | 1 | 149K|00:00:00.02 | 149K| 1183 |
|* 2 | INDEX RANGE SCAN | IDX_DEMO | 1 | 1 | 149K|00:00:00.02 | 1880 | 383 |
Predicate Information (identified by operation id):
2 - access("TYPE"='VIEW')
20 rows selected.I'm looking forward for suggestions how to improve the performance of this statement.
*-- End of template body --*
I'm sure that if you follow these instructions and obtain the information described, post them using a proper formatting (don't forget about the \ tag) you'll receive meaningful advice very soon.
So, just to make sure you didn't miss this point:Use proper formatting!
If you think I missed something important in this sample post let me know so that I can improve it.
Regards,
Randolf
Oracle related stuff blog:
http://oracle-randolf.blogspot.com/
SQLTools++ for Oracle (Open source Oracle GUI for Windows):
http://www.sqltools-plusplus.org:7676/
http://sourceforge.net/projects/sqlt-pp/Alex Nuijten wrote:
...you missed the proper formatting of the Autotrace section ;-)Alex,
can't reproduce, does it still look unformatted? Or are you simply kidding? :-)
Randolf
PS: Just noticed that it actually sometimes doesn't show the proper formatting although the code tags are there. Changing to the \ tag helped in this case, but it seems to be odd.
Edited by: Randolf Geist on Feb 23, 2009 11:28 AM
Odd behaviour of forum software -
Dynamic SQL statement in a Procedure
Hi,
is it possible to use a variable in place of a column name in a sql statement inside a procedure. Or to create the whole statement as a sql statement and execute it (preferrably with parameters - rather than concatinating the values).
Thanks for any help or direction
ElliotTurns out you can do the following very nicely (dynamic sql with parameterized values)
Declare
id number(10,0);
sql_stmt varchar2(300);
fieldName varchar2(30);
fieldValue varchar2(100);
id := 30;
fieldName := 'somecolumn';
fieldValue := 'some value';
sql_stmt := 'UPDATE myTable SET ' || fieldName || ' = :1 WHERE id = :2';
EXECUTE IMMEDIATE sql_stmt USING fieldValue, id; -
Execute Stored Procedure SQL Statement with Parameter from Cell
I would like to know if there is a way to pass the parameters to SQL Statement of Power Query. For example, I have a SQL Statement as follows:
EXEC [dbo].[spReportBuilder]
@Report = N'Revenue Summary',
@Year = N'2014',
@Period = N'11'
I would like to know if it is possible to pass the @Report, @Year, @Period values from cells in the workbook, preferably without vba.
Thanksrtisserand,
Here is the M code:
let
IDValue = Excel.CurrentWorkbook(){[Name="YearTable"]}[Content],
Source = Sql.Database("localhost", "AdventureWorks2012", [Query="EXEC [dbo].[spReportBuilder] @Report = N'Revenue Summary', @Year = N'" & Number.ToText(IDValue[ID]{0}) & "', @Period = N'11'"])
in
Source
Some notes:
You have to reference the excel query from another step in the query or you will get the following error:
Formula.Firewall: Query <>something<> references other queries or steps and so may not directly access a data source. Please rebuild this data combination.
I only did the parameter for one value.
Hope this helps.
Reeves
Denver, CO -
Produce report NOT based on a single sql statement
I want to produce a tabular report based on a series of sql statments. Specifically, a report of managers that wil include counts of employees that are in other tables using differing criterias.
Name Count Count
using using
criteria 1 criteria 2
Manager1 35 242
I would expect to write an anonymous pl/sql block with a driving cursor determining the managers to report on. Within that cursor, I would execute a number of other queries to derive the count for each of the two columns.
I have tried creating a report region based on a sql statement, but that requires a single sql statement. I also tried creating a report region based on plsql, but it required an into statement of defined items. This option looks like it can provide multiple rows, but since it selected 'INTO' named fields, it only creates a report with the last row of data.
I must be missing something. Any suggestions are greatly appreciated!!!If you want a wizard to create the form and report for you then yes you need to have a table. One thing that you can do is define a view that contains the data you need and define an Instead Of trigger on that view so the automatic fetch and dml will work but you can have the data stored into the different objects. basically the view and the trigger work as a router/dispatcher for the data.
*edit*
I should also add that you can write a pl/sql package which does the fetch and the dml operations with the form items as input. This is the solution I would typically use for any form that was not a simple CRUD form for a table. One thing to note is for the fetch I prefer to use out parameters for the form items so it requires the developer to map the item to the param in the app so it will show up when you are searching through the app. I highly discourage hiding item references inside of packaged code.
Good Luck!
Tyson
Message was edited by: TysonJouglet
Maybe you are looking for
-
Weblogic 11g JPS-04028 error - Application with name "abc" does not exist
Hi, We are migration one our app from OC4J to weblogic 11g server. This app is running fine in OC4J but getting the below exception in 11g. Pls help us in resolving this in identifying and resolving the same. I found info here, but wasn't help full t
-
ITunes Upgrade Will Not Download On My PC
The problem is that I can't download itunes 7.2 on my WIN XP PC. I can not purchase anything from the music store until I download that. It won't let me. It thanks me for downloading, but then when I go to the music store to purchase music it tells m
-
HTML report bugs to report?
I did experience two problem with the HTML report in LV6, LV8.0, LV8.5 and LV8.6. 1: When images are placed in the report these are generated in the temp folder. When the report is disposed, these files are not deleted. This will cause the temp fold
-
Forms are not geeting compiled in R12
Hi All, Forms are not getting compiled... as we are getting the the below error FRM-91500: Unable to start/complete the build... Please advise... Regards, Kumar
-
How to create a time control for while loop?
Hello all, I would like to control my while loop's execution time. In other words I want to stop while loop's execution after time (in ms) which is set by user. For example user sets 5 seconds to front panel control and a while loop runs and stops af