Table name in function
Hi,
I am passing table name in a procedure. Table name will be actually passed when calling this procedure. I am not able to compile this procedure without actual table name.
How do i can do that?
Thanks
Anjiv
Anjiv,
if it is a stored procedure you should use dynamic SQL (execute immediate).
If it is a Forms program unit, you should use the EXEC_SQL package.
Francois
Similar Messages
-
Table Name or Function Module to find out all the Screens & Subscreens for
Hello Experts,
Table Name or Function Module to find out all the Screens & Subscreens for all T-Codes
Helpful Answer will b rewarded
Arif ShaikHi Balaji,
But TSTC only Gives the Program Name , T-Code and Screen but not all the Subscreen details
Any other which U know -
Reg : Table name of Functional Module
Can some one sent me the table name where functional module details get stored
HI,
Check for Function Module.
Tables
TFDIR----
> Table contains Function Modules.
TFTIT----
>Table contains Function Module Short Text.
ENLFDIR-----> Additional Attributes for Function Modules.
rewards if useful,
regards,
nazeer -
Plant Maintenance - Table name for Functional Locations
Hi Guys,
I want to know in which table functional locations are stored.
I am interested in Level 3 functional locations.
Is there any FM or BAPI to get the Functional Locations?
Thanks,
minimini,
Have a look in IFLO or ILFOT
Each Floc (TPLNR) record has its superior FLOC (TPLMA).
PeteA -
Table name in which function module and function group store
Hai,
Any one help me, What is the table name, the function modules and fouction groups are stored.
Thanks,
Elamaran...and table enlfdir has additional info.... function module RS_GET_ALL_INCLUDES is useful for getting a list of includes used by an fm.
Message was edited by: Neil Woodruff -
Table name as parameter to function
Hi all,
can anybody help me on the below issue..
i have a function like this:
**create or replace**
**function "IL_SUM_AVG_FN" return number is**
**cursor c1 is**
** select sum_avg_val value**
** from wel_10_tab**
** where type='1';**
**v_sum number;**
**v_count number;**
**BEGIN**
** v_sum:=0;**
** v_count:=0;**
** for i in c1 loop**
** if v_count=0 then**
** v_sum:=i.value;**
** else**
** v_sum:=abs(i.value+v_sum);**
** end if;**
** v_count:=v_count+1;**
** end loop;**
** return v_sum;**
**END;**
now my requirement is like..i want to pass a value as parameter to the function..say i will pass 10 or11 or 12
then it should change the table name in the cursor according to the parameter.i.e
if the parameter is 10 it should be: select sum_avg_val value from wel_10_tab where type='1';
if the parameter is 11 it should be: select sum_avg_val value from wel_11_tab where type='1';
if the parameter is 12 it should be: select sum_avg_val value from wel_12_tab where type='1';
parameter has only these three possible values..
how to achieve this?
please help..Hi,
you can do without execute immediate and one cursor is sufficient, if you use open cursor for ...:
set serveroutput on;
drop table TestTab1;
drop table TestTab2;
create table TestTab1 (
val number
create table TestTab2 as (select * from TestTab1 where 0 = 1);
create or replace procedure TestProc (
TableName in varchar2)
is
rec TestTab1%rowtype;
cur sys_refcursor;
curStr varchar2(1024) := 'select * from ' || TableName;
begin
open cur for curStr;
loop
fetch cur into rec;
exit when cur%notfound;
dbms_output.put_line ('value = ' || rec.val);
end loop;
end;
insert into TestTab1 (val) values (1);
insert into TestTab1 (val) values (2);
insert into TestTab1 (val) values (3);
insert into TestTab1 (val) values (4);
insert into TestTab2 (val) values (101);
insert into TestTab2 (val) values (102);
insert into TestTab2 (val) values (103);
insert into TestTab2 (val) values (104);
begin TestProc('TestTab1'); end;
begin TestProc('TestTab2'); end;
/regards,
Frank
Edited by: user8704911 on Jul 11, 2011 10:35 PM
Edited by: user8704911 on Jul 11, 2011 10:36 PM -
Pass table name as a parameter to function
Is there a way to pass table name as a parameter to functions? Then update the table in the function.
Thanks a lot.
JiaxinHi, Harm,
Thank you very much for your suggestion and example. But to get my program work, i need to realise code like follows:
CREATE OR REPLACE FUNCTION delstu_func(stuno char) RETURN NUMBER AS
BEGIN
EXECUTE IMMEDIATE 'DELETE FROM student s' ||
'WHERE' || 's.student_number' || '=' || stuno;
LOOP
DBMS_OUTPUT.PUT_LINE('record deleted');
END LOOP;
END;
SELECT delstu_func('s11') FROM STUDENT;
The intention is to check if such a function can perform operations such as update, delete and insert on occurence of certain values. When executing the above statement, the system returns an error message:
ERROR at line 1:
ORA-00933: SQL command not properly ended
ORA-06512: at "SCMJD1.DELSTU_FUNC", line 3
Could you tell me where is wrong?
Jiaxin -
Function based indexes info,pls let me know data dictionary table name?
Hi,
pls let me know,Where can we find Function based index information ,that is data dictionary table name,.
that is information like function used, column name.
Thanks,
KUmar.all_ind_expressions
-
Dynamically pass Table name, Column Name and rownum to function
Hi Guys
I wanted to pass the table name, column name and rownum to function and get the relevant value for it. Please guide me to achieve this task
Thanking You
Regards
LakmalThanks,
Here is my test function
CREATE or replace FUNCTION GET_COLUMN_VALUE (tab_name VARCHAR2,column_name VARCHAR2) RETURN varchar2 AS
strsql varchar2 (500);
ColVal varchar2;
BEGIN
strsql:='select '||column_name||' from '||tab_name|| ' Where rownum = 1' ;
EXECUTE IMMEDIATE strsql into ColVal;
RETURN ColVal ;
END;
Message was edited by:
Lakmal Marasinghe -
ORA-04091: table name is mutating, trigger/function may not see it
Hi,
I have a row level before update trigger written on a table A which calls a procedure to undergo some processing. Procedure has some select queries against table A and it inturn causes the following error.
ORA-04091: table name is mutating, trigger/function may not see it
To overcome this I have used a combination of PL/SQL collection types (nested tables based on the following definition TYPE t_table_a is table of A.colname%TYPE index by binary_integer;), a row level before update trigger and statement level after update trigger. The mutating problem is fixed, but to update one row of data it took around 3 min and I am wondering if its the problem with PL/SQL tables I have used.
In before update trigger I am storing the unique id's which needs to be updated into the PL/SQL table and in the after update trigger I am looping through the PL/SQL table and peforming the rest of the processing by calling in the procedure.
Can anyone help how to minimize the run time of this process or if any other better solution exists?
Thanks for the helpTriggers raise the mutating table issue, because else they could be used to create endless loops. If you work around the mutating table issue, then you should make sure not to create an endless loop yourself. This would be possible.
You description also seems to imply something like this.
Without code it is impossible to say something specific.
- Do you initialize your collection in a before statement trigger?
- Is your looping mechanism somehow broken?
- Do you update the same table again and again and again? -
Cannot have functions across tables if table name includes dot (.)
It appears that table names must not include a dot (.) or else functions that take arguments from several tables do not work (e.g., compute the sum of several values form different tables). To be precise, they do work if the functions were inserted using a the previous version of Numbers. New or old but edited functions do not work.
Is anyone else seeing this problem?As in French or Italien, comma (,) is the decimal separator in German (and the dot separates thousand). The commas do not cause these problems, just dots (.).
However, your mentioning the simple quotes gets us one step further: With French, Italian or German number format these simple quotes are added automatically when characters such as comma or minus sign are part of the table name. They are not added when dots are part of the table name.
When I add the single quotes manually, then the cross-table formula works - once. However, when I edit the formula the single quotes are magically removed, causing the error to occur again.
So far, it seems as if the dot is not taken care of at least with French, German and Italian as the number format. I have not tried any other languages. -
Table name /function module needed(urgent)
need a function module or a table in which i cod get a list of "tables names " used in "includes " .... urgent
ne alternate way to fetch so is also welcomeHi
use the program
RPR_ABAP_SOURCE_SCAN
Regards
Anji -
Functional Modular or table name to component for a material
Hi,
Please help me for finding Functional Modular or table name to get all component (Alternative BOM also) for a particular material.
thanksHi sahoo
try this CUBM_MATERIAL_BOM_READ
or look for other FM on se37 with bomread*
Regards
Marco -
Oracle function in stored procedure to retreive particular table name
Hi,
I need to delete a table 'xxsys_dram_flatproperties' from database given model name as 'dram-model'.
the model name can be any thing.corresponding table name will be[i] 'xxsys_<modelname>_flatproperties'.
I wrote stored procedure .I am able to retrieve all the tables in the database using user_tables.Is there any funtion in oracle like
if table name contains letters that are there in model name.
Pleasehelp.Suppose all your tables created in the schema 'temp'
and you are absolutly sure you want to drop only tables which have for example '_model3_' in its name (nothing else should have same part in your schema)
then try a simple solution:
CREATE TABLE temp.xx_model3_01 (col1 NUMBER)
CREATE TABLE temp.xx_model3_02 (col1 NUMBER)
SELECT table_name from all_tables where OWNER = 'TEMP' and table_name LIKE '%_MODEL3_%'
TABLE_NAME
XX_MODEL3_01
XX_MODEL3_02
DECLARE
CURSOR c1
IS
(SELECT table_name
FROM all_tables
WHERE owner = 'TEMP' AND table_name LIKE '%_MODEL3_%');
BEGIN
FOR rec IN c1
LOOP
EXECUTE IMMEDIATE 'DROP TABLE ' || rec.table_name;
END LOOP;
END; -
Error while passing a table to a function module
Hi Iam passing a table g_tab of length 376 flat structure to the function module..under TABLES section parameter.
Changedocument_read_headers.
iam getting a complile time error like the below displayed thing. Can u tell me how to solve this ?
In the function module interface, you can specify only
fields of a specific type and length under "I_CDHDR".
Although the currently specified field
"G_CDHDR_TAB" is the correct type, its length is incorrect.
Edited by: kiran kumar on Jul 7, 2008 8:53 AMprobably u making a mistake while declaring the table
declare it like this in the tables section:
S_JOB LIKE RNGE_OBJID
where s_job is the internal table name and RANGE_OBJID is a structure type and NOT an internal table type.
Maybe you are looking for
-
"PDB file does not contain provider information" Win8.1 - Error when using traceview
We have been attempting to manage a Windows 8.1 machine by using the Enterprise Device Management Protocol. We are encountering a failure during the process and would like to inspect what is going wrong on the Client Side. Used the "Windows 8.1 Enter
-
Forms trace in 11.5.10.2
Hi: I was told if a form trace from Help --> Diagnostics -> trace is not enough in details, there is a more detailed trace (level 2 or something?) from OAM --> form session. I checked but didn't see. Can some one help me on this? Thank you very much
-
Move screen lock button gone, how do I get it back?
Its not the one to open the iPad, but when we first had it, the button above the volume control worked as a lock button to stop the angle of the screen moving. I don't know what happened, but now that button mutes the volume. Is there a particular mo
-
All Adobe PS fonts mysteriously removed from Word 2000 font library
HELP ! Operating System: Windows 2000 Professional with Service Pack 4 Word Processor: Office 2000 (including Word 2000) with Service Pack 3 Adobe Type Manager Deluxe: Version 4 .1 installed May 24, 2000, Serial Number XXXXXXXXXXXXXX-X
-
What is the maximum length or a query in Oracle? I have to build a query with a variable length where clause and cannot find any doc on how many characters my select statement may contain.