Parameter as column name
Hi all,
I want to pass a parameter value as a column name in my where clause, like this:
where table.(:parameter1)=:parameter2can this be done??
Thanks,
Magnus
Hi,
No, not this way. A bind variable can only be used with values, not identifier.
You'll have to use dynamic SQL to build and execute your query.
For example :
DECLARE
col_name VARCHAR2(30) := :parameter1;
sqlstr VARCHAR2(100) := 'SELECT col1 FROM sample_table WHERE '|| col_name ||' = :1';
val sample_table.col1%type;
BEGIN
execute immediate sqlstr into val using :parameter2;
END;Edited by: odie_63 on 5 mai 2010 12:09 - added example
Similar Messages
-
Function with for loop and parameter table/column names ... syntax help
I'm trying to create a function that returns the distinct values and counts from a user defined schema/table/column.
The code below defines an object type [stats_on_column_obj] and creates a single table of this type [stats_on_column_tab].
The function is supposed to take three input variables: p_schema_name, p_table_name, p_column_name and return a table (above).
I can hard code a SELECT statement into the () ... but once I try to convert it to parameters & exec immediate I am stuck. The red section is where the issue is (i think).
Oracle 10g.
CREATE TYPE stats_on_column_obj IS OBJECT(
COL_VAL VARCHAR2(500),
COL_VAL_CNT NUMBER (7)
CREATE TYPE stats_on_column_tab IS TABLE OF stats_on_column_obj;
CREATE OR REPLACE FUNCTION get_STATS_ON_COLUMN
p_schema_name IN varchar2,
p_table_name IN varchar2,
p_column_name IN varchar2
RETURN STATS_ON_COLUMN_tab
IS
l_STATS_ON_COLUMN_tab STATS_ON_COLUMN_tab := STATS_ON_COLUMN_tab ();
n INTEGER := 0;
str_select_tbl varchar2(5000);
BEGIN
str_select_tbl := 'SELECT '||p_column_name||' as col_val, count(*) as col_val_cnt FROM '||p_schema_name||'.'||p_table_name||' group by '||p_column_name;
FOR r IN (str_select_tbl)
LOOP
l_STATS_ON_COLUMN_tab.EXTEND;
n := n + 1;
l_STATS_ON_COLUMN_tab (n) := STATS_ON_COLUMN_obj (r.col_val, r.col_val_cnt);
END LOOP ;
RETURN l_STATS_ON_COLUMN_tab;
END;
[Error] PLS-00103 (124: 4): PLS-00103: Encountered the symbol "LOOP" when expecting one of the following: * & - + / at mod remainder rem .. <an exponent (**)> || multiset year DAY_
[Error] PLS-00103 (126: 9): PLS-00103: Encountered the symbol "=" when expecting one of the following: constant exception <an identifier> <a double-quoted delimited-identifier> table LONG_ double ref char time timestam
[Error] PLS-00103 (127: 29): PLS-00103: Encountered the symbol "(" when expecting one of the following: constant exception <an identifier> <a double-quoted delimited-identifier> table LONG_ double ref char time timestam
[Error] PLS-00103 (128: 4): PLS-00103: Encountered the symbol "END" when expecting one of the following: begin function package pragma procedure subtype type use <an identifier> <a double-quoted delimited-identifier> form
SELECT * FROM TABLE (get_STATS_ON_COLUMN('SCHEMAS_X','TABLE_X','COLUMN_X'));SCOTT@orcl > CREATE OR REPLACE
2 FUNCTION get_STATS_ON_COLUMN(
3 p_schema_name IN varchar2,
4 p_table_name IN varchar2,
5 p_column_name IN varchar2
6 )
7 RETURN STATS_ON_COLUMN_tab
8 IS
9 v_STATS_ON_COLUMN_tab STATS_ON_COLUMN_tab := STATS_ON_COLUMN_tab ();
10 v_n INTEGER := 0;
11 v_str_select_tbl VARCHAR2(5000);
12 BEGIN
13 v_str_select_tbl := 'SELECT stats_on_column_obj(' || p_column_name || ',count(*)) FROM ' ||
14 p_schema_name || '.' || p_table_name || ' group by ' || p_column_name;
15 EXECUTE IMMEDIATE v_str_select_tbl
16 BULK COLLECT
17 INTO v_STATS_ON_COLUMN_tab;
18 RETURN v_STATS_ON_COLUMN_tab;
19 END;
20 /
Function created.
SCOTT@orcl > select *
2 from table(
3 get_STATS_ON_COLUMN(
4 'SCOTT',
5 'EMP',
6 'JOB'
7 )
8 )
9 /
COL_VAL COL_VAL_CNT
CLERK 4
SALESMAN 4
PRESIDENT 1
MANAGER 3
ANALYST 2
SCOTT@orcl >
Or better change it to pipelined function.
SY. -
Can we use Column Names in Parameter Cursor
Hi
can we use Column Names in Parameter Cursor??
DECLARE
CURSOR Emp_Cur (P_Deptno NUMBER)
IS
SELECT Empno, Ename
FROM Emp
WHERE Deptno = P_Deptno;
BEGIN
FOR Emp IN Emp_Cur(10)
LOOP
DBMS_OUTPUT.PUT_LINE('The Employee Number is: '||emp.Empno);
DBMS_OUTPUT.PUT_LINE('The Employee Name is: '||emp.Ename);
END LOOP;
FOR Emp IN Emp_Cur(20)
LOOP
DBMS_OUTPUT.PUT_LINE('The Employee Number is: '||emp.Empno);
DBMS_OUTPUT.PUT_LINE('The Employee Name is: '||emp.Ename);
END LOOP;
END;
In the above Program, I send Deptnumber. If i send Column names like Empno, Ename. What can i do??
If Declare Samething Through Parameter Cursor, it doesn't accept VARCHAR2(Size)For parameters you don't use size, just the type (DATE, NUMBER, VARCHAR2, CLOB, ...)
DECLARE
CURSOR Emp_Cur (P_Ename VARCHAR2)
IS
SELECT Empno, Ename
FROM Emp
WHERE Ename = P_Ename;
BEGIN
FOR Emp IN Emp_Cur('SCOTT')
LOOP
DBMS_OUTPUT.PUT_LINE('The Employee Number is: '||emp.Empno);
DBMS_OUTPUT.PUT_LINE('The Employee Name is: '||emp.Ename);
END LOOP;
END; -
Automatic Report Bursting based on column names given by user as parameter.
Hi,
Could some help me achieve the following functionality. The requirement are:
1. create a report that has parameters that are column names (display values e.g: department, location, employee job code)
2. the end user will select one or more columns from the multi-select parameter
3. we want that there should be a button on clicking that the user should get automatic file bursting. He should not be required to go to schedules tab and create a new job for that.
4. the report should burst to a file location depending on the columns selected by the user, e.g. if user selected department and location then we should have files saved in the set file location as sales-india.pdf, sales-us.pdf, hr-india.pdf, hr-us.pdf and so on.
I am new to BI Publisher.
Could you help me in creating such a parameter, what should be report sql for capturing the data from parameter and then doing report bursting automatically based on two or more parameter values given by the user.
There is no need to show the report to the user in BI Publisher as there are thousands of rows in a table. Three tables join to give the employee data.
-PriyankaThanks for a quick response but I am still not clear on
1. how to do this using custom java code
and
2. actually user would login to interactive dashboard and there he will give these parameters using which we need to automatically burst a BI publisher report. Can this be done some how?
-Priyanka -
Pass column-name as a parameter to reports
Hello,
the code below calls a report. But now I want to sort the rows in the report. For example I have a text-item in my form-modul. If I type a column-name and press the button then the rows should be sorted in the report. Is it possible tp pass column-names as parameter to reports?
DECLARE
repid REPORT_OBJECT;
v_rep VARCHAR2(100);
rep_status VARCHAR2(20);
BEGIN
repid := find_report_object('STATIONSTOPOLOGIE');
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_EXECUTION_MODE,RUNTIME);
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_COMM_MODE,SYNCHRONOUS);
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESTYPE,CACHE);
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESFORMAT,'html');
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_SERVER,'rep_oracle-dev');
-- SET_REPORT_OBJECT_PROPERTY(repid,REPORT_OTHER,'paramform=no pdeptno='||:dept.deptno);
v_rep := RUN_REPORT_OBJECT(repid);
rep_status := REPORT_OBJECT_STATUS(v_rep);
WHILE rep_status in ('RUNNING','OPENING_REPORT','ENQUEUED')
LOOP
rep_status := report_object_status(v_rep);
END LOOP;
IF rep_status = 'FINISHED' THEN
WEB.SHOW_DOCUMENT('http://oracle-dev:8888/reports/rwservlet/getjobid'||
substr(v_rep,instr(v_rep,'_',-1)+1)||'?'||'server=rep_oracle-dev','_blank');
ELSE
message('Error when running report');
END IF;
END;Hi,
the work has been done in reports. You can use a lexical parameter in reports to add a condition for sorting to the query like:
select .. from .. where ... &p_order.
Then add another parameter to the report (for example p_param). Fill p_param via your interface in forms (SET_REPORT_OBJECT_PROPERTY(repid,REPORT_OTHER, ....) with the column name. Then build a report trigger like:
if :p_param is null
then
:p_order:= null;
else
:p_order:= 'order by '||:p_param;
end if;
But have a look, that p_param can only get correct values.
Rainer -
Re: Column Name as Parameter in Oracle Procedure
Hi,
I've successfully compiled the following procedure:
CREATE OR REPLACE PROCEDURE CREATE_MEASURES_IND_RPT(
pSTART_DT IN date
, pEND_DT IN date
, PGEO_DIMENSION_COLUMN IN VARCHAR2
AUTHID CURRENT_USER IS
BEGIN
DECLARE
START_DT Date := pSTART_DT;
END_DT Date := pEND_DT;
text_ip_adjusted varchar2(10000):='
select
replace(fiscal_yr,''/'') as fiscal_year,
NVL(f_quarter(is_date(disdate,''yyyymmdd'')),''Year'') AS TIME_PERIOD_TYPE,
NVL('||PGEO_DIMENSION_COLUMN||',''Province'') as geo_desc
from data_table A,
postal_code_table B
where POSTCODE = B.POSTALCODE
AND (is_date(disdate,''yyyymmdd'') >= :1 and is_date(disdate,''yyyymmdd'') < :2)
GROUP BY
replace(fiscal_yr,''/''),
ROLLUP(f_quarter(is_date(disdate,''yyyymmdd''))),
ROLLUP('||PGEO_DIMENSION_COLUMN||');
begin
EXECUTE IMMEDIATE text_ip_adjusted using START_DT,END_DT; COMMIT;
END;
END CREATE_MEASURES_IND_RPT;
/When I try and execute the procedure, I get the following error:
ORA-00936: missing expression
ORA-06512: at "CREATE_MEASURES_IND_RPT", line 36
ORA-06512: at line 1The data table has date strings which need to be converted to dates using an "IS_DATE" function I've created which is while you'll see the is_date function used. The procedure works fine when I don't include the PGEO_DIMENSION_COLUMN as a parameter so I suspect that I haven't reference the name of the column properly. Essentially, I need my procedure to be able to specify a Column Name in the Postal Code table to use as a group by field.
Any help would be appreciated.
Thanks,
EdHi,
spalato76 wrote:
Hi,
I've successfully compiled the following procedure:
CREATE OR REPLACE PROCEDURE CREATE_MEASURES_IND_RPT(
pSTART_DT IN date
, pEND_DT IN date
, PGEO_DIMENSION_COLUMN IN VARCHAR2
AUTHID CURRENT_USER IS
BEGIN
DECLARE
START_DT Date := pSTART_DT;
END_DT Date := pEND_DT;
text_ip_adjusted varchar2(10000):='
select
replace(fiscal_yr,''/'') as fiscal_year,
NVL(f_quarter(is_date(disdate,''yyyymmdd'')),''Year'') AS TIME_PERIOD_TYPE,
NVL('||PGEO_DIMENSION_COLUMN||',''Province'') as geo_desc
from data_table A,
postal_code_table B
where POSTCODE = B.POSTALCODE
AND (is_date(disdate,''yyyymmdd'') >= :1 and is_date(disdate,''yyyymmdd'') < :2)
GROUP BY
replace(fiscal_yr,''/''),
ROLLUP(f_quarter(is_date(disdate,''yyyymmdd''))),
ROLLUP('||PGEO_DIMENSION_COLUMN||');
begin
EXECUTE IMMEDIATE text_ip_adjusted using START_DT,END_DT; COMMIT;
END;
END CREATE_MEASURES_IND_RPT;
/When I try and execute the procedure, I get the following error:
ORA-00936: missing expression
ORA-06512: at "CREATE_MEASURES_IND_RPT", line 36
ORA-06512: at line 1The data table has date strings which need to be converted to dates using an "IS_DATE" function I've created which is while you'll see the is_date function used. The procedure works fine when I don't include the PGEO_DIMENSION_COLUMN as a parameter so I suspect that I haven't reference the name of the column properly. Essentially, I need my procedure to be able to specify a Column Name in the Postal Code table to use as a group by field.
Any help would be appreciated.
Thanks,
EdIt l;ooks like you're missing a single-quote at the very end of the expression being assigned to text_ip_adjusted.
... ROLLUP(' || PGEO_DIMENSION_COLUMN || ')';How will you handle the output from that dynamic query? Maybe you should be opening a cursor. -
Column name as item in lov - parameter passing
Hello Eveyone,
Currently i am working on a requirement where the user will choose any one of the column of the database as parameter. Means all the column names should come in LOV. Once he selects the column he has to choose the operator(>,<,=,<>) in another LOV after that user enters value. Can anyone please guide me on this. Please let me know is it possible in crystal?
Thanks
YashIt would be incredibly complex as you would have to hard code a massive if then else select formula based on the two parameters selected. You could do something with adhoc reporting in Crystal Enterprise or BOXI. But do do this with a single Crystal report would be very difficult.
You should be asking
"Why on earth does anyone want such flexibility?"
Sounds like user does not know what they want and is making an impossible request.
Ian -
Passing a column name as a parameter
Good afternoon,
I was wondering if any of you ever encountered the following situation and found a method to get around it...
I recently created a pivot table using the SQL Query (PL/SQL function body returning SQL query) option.
The table consisted of the following information:
- Date range, Object Type and count.
The final table looks something like this (pardon the lack of fancy markup, hopefully it will get the point across):
Date Object A Object B Object D Object G
01-apr-09 10 16 50 43
02-apr-09 1 15 77 35
03-apr-09 19 0 14 17
04-apr-09 15 7 70 20
05-apr-09 7 6 65 50And it goes on like that.
I had to create the code dynamically because I don't know what Objects I will get in any given date range (for example: I could have something for Object C and nothing for Object D in the month of March). I had a cursor loop through the object types before creating the SQL query that builds the table above.
The table is now working fine. What I'm trying to do now is do a little bit of drilling down in data.
Since everything is dynamically built, I can't give actual column names in my report. Is there any way that, when I click on, for example, the "10" on April 1st in Object A that the column header "Object A" gets passed? #COL02# only passes the value "10" which isn't what I want, and I tried the other variations such as :COL02 and &COL02. without much luck.
If you could shed some light on this problem, that would be greatly appreciated!
Thank you for your time.
IvanHi,
You can achieve passing column name as parameter with the help of jquery.
Below is the sample code
<script src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("jquery", "1.2.6");
</script>
<script type="text/javascript">
//<![CDATA[
$(document).ready( function() {
$('.t20data').each( function(i) {
$td =$(this);
colHeader = $(this).attr("headers");
$td.html('<a href="f?p=' + &APP_ID. + ':3' + ':' + &APP_SESSION. + '::NO:3:P3_COLUMN_HEADER,P3_COLUMN_VALUE:' + colHeader +',' +$td.text()+ '">' + $td.html() + '</a>');
}); //]]>
</script>Note - U need to change t20data , :p3_column_header , :p3_column_value to match you application.
No need to add link individually by going into column attributes
[E X A M P L E |http://apex.oracle.com/pls/otn/f?p=62171:2]
Regards,
Shijesh -
What is the key column name and value column name in JDBC Adapter parameter
Hi
Can any one please tell me what is the Key Column Name and Key Column Value in JDBC adatper parameters. If i dont mention those parameters i am getting the following error
<b> Value missing for mandatory configuration attribute tableEOColumnNameId</b>
Please help me
Best Regards
Ravi Shankar BHi
I am doing DataBase Lookup in XI
First i have created a Table in Database( CheckUser) which has two fields UserName and PhoneNumber and then i have created
I have created one Communication Channel For Reciever Adapter .
I have given the parameters like this
JDBC Driver : com.microsoft.jdbc.sqlserver.SQLServerDriver
Connection : jdbc:microsoft:sqlserver://10.7.1.43:1433;DatabaseName=Ravi;
UserName.... sa
password.... sa
persistence : Database
Database Table Name : CheckUser
Key column name and Value column name i left blank and activated
and then
I have created
Data Types : Source ...... UserName
Destination.... PhoneNumber
Message Types
Message Interfaces
In Message Mapping
I have created one User Defined function DBProcessing_SpecialAPI().This method will get the data from the database....
In this function i have written the following code
//write your code here
String query = " ";
Channel channel = null;
DataBaseAccessor accessor = null;
DataBaseResult resultSet = null;
query = "select Password from CheckUser where UserName = ' " +UserName[0]+ " ' ";
try {
channel = LookupService.getChannel("Ravi","CC_JDBC");
accessor = LookupService.getDataBaseAccessor(channel);
resultSet = accessor.execute(query);
for(Iterator rows = resultSet.getRows();rows.hasNext();){
Map rowMap = (Map)rows.next();
result.addValue((String)rowMap.get("Password"));
catch(Exception e){
result.addValue(e.getMessage());
finally{
try{
if(accessor != null)
accessor.close();
}catch(Exception e){
result.addValue(e.getMessage());
And the i have mapped like this
UserName -
> DBProcessing_SpecialAPI----
>PhoneNumber
when i am testing this mapping i am getting the following error
<?xml version="1.0" encoding="UTF-8"?>
<ns0:Dest_JDBC_MT xmlns:ns0="http://filetofilescenario.com/ilg"><phoneNumber>Plain exception:Problem when calling an adapter by using communication channel CC_JDBC (Party: , Service: Ravi, Object ID: c360bc139a403293afbc49d5c46e4478) Check whether the communication channel exists in the Integration Directory; also check the cache notifications for the instance Integration Server (central Adapter-Engine) Channel object with Id Channel:c360bc139a403293afbc49d5c46e4478 not available in CPA Cache.
com.sap.aii.mapping.lookup.LookupException: Problem when calling an adapter by using communication channel CC_JDBC (Party: , Service: Ravi, Object ID: c360bc139a403293afbc49d5c46e4478) Check whether the communication channel exists in the Integration Directory; also check the cache notifications for the instance Integration Server (central Adapter-Engine) Channel object with Id Channel:c360bc139a403293afbc49d5c46e4478 not available in CPA Cache.
at com.sap.aii.ibrun.server.lookup.AdapterProxyLocal.<init>(AdapterProxyLocal.java:61)
at com.sap.aii.ibrun.server.lookup.SystemAccessorInternal.getProxy(SystemAccessorInternal.java:98)
at com.sap.aii.ibrun.server.lookup.SystemAccessorInternal.<init>(SystemAccessorInternal.java:38)
at com.sap.aii.ibrun.server.lookup.SystemAccessorHmiServer.getConnection(SystemAccessorHmiServer.java:270)
at com.sap.aii.ibrun.server.lookup.SystemAccessorHmiServer.process(SystemAccessorHmiServer.java:70)
at com.sap.aii.utilxi.hmis.server.HmisServiceImpl.invokeMethod(HmisServiceImpl.java:169)
at com.sap.aii.utilxi.hmis.server.HmisServer.process(HmisServer.java:178)
at com.sap.aii.utilxi.hmis.web.HmisServletImpl.processRequestByHmiServer(HmisServletImpl.java:296)
at com.sap.aii.utilxi.hmis.web.HmisServletImpl.processRequestByHmiServer(HmisServletImpl.java:211)
at com.sap.aii.utilxi.hmis.web.workers.HmisInternalClient.doWork(HmisInternalClient.java:70)
at com.sap.aii.utilxi.hmis.web.HmisServletImpl.doWork(HmisServletImpl.java:496)
at com.sap.aii.utilxi.hmis.web.HmisServletImpl.doPost(HmisServletImpl.java:634)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
</phoneNumber></ns0:Dest_JDBC_MT>
In RWB i have checked the status of JDBC driver its showing the following error
<b>Value missing for mandatory configuration attribute tableEOColumnNameId</b>
Best Regards
Ravi Shankar B
Message was edited by:
RaviShankar B -
Using a parameter value as a column name
Hi,
I have created an command like this:
update table1 set [Param.1] = '[Param.2]' where id = [Param.3]
where:
Param.1 = COL1
Param.2 = Hello
Param.3 = 1 (the primary key I want to change).
When I run this SQL Action I get the following error message:
java.sql.SQLException: ORA-01747: invalid user.table.column, table.column, or column specification
I have double checked the values of my parameters and they are all correct. There is a column named COL1, and its type is varchar2, and there is PK = 1.
So, my question is: Is it a limitation of xMII (we can not take column names from parameters) or there is a mistake here?
Thank you in advance,
Nuno CunhaHi Nuno,
I see you are trying to perform Dynamic SQL execution in Oracle.
In order to execute a Dynamic SQL you need to use the following syntax
EXECUTE IMMEDIATE 'Sql Statement with any runtime params like cloumns, even table names too';
And I guess you can use an Dynamic Sql only within a PL/SQL block.
Please refer to the below link for more details
[Dynamic SQL|http://download.oracle.com/docs/cd/B10500_01/appdev.920/a96590/adg09dyn.htm]
Hope this helps!!
Regards,
Adarsh -
Calculation Field to be mapped to different data object's column name in Oracle BAM 12c
Hi,
I am having a challenge to enable drill down to 2nd level report by passing calculation field as parameter.
As an alternative, I am thinking to point calculation field to another data object’s column name and generate report so that I would be able to pass that as parameter to drilling report view.
Is there any way to map calculation field to different Data object’s column name? Thanks in advance.
Regards
Amik Basu1. Yes, you can.
SQL> create table ÜÝÞ( ßàá number(10));
Table created.
SQL> insert into ÜÝÞ values (10);
1 row created.1.1 and 1.2 and 2. You can choose UTF as your default character set. It allows the user of non-English characters in VARCHAR columns in your whole database. It is not per tablespace.
SQL> create table ÜÝÞ( ßàá varchar2(100));
Table created.
SQL> insert into ÜÝÞ values ('âãäçìé');
1 row created. -
How to get the table name and bind columns names in an INSERT statement ?
I have an INSERT statement with input parameters (for example
INSERT INTO my_table VALUES (:a, :a, :a)) and I want to know
without parsing the statement which is the name of table to
insert to and the corresponding columns.
This is needed to generate the SELECT FOR UPDATE statement to
refetch a BLOB before actually writing to it. The code does not
know in advance the schema (generic code).
Thanks in advance,
Joseph CanedoOnce you have prepared your statement, you can execute the
statement with the OCI_DESCRIBE_ONLY mode before binding any
columns. Then you can use OCIParamGet to find out about each
column (column index is 1-based). You should get OCI_NO_DATA or
ORA-24334 if there are no more columns in the statement. Note
that the parameter descriptor from OCIParamGet is
allocated/freed internally by OCI; you do not need to manage it
explicitly. The parameter descriptor is passed to OCIAttrGet in
order to obtain for instance the maximum size of data in the
column OCI_ATTR_DATA_SIZE. You can also get the column name in
this way, although I do not remember the #define off the top of
my head. Getting the table name appears to be much more
difficult; I have never had to do that yet. Good luck. -Ralph -
Hi,
I am using OCCI to interact with DB through code, which means I am writing a vc++ file to interact with Data Base and execute the Stored Procedure which I am calling from the C++ Code. And also displaying the output of the Stored Procedures to the Front End. I am succeeded in this, but now I should be able to display the Column names of the output to Front End. Can any one help me on this.
Example:
Sno | Sname
------- |-------------
1 ABC
2 DEF
I am getting (1,ABC) and (2,DEF) as the output of the Stored Procedure but I need the Column names also to display. How to get them.
Thanks in Advance..:)Look at Re: exporting csv via pl/sql - select statement?
It has an example how to extract the column name from a cursor. You have to check, whether you can use DBMS_SQL.DESCRIBE_COLUMNS
Your procedure might need another out parameter, that returns the column names , e.g. as comma separated list or as varray. -
GUI_DOWNLOAD with Internal table column names
Hi!
I am using FM 'GUI_DOWNLOAD' to download internal table to excel sheet. But, I am finding internal tables values only into excel sheet. I want Internal Table's column name as well. Please help me. and guide me.
Thanks in advance.
-Rupesh kayasth.Hi Rupesh,
You have two tables in the Tables parameter. One is DATA_TAB where you have to provide the internal table name which data you want to download. Second one is Field Names where you can provide the column names for the internal table fields. Concatenate the column names in a string and pass it to Fields names table.
Regards,
Jayaram...
Message was edited by:
Jayarama Sarma Mudda -
Run time Column Name in the Select Statement
Hi there,
I face problem while writing sql statment for report in the Oracle reports.
The prom is I want to bound the where clause column name with the value stored in a variable e.g.
Select * from emp
where Column_Name = 'XYZ' ;
where the variable Column_Name have different values at different times, e.g.
At a time the value of Column_Name is Dept then
Select * from emp
where Dept = 'XYZ' ;
At other time value of Column_Name is City then
Select * from emp
where City = 'XYZ' ;
Waiting for the response .
Regards,
HafeezHi,
U can use lexical parameters for the solutions.U must be aware of it, but still i describe how to work it out.
1)In your datamodel in object navigator create a parameter under User parameter node.Name the parameter, for eg. p_clause.
set data type of parameter to character.
2)write a select query eg.
select * from emp &p_clause; --(THIS IS THE PARAMETER WE CREATED ABOVE)
3)Now run your report
Now in your parameter form pass the value for p_clause parameter.
eg: where name='JACK';
or
where city='NEWYORK';
or where deptno=10;
But do it in steps as above mentioned.
Do tell me if it works or not via mail on [email protected]
Enjoy.......
navneet jain
[email protected]
Maybe you are looking for
-
Stumped! Can't Get Some Audio To Play.
I have some files that I converted with Visual Hub and I used their Apple TV 5.1 encoding. I have my Apple TV hooked up to my TV through HDMI. I recently moved and now no mater what I can't get the audio to play for those files. I have audio when I g
-
Hi, My requirement is to display the standard report pc00_m99_cwtr which is displaying row wise should be displayed column wise. For Example: The present output is: EmpNo Wagetype Amount 123 /101 1500.00 123 /102 1200
-
Rent amount distribution for multiple vendors in Contract.
hi all, As per my client Business scenario the rent amount need to distribute multiple vendors as ratio wise.Currently we are using version ECC 6.0 with SR3. I know that we have multiple vendors concept where we can distribute the amount as ratio wis
-
MarginPreference in InDesign CS5 js
Hi, I need to set margins to a different value, and my line doesn't work: myDoc.marginPreferences(MarginPreference.bottom =".125 in"); Thank you very much. Yulia
-
Auto 3D model smoothing in Photoshop CC, how to disable?
I've created a simple poly surface mountain range in Blender 3D, with no smoothing applied. Yet when I import it into Photoshop CC it appears to have smoothing enabled, giving me undesirable results. I've tried multiple formats (obj, 3ds, dae) and ge