How to replace a table name with an item value in report region SQL query?
I've got a SQL query in a report region that goes like this:
SELECT :P30_HIDDEN FROM v_dms_dataset
GROUP BY :P30_HIDDEN
P30_HIDDEN is populated from a textfield input. Why doesn't this work, and is there a way to achieve what I'm trying to do here? I really need the ability to dynamically generate SQL queries in this way.
Ben - you could either:
1. case when :P30_HIDDEN = 'COL1' then col1 else ... end
in order to determine which column to select (only really useful if you have a small number of predetermined columns to select from), or
2. generate the SQL dynamically.
Set the report region to SQL Query (PL/SQL function body returning SQL query), then have something like:
declare
l_sql VARCHAR2(4000);
begin
l_sql := 'SELECT ' || :P30_HIDDEN || ' FROM v_dms_dataset
GROUP BY ' || :P30_HIDDEN;
return l_sql;
exception
etc.
end;
John.
Similar Messages
-
How to update the table when change list item in classic report
hi ,
i worked with apex 4.2 and i create normal classic report with one select list(named loved)Column ,now i want to update table when user change the list with new value ,i can't create dynamic action to do this,i create check box with primary key and loop for check item to update the table but i can't get the value of list item. and for more speed the user want to do this when change the list value.
my question
1- how to do this by javascript and get the value from list item and update the table with new value
2- is i must use API to create list item so i can get the value of item in report or what.
Thanks
AhmedI coded the following to give you direction:
1. In the "Element Attributes" section of the DEPTNO column, I call a javascript function as:
onchange = "javascript:updateTable(this);"2. I wrote a simple javascript function that shows an alert when the user changes the select list as:
<script language="JavaScript" type="text/javascript">
function updateTable(pThis)
var vRow = pThis.id.substr(pThis.id.indexOf('_')+1);
alert('Row# - '+ vRow + ' has the value - ' + pThis.value);
</script>Now, you can call a AJAX on-demand process inside the javascript function to update the database value. -
Apex 4.2 Report region sql query with "apex_item.text" renders wrongly
In APEX 4.2 page i have created region "Report data".
Type="SQl Query".
"User Interface"-->"Template"="Reports Region".
"Region Source"="select apex_item.text(1, '111') as c1 from dual".
Actually the select query is little bit more complex, but generally simplified it is such, that it uses function "select apex_item.text" to construct HTML textfield.
If i run in Sql Developer query
select apex_item.text(1, '111') as c1 from dual;Then result is:
<input type="text" name="f01" size="20" maxlength="2000" value="111" />But in APEX 4.2 the report is rendered so:
<td headers="c1">< ;input type=" ;text" ; name="f01" size="20" maxlength="2000" value="111" /> ;</td>(for this forum to display correctly i had to put extra spaces between" >" and ";" and so on)
And APEX 4.2 shows ugly html inside report cell/slot for me, displaying characters/symbols ">". The reason is that APEX HTML page source does not have symbol ">" but has " > ;" .
In APEX 3 i have similar query working well, without such anomaly.
What attribute should i change in APEX 4.2 region to display my query result as needed?
I need that function "apex_item.text", i cannot remove it.
Edited by: CharlesRoos on 13.02.2013 15:28
Edited by: CharlesRoos on 13.02.2013 15:29
Edited by: CharlesRoos on 13.02.2013 15:29CharlesRoos wrote:
In APEX 4.2 page i have created region "Report data".
Type="SQl Query".
"User Interface"-->"Template"="Reports Region".
"Region Source"="select apex_item.text(1, '111') as c1 from dual".
Actually the select query is little bit more complex, but generally simplified it is such, that it uses function "select apex_item.text" to construct HTML textfield.
If i run in Sql Developer query
select apex_item.text(1, '111') as c1 from dual;Then result is:
<input type="text" name="f01" size="20" maxlength="2000" value="111" />But in APEX 4.2 the report is rendered so:
<td headers="c1">< ;input type=" ;text" ; name="f01" size="20" maxlength="2000" value="111" /> ;</td>(for this forum to display correctly i had to put extra spaces between" >" and ";" and so on)
And APEX 4.2 shows ugly html inside report cell/slot for me, displaying characters/symbols ">". The reason is that APEX HTML page source does not have symbol ">" but has " > ;" .
In APEX 3 i have similar query working well, without such anomaly.
What attribute should i change in APEX 4.2 region to display my query result as needed?Ensure that the Display As Column Attribute for the C1 column is Standard Report Column. -
How to replace a "notfound" output with a null value?
hi,
I'm just getting a output of "Rows Notfound" for a script..
instead of this , i just need to show the output with a record as null value or some value..
do we have any option to use this in oracle..Apart from capturing with an exception in PL/SQL code, if you're wanting something in a script as pure SQL, you'd have to generate an additional row and only select that where no data is found e.g...
SQL> ed
Wrote file afiedt.buf
1 select ename from emp where ename = 'FRED'
2 union all
3* select 'No Data' from dual where not exists (select * from emp where ename = 'FRED')
SQL> /
ENAME
No Data
SQL>Of course this does effectively double-up on the queries being executed, so if you're dealing with a heavily complex query, it may be best just just have the regular exception come out, but then this will also depend on your actual requirements and why you want to do this in the first place. -
How to find the column name and table name with a value
Hi All
How to find the column name and table name with "Value".
For Example i have value named "Srikkanth" This value will be stored in one table and in one column i we dont know the table how to find the table name and column name
Any help is highly appricatable
Thanks & Regards
Srikkanth.M2 solutions by Michaels (the latter is 11g upwards only)...
michaels> var val varchar2(5)
michaels> exec :val := 'as'
PL/SQL procedure successfully completed.
michaels> select distinct substr (:val, 1, 11) "Searchword",
substr (table_name, 1, 14) "Table",
substr (t.column_value.getstringval (), 1, 50) "Column/Value"
from cols,
table
(xmlsequence
(dbms_xmlgen.getxmltype ('select ' || column_name
|| ' from ' || table_name
|| ' where upper('
|| column_name
|| ') like upper(''%' || :val
|| '%'')'
).extract ('ROWSET/ROW/*')
) t
-- where table_name in ('EMPLOYEES', 'JOB_HISTORY', 'DEPARTMENTS')
order by "Table"or
SQL> select table_name,
column_name,
:search_string search_string,
result
from cols,
xmltable(('ora:view("'||table_name||'")/ROW/'||column_name||'[ora:contains(text(),"%'|| :search_string || '%") > 0]')
columns result varchar2(10) path '.'
where table_name in ('EMP', 'DEPT')
TABLE_NAME COLUMN_NAME SEARCH_STRING RESULT
DEPT DNAME ES RESEARCH
DEPT DNAME ES SALES
EMP ENAME ES JONES
EMP ENAME ES JAMES
EMP JOB ES SALESMAN
EMP JOB ES SALESMAN
EMP JOB ES SALESMAN
EMP JOB ES PRESIDENT
EMP JOB ES SALESMAN
9 rows selected. -
How to get the column name and table name with value
Hi All
I have one difficult requirement
I have some column values and they have given some alias column names but i need to find the correct column name and table name from the database.
For example value is "SRI" and i dont know the table and exact column name so is there any possibilities to find the column name and table name for the given value
Thanks & Regards
Srikkanth.MSearching all the database for a word...
Courtesy of michaels...
michaels> var val varchar2(5)
michaels> exec :val := 'as'
PL/SQL procedure successfully completed.
michaels> select distinct substr (:val, 1, 11) "Searchword",
substr (table_name, 1, 14) "Table",
substr (t.column_value.getstringval (), 1, 50) "Column/Value"
from cols,
table
(xmlsequence
(dbms_xmlgen.getxmltype ('select ' || column_name
|| ' from ' || table_name
|| ' where upper('
|| column_name
|| ') like upper(''%' || :val
|| '%'')'
).extract ('ROWSET/ROW/*')
) t
-- where table_name in ('EMPLOYEES', 'JOB_HISTORY', 'DEPARTMENTS')
order by "Table"or
11g upwards
SQL> select table_name,
column_name,
:search_string search_string,
result
from (select column_name,
table_name,
'ora:view("' || table_name || '")/ROW/' || column_name || '[ora:contains(text(),"%' || :search_string || '%") > 0]' str
from cols
where table_name in ('EMP', 'DEPT')),
xmltable (str columns result varchar2(10) path '.')
TABLE_NAME COLUMN_NAME SEARCH_STRING RESULT
DEPT DNAME es RESEARCH
EMP ENAME es JAMES
EMP JOB es SALESMAN
EMP JOB es SALESMAN
4 rows selected. -
How to replace # or Not assigned with blank in BEx Query Output.
Hi,
While running the query through BEx Query desginer or Anlayser, I am getting # or Not assigned where there are no values.
The requirement is to "Replace # or Not assigned with a blank" in the output.
I want to know, is there any setting in BEx query desginer where we can do this. How to do this.
Please share your inputs on this. Any inputs on this would be appreciated.
Thanks,
NaveenCheck out SDN-thread: "Re: Remove 'Not assigned'" for more details
Ideas from SDN research:
"a solution i have used is to put each RKF column in a CKF colum then in each CKF use RKF + 0, the outcome is that your # should now be 0s, in the query properties you can set the option to display 0s as blank."
"try to enter a text for the blank entry in the master data maintenance of the relevant objects and set the display option for the objects to 'text'."
Threads:
SDN: How to replace # or Not assigned with blank in BEx Query Output.
SDN: Re: Remove 'Not assigned
SDN: How to replace # or (Not assigned) with blank in BEx Query Output.
SDN: Bex Analyzer : Text element system's table ?
SDN: change message in web application designer ["nonavailable" -> 136 of SAPLRRSV]
SDN: Not Assigned ["Not Assigned -> 027 of SAPLRRSV]
SDN: replacing '#'-sign for 'not assigned' in queries
SDN: # in report when null in the cube
SDN: How to replace '#' with blank when there is no value for a date field
Edited by: Thomas Köpp on Sep 13, 2010 5:20 PM -
How to know the table name of an InfoCub if we know cube technical name?
How to know the table name of an ODS if we know the ODS technical name?
Thanks
Message was edited by: Kevin Smithhi kevin
if the ODS is a standard ODS then you check the following way in SE16
(for custom ODS objects)
/BIC/A<ODS technical name>00 (Active Data Table)
/BIC/A<ODS technical name>40 (Activation Queue)
/BIC/B<10 digit number> (Change Log Table)
(for SAP defined ODS Objects)
/BI0/A<ODS technical name>00 (Active Data Table)
/BI0/A<ODS technical name>40 (Activation Queue)
/BI0/B<10 digit number> (Change Log Table)
and for Transactional ODS Object you will have only the active data Table. So you need to check with /BIC/A<ODS technical name>00 for the custom ODS objects and /BI0/A<ODS technical name>00 for SAP defined ODS objects.
hope this helps.
regards
vijaykumar -
How to pass the table name dynamically in xml parsing
Hi All,
I have created one procedure for parsing xml file which is working perfectly.
FORALL i IN t_tab.first .. t_tab.last
INSERT INTO Test_AP VALUES t_tab(i);Now I want to put the table name dynamically+. For that I have added one query and modify above code as follow:-
I have already declare dml_str varchar2(800) in declaration part.
Query is as follows:-
select table_name into tab_name from VERSION_DETAILS where SUBVERSION_NO=abc; -- here abc is variable name which contains values.
FORALL i IN t_tab.first .. t_tab.last
dml_str := 'INSERT INTO ' || tab_name || ' values :vals';
EXECUTE IMMEDIATE dml_str USING t_tab(i);But it's not working. How I will resolve this or through which way I achieved the intended results. Anyone can guide me on this matter.
Thanks in advance for your help...Hi,
But it's not working.Don't you think it would help to give the error message?
Put the assignment before FORALL.
FORALL only accepts one subsequent DML statement (static or dynamic SQL) :
dml_str := 'INSERT INTO ' || tab_name || ' values :vals';
FORALL i IN t_tab.first .. t_tab.last
EXECUTE IMMEDIATE dml_str USING t_tab(i); -
Hi,
I need to know how get a source table name. I need to get a source table name and do some transformation. I am adding the step in IKM to do this and therefore need source table name in there.
<%=odiRef.getSrcTablesList("","[RES_NAME]","","")%> gives work table name (C$_0XXXXX) whereas actual source table name is expected.
Could someone please help?
Thanks.Hi,
May i add a point?
In IKM level, if u use this API it will always return u C$ table name only since for IKM C$ is the source. You need to capture and use this API in LKM level.
In LKM add a step in Command on target and technology as Jython and try the below code.
mySourceTable= '<%=odiRef.getSrcTablesList("", "[RES_NAME]", ", ", "")%>'
And later in IKM use this variable for ur transformation.
Thanks,
Guru -
Susbtitution Variables in rules file to replace a member name with another
Hi everybody,
Can I use substitution variables to replace a member name with another name in rules file?
Please let me know if we can use substitution vars.
Essbase version :11.1.2
Thanks,
K.asAre you the same guy?
http://www.network54.com/Forum/58296/thread/1287447433/Susbtitution+Variables+in+rules+file+to+replace+a+member+name+with+another+name
The answer is still, "No".
Regards,
Cameron Lackpour -
How can I link table KONV with table VBRP and VBRK using KSCHL field?
Hi experts,
How can I link table KONV with table VBRP/VBRK using KSCHL field so that items are fully filtered?
Thanks,Hi,
If you do not want to specify it as hard code, then define a variable for it if you want to pass the value for it from the selection screen so that it will be dynamic. Code will be as follows.
select-options: x_KSCHL for T685l-KSCHL.
select kwert
kbetr
knumv
kposn
kschl
from konv
into CORRESPONDING FIELDS OF TABLE it_konv
FOR ALL ENTRIES IN it_all
where knumv = it_all-knumv
and kposn = it_all-b_posnr
and kschl in x_KSCHL. "Dynamic Selection as per the selection screen input
endif.
Hope this helps.
Regards,
Chandravadan -
How to see the Table Names & Field Names by other than F1 help
Hi Experts
How to see the Table Names & Field Names by other than F1 help, & How to see the List of MM Table Names.
RgdsThe only option to see the active table/ field name is through F1 --> Technical Information. Apart from this, you can use any 3rd part application like GUIex (INbuilt in SAP ECC 6.0 ... can be activated by clicking on the tri-color button on the top right), but you need technical knowledge to understand the information. As far consolidated list of MM tables is concerned, SAP don;t provide you the same at one place, it experience and knowledge which help you in this regard. For your immediate reference MM tables are as under :
EBAN - Purchase Requisition
EBKN - Purchase Requisition Account Assignment
EBUB - Index for Stock Transport Requisitions for Materi
EINA - Purchasing Info Record: General Data
EINE - Purchasing Info Record: Purchasing Organization D
EIPA - Order Price History: Info Record
EKAB - Release Documentation
EKAN - Vendor Address: Purchasing Document
EKBE - History per Purchasing Document
EKBEH - Removed PO History Records
EKBZ - History per Purchasing Document: Delivery Costs
EKBZH - History per Purchasing Document: Delivery Costs
EKEH - Scheduling Agreement Release Documentation
EKEK - Header Data for Scheduling Agreement Releases
EKES - Vendor Confirmations
EKET - Scheduling Agreement Schedule Lines
EKETH - Scheduling Agreement Schedules: History Tables
EKKI - Purchasing Condition Index
EKKN - Account Assignment in Purchasing Document
EKKO - Purchasing Document Header
EKPA - Partner Roles in Purchasing
EKPB - "Material Provided" Item in Purchasing Document
EKPO - Purchasing Document Item
EKPV - Shipping-Specific Data on Stock Tfr. for Purch. D
EKRS - ERS Procedure: Goods (Merchandise) Movements to b
EKUB - Index for Stock Transport Orders for Material
EORD - Purchasing Source List
EQUK - Quota File: Header -
How to reject external table rows with some blank columns
How to reject external table rows with some blank columns
I have an external table and I would like to reject rows when a number of fields are empty. Here are the details.
CREATE TABLE EXTTAB (
ID NUMBER(10),
TSTAMP DATE,
C1 NUMBER(5,0),
C2 DATE,
C3 FLOAT(126)
ORGANIZATION EXTERNAL (
TYPE ORACLE_LOADER
DEFAULT DIRECTORY EXT_DAT_DIR
ACCESS PARAMETERS (
RECORDS DELIMITED BY NEWLINE
LOAD WHEN (NOT (c1 = BLANKS AND c2 = BLANKS AND c3 = BLANKS))
LOGFILE EXT_LOG_DIR:'exttab.log'
BADFILE EXT_BAD_DIR:'exttab.bad'
DISCARDFILE EXT_BAD_DIR:'exttab.dsc'
FIELDS TERMINATED BY "|"
LRTRIM
MISSING FIELD VALUES ARE NULL
REJECT ROWS WITH ALL NULL
FIELDS (
ID,
TSTAMP DATE 'YYYYMMDDHH24MISS',
C1,
C2 DATE 'YYYYMMDDHH24MISS',
C3
) LOCATION ('dummy.dat')
REJECT LIMIT UNLIMITED
So, as you can see from the LOAD WHEN clause, I'd like to reject rows when C1, C2 and C3 are empty.
The above statement works fine and creates the table. However when I am trying to load data using it, the following error is produced:
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-00554: error encountered while parsing access parameters
KUP-01005: syntax error: found "not": expecting one of: "double-quoted-string, identifier, (, number, single-quoted-string"
KUP-01007: at line 1 column 41
ORA-06512: at "SYS.ORACLE_LOADER", line 14
ORA-06512: at line 1
It seems that external tables driver does not understand the "NOT (...)" condition. Could anyone suggest how I can achieve what I want in a different way?
Thank you.
DenisAnother method would be to simply remove the "LOAD WHEN condition" and create a view on the external table which filters the data.
CREATE EXTTAB_VIEW AS
SELECT * FROM EXTTAB
WHERE not (c1 is null and c2 is null and c3 is null); -
How to pass dynamically table name in my cursor declaration
Hi:
I am new. could you please let me know how to pass a table name dynamically in my cursor declaration? for instance I am declaring the following cursor in my pl/sql procedure:
CURSOR crs_validate IS
select * FROM <ACT_JUN_2006_LOB>;
this ACT_JUN_2006_LOB table name, I should able to pass it when I open the cursor ... any help appreciated. thanks.
sriniThanks all for the response. REFCURSOR does work: here is an example ... which I found on-line
procedure emp_test(
month varchar2,
year varchar2)
is
type cur_typ is ref cursor;
c cur_typ;
query_str varchar2(200);
emp_number number := 7900;
salary number;
name varchar2(30);
Begin
query_str := 'Select empno, ename, sal from emp_' || month ||'_'||year
|| ' where empno = :id';
open c for query_str using emp_number;
loop
fetch c into emp_number, name, salary;
exit when c%notfound;
dbms_output.put_line(emp_number);
end loop;
close c;
end;
Maybe you are looking for
-
How can I connect my MBP to other devices?
Hello, I have a Yamaha DVD Receiver ("Natural Sound", RDX-E700) and would like to connect it to my MBP so I can hear the my music from iTunes through the loudspeakers connected to the DVD Receiver. Every time I try it doesn't work, even if I switch t
-
Having logic board and inverter replaced - will post results.
My MBP is afflicted with the CPU whine and the LCD whine, not to mention the "Moo". I solved the Airport not connecting automatically issue on my own. Talked to Apple about the whines, they wanted me to take it to the local guys, which I was happy to
-
Hi all, I want to send a gif image with the document.Can anyone help me in this.Uding GUI_upload i get the gif image in the binary form .Now i want this to be attached with my document. the code for my program is FORM send_file_as_email_attachm
-
Unable to find jvm.dll problem
Hi, The problem is how to let windows know the jvm.dll is located at c:\jdk1.3\jre\bin\classic. When I execute invoke.exe, it will say unable to create JVM, bcoz jvm.dll not found. If I copy the invoke.exe in c:\jdk1.3\jre\bin\classic, it is working
-
Can't Read Configuration...
I have an Airport Extreme.. (not the new GBit one), and can't get to the point of being able to read the configuration. I've reset it by holding the reset button in for 5 seconds, and when attached to my cable modem, I can access both the Base Statio