Loop in any Table of Record
Hi
Somebody know how can I to do a loop in Table in any table record ?
I want to build a Generic Procedure or function
tks
I did not understand
I wanted something like :
PROCEDURE Mount_RecA(p_RecA IN t_RecA, p_Str IN OUT VARCHAR2, p_StrAux IN OUT VARCHAR2) IS
BEGIN
FOR i IN p_RecA.FIRST..p_RecA.LAST LOOP
IF p_RecA(i).Auxiliar THEN
p_StrAux := p_StrAux || Mount_Str(p_RecA(i).Conteudo,i);
ELSE
p_Str := p_Str || p_RecA(i).Conteudo;
END IF;
END LOOP;
END Mount_RecA;
Similar Messages
-
Is there any table which records the no. of Jobs run in day in BIP ?
Hi All,
I want to create a metadata report on what all jobs ran in my BIP production in a day. Is there any repository where this is recorded?
Please let me know.
I am in 10.1.3.4 and using oracle database
Thanks,
RonnyHi Ronny
All the reports the are scheduled the history will be stored in the backend table XMLP_SCHED_JOB.It will create a unique job_id.
Based on this table u can create a report in BIP using the RTF template..... -
Can we create a cursor that can hold records of any table
DECLARE
CURSOR cr_tablenames IS
SELECT tname
FROM tab;
v_tablename tab.tname%TYPE;
BEGIN
OPEN cr_tablenames;
LOOP
FETCH cr_tablenames INTO v_tablename;
EXIT WHEN cr_tablenames%NOTFOUND;
DBMS_OUTPUT.PUT_LINE('Table: '||v_tablename);
-- HERE, I WANT TO PERFORM SELECT * OPERATION ON
-- EACH TABLE WHOSE NAME COMES INTO v_tablename
-- AND DISPLAY THE RECORDS
END LOOP;
END;
I want to perform SELECT * operation on each table whose name comes into the variable and display the records. How to achieve it? I am clueless.
Can this be achieved by something like... using cursors which can be defined dynamically and which can hold records of any table?
Or, do I need to have some different approach to this problem?
Edited by: kartins on Nov 5, 2009 11:41 PMsomething like
SQL> create or replace
2 function getContent (p_tn in varchar2)
3 return sys_refcursor
4 is
5 retval sys_refcursor;
6 begin
7 open retval for
8 'select * from '||p_tn;
9 return retval;
10 end;
11 /
Function created.
SQL>
SQL> var rc refcursor
SQL>
SQL> begin
2 :rc := getContent ('emp');
3 end;
4 /
PL/SQL procedure successfully completed.
SQL>
SQL> print rc
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 17-DEC-80 900 20
7499 ALLEN SALESMAN 7698 20-FEB-81 1700 300 30
7521 WARD SALESMAN 7698 22-FEB-81 1350 500 30
7566 JONES MANAGER 7839 02-APR-81 3075 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1350 1400 30
7698 BLAKE MANAGER 7839 01-MAY-81 2950 30
7782 CLARK MANAGER 7934 09-JUN-81 2551 10
7788 SCOTT ANALYST 7566 19-APR-87 3100 20
7839 KING PRESIDENT 17-NOV-81 5100 10
7844 TURNER SALESMAN 7698 08-SEP-81 1600 0 30
7876 ADAMS CLERK 7788 23-MAY-87 1200 20
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7900 JAMES CLERK 7698 03-DEC-81 1050 30
7902 FORD ANALYST 7566 03-DEC-81 3100 20
7934 MILLER CLERK 7782 23-JAN-82 1400 10
14 rows selected.
SQL>
SQL> begin
2 :rc := getContent ('dual');
3 end;
4 /
PL/SQL procedure successfully completed.
SQL>
SQL> print rc
D
X -
Loop at field-symbol (any table) into string ?
Hi Everyone,
I need little help, I have a requirement to extract table content with columns names as the header.
After doing some search I figured out the best way to this since table name will be only avaialbe at runtime through
a selection field . my problem is to loop through field-symbol and convert a structure to string value so that I can
write to the file.
REPORT zlab_tbl_export.
DATA table_name(30) VALUE 'ZSMARTTS_HTML'.
DATA v_file(100) VALUE 'c:\sap_export.txt'.
DATA line(1000).
DATA: o_data TYPE REF TO data.
CREATE DATA o_data TYPE TABLE OF (table_name).
FIELD-SYMBOLS: <table> TYPE ANY TABLE.
ASSIGN o_data->* TO <table>.
SELECT * UP TO 100 ROWS FROM (table_name) INTO TABLE <table>.
OPEN DATASET v_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
>>>>>>> LOOP at <table> into line. >>>>>>>>>>>> " Here the code breaks and fail
TRANSFER line to v_file.
WRITE :/ line.
ENDLOOP.
CLOSE DATASET v_file.
Exception Message
|Error analysis |
| You attempted to move one data object to another. |
| This is not possible here because the conversion of a data object |
| of type "v" to type "C" is not supported. |
| |
| List of internal ABAP types: |
| |
| C Text (Character) |
| N Numerical text |
| D Date (YYYYMMDD) |
| T Time (HHMMSS) |
| X Hexadecimal |
| I Integer |
| P Packed number |
| F Floating point number |
| |
| h Internal table |
| r Object reference |
| l Data reference |
| g String of type C |
| y String of type X |
| s 2-byte integer with plus/minus sign |
| b 1-byte integer without plus/minus sign |
| u Structure (flat structure) |
| v Structure (deep structure) |Hi Everyone, I need little help, I have a requirement to extract table content with columns names as the header. After doing some search I figured out the best way to this since table name will be only avaialbe at runtime through a selection field . my problem is to loop through field-symbol and convert a structure to string value so that I can write to the file.
thie is the code
REPORT zlab_tbl_export.
DATA table_name(30) VALUE 'ZSMARTTS_HTML'.
DATA v_file(100) VALUE 'c:\sap_export.txt'.
DATA line(1000).
DATA: o_data TYPE REF TO data.
CREATE DATA o_data TYPE TABLE OF (table_name).
FIELD-SYMBOLS: <table> TYPE ANY TABLE.
ASSIGN o_data->* TO <table>.
SELECT * UP TO 100 ROWS FROM (table_name) INTO TABLE <table>.
OPEN DATASET v_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
LOOP at <table> into line. " Fail here
TRANSFER line to v_file.
WRITE :/ line.
ENDLOOP.
CLOSE DATASET v_file.
and this is the exception:
Error analysis
You attempted to move one data object to another.
This is not possible here because the conversion of a data object
of type v to type C is not supported.
Edited by: Misbah on Jan 7, 2010 11:50 PM -
Any table or program to get the number of records in P, A and F tables
HI all
any table for program to get the number of records in P, A and F tables. I want to create SQ01 queries to get the status of number of records. We are gng for a production cutover next week. Want to capture all the data before and after Upgrade cutover.
Also suggest me how to create sq01 queries.
Thanks in advance
regards
Janardhan KUmar K.Use Transaction LISTSCHEMA to see all the tables assosciated with ur cube
Total number would be what you find in both the E & F fact tables. If there is no compression in the cube then E table will be empty.
Alternatively u can use se16 transaction and enter E table and F table manually
E table - /BIC/E(Cube name) and Ftable - /BIC/F(Cube name)
Or else u can go to the manage of the cube and without selecting any field for O/P and ticking the option output number of hits execute. The total of Row Count will give u the total no of records in the cube. -
Any table to see Added Record amount
Hi All,
I am analyzing a DSO data loads and need to compare Added Records for each request. It is kind of inconvenient to look each request one by one in manage option. Does anyone know any table which I can find this information by date?
ThanksHi,
check this table u will get all required things
RSSTATMANPART
Bhaskar
Edited by: shanthi bhaskar on Feb 26, 2009 12:10 AM -
Oracle ADF - popup table's record gets empty or blank after any db action.
Hi,
I am using Oracle jDev 11.1.1.4.0.
In my application i have find button in my jspx.
On click of find button i have shown popup with table.
As user selects record from popup table that record get displayed in form fields of jspx
and user can edit that record and save it in the database.
Suppose I have edited a record and saved the same in database.
Now, when I click on that find button, pop up opens but the record which I have just edited is not getting displayed correctly in the table.
Some fields are getting emptied.
I have set the property of entity object's attribute, refresh after update and insert.
But still selected record get empty in popup table after database transaction.
appreciate your help..
thanks
Rupashree
Edited by: 888077 on Sep 28, 2011 5:54 AMBy the sounds of it you are in the wrong forum :)
Cheers
John
http://john-goodwin.blogspot.com/ -
Oracle adf - popup table's record get empty after any database tranasction.
Hi,
I am using Oracle jDev 11.1.1.4.0.
In my application i have find button in my jspx.
On click of find button i have shown popup with table.
As user selects record from popup table that record get displayed in form fields of jspx
and user can edit that record and save it in the database.
Suppose I have edited a record and saved the same in database.
Now, when I click on that find button, pop up opens but the record which I have just edited is not getting displayed correctly in the table.
Some fields are getting emptied.
I have set the property of entity object's attribute, refresh after update and insert.
But still selected record get empty in popup table after database transaction.
appreciate your help..
thanks
RupaBy the sounds of it you are in the wrong forum :)
Cheers
John
http://john-goodwin.blogspot.com/ -
RMAN Last Completed Backup recorded in any table/view?
Hi Friends,
we are running RMAN backup of Full Database every day on 11g R2 Database.
I would like to know where can i query the last completed backup date/time (in any table/view...) so that i will put a script to query that table/view to verify that the backup is completed .
Regards,
DBHello;
if you are using a catalog you can try this :
select
db_name,
start_time,
end_time,
status,
time_taken_display,
output_bytes_display,
output_device_type,
session_key,
session_recid,
session_stamp
from rc_rman_backup_job_details where end_time > sysdate -1If you not using a catalog V$RMAN_BACKUP_JOB_DETAILS should provide similar information.
Best Regards
mseberg -
Array or Table of Records or...what is best for my scenario?
I have been given task to trap last 5 action taken on a form application by user. This would be used where user gets a FRM or ORA error, dump last 5 steps to a table in the database along with error. Trapping FRM or ORA error is easy; I am wondering what & how should I note last 5 steps ( like, what page, what block & what form the user was clicking/entering data etc) when error occurred. I am planning to use when-mouse-click or some other triggers to capture the data; but at every action if I try inserting one record & deleting one record from the database table ( last one knocked out), there is going to be a lot of I/O & that table is going to be too hot. I am trying to avoid that unwanted I/O & keep those 5 steps info somewhere in forms till user gets a error. And, when he/she gets error, he/she can dump those 5 steps info along with error messages/number in a error table.
My question is: what do I use? Array or Table of records..or something else. I have never used any of these & thought to discuss this before going deep into implementation.
Any suggestion would be appreciated.
Thanks.You could use a table of records or a record group. They both achieve similar results but with very different syntax. I am not sure if there is any difference in performance.
Record groups are good for certain things like lists populated from the database because built-ins are provided for manipulating them. If you are going to do the manipulation programatically, I personally find the syntax for tables of records less cumbersome than record groups. Learning the syntax for tables of records is also likely to be more universally useful to you as they have various uses such as passing data between procedures.
In your situation the table of records needs to exist throughout the forms session rather than just during the execution of a single pl/sql block. The way to do that is create a program unit which is a package header without a body. Declare the table in there and it can be used throughout the form.
However, if you only ever want to keep 5 records, it would probably be easier just to have 5 ordinary items in a control block on the null canvas (or global variables). When you want to record your new action just do:
:item5 := :item4;
:item4 := :item3;
:item3 := :item2;
:item2 := :item1;
:item1 := :new_stuff;
You could even construct the above in a loop using
copy(name_in('item'||i),'item'i+i)
but with only 5 items to manipulate, is it worth the bother ?
Whatever method you decide to use, you are not going to get anything simpler than 5 little assignment statements. -
To modify a field in a database table based record identification by primar
hi
i want to to modify a field in a database table based record identification by primary key filed and two more fields
ie customer (primary key
i want to modify record from intenal table the record existing with primary key field customer
the status field needs to be mofied as " value rolled"
the below code is happening
loop at it_record into wa_Record
wa_inv-customer (primary key) = wa_Record=custome
wa_inv-date = wa_Record-date
...so one
append wa_inv to it_invest
clear wa_inv
endloop.
if not it_invest is initial
modify TABle1 ( this table is data base table which needs to be mofified) based on the primary key field
and also date field and status field which is not primary key.
regards
aroraHi there.
Your requirement is to update a Z Database table from your internal table, right? You have several options:
LOOP AT it_invest INTO wa_inv.
UPDATE dbtable
SET date = wa_inv-date
WHERE prim_key = wa_inv-prim_key
AND any_field = wa_inv-any_field.
ENDLOOP.
or
LOOP AT it_invest INTO wa_inv.
UPDATE dbtable FROM wa_inv. "if wa_inv of same type of dbtable
ENDLOOP.
In the first example, I wrote any field because you can update dbase table, filtering for fields that don't belong to the primary key. However, remember that you will change all records that respect the key you used (so, in your case, use the primary key).
Regards.
Valter Oliveira. -
Cursor for loop gives less number of records for certain condition
Hi i am getting very weired behaviour of cursor for loop.
i have one query below which returns 128 records.
select su.item_id from suv_tmp su
inner join review_items ri on su.ITEM_ID = RI.ITEM_ID
inner join sources s on s.source_id=ri.source_id
and s.source_name='XYZ'
but when i take this query in cursor for loop it returns only 100 records.
this is the cursor for loop i am writing:
begin
for v_rec in
(select su.item_id from suv_tmp su
inner join review_items ri on su.ITEM_ID = RI.ITEM_ID
inner join sources s on s.source_id=ri.source_id
where s.source_name='XYZ'
loop
dbms_output.put_line(v_rec.item_id);
end loop;
end;
It prints only 100 records.
The weired behaviour is that if i select any column name from the table which is used in where clause it gives 128 records..
query below gives expected output
begin
for v_rec in
(select su.item_id,s.source_descr from suv_tmp su
inner join review_items ri on su.ITEM_ID = RI.ITEM_ID
inner join sources s on s.source_id=ri.source_id
where s.source_name='XYZ'
loop
dbms_output.put_line(v_rec.item_id);
end loop;
end;
i am not able to find out any logc..
Any pointers appreciated..
Edited by: user11266153 on Dec 14, 2011 11:27 PM1) Can you provide the DDLs of those tables and dummy data to check if it gets reproduced at our env.
2) What is the Oracle Database software version? e.g. 9iR2 , 10gR1 , 10gR2 , 11gR1 etc... -
Using cursor on table of records
I'm trying to use cursors on a passed in table of records and I
get a compilation error on the cursor definition that states
that the table must be defined (but I'm passing the table in).
Here are the types:
create type input_record_t as object (
field1 varchar2(10),
field2 varchar2(20));
create type input_table_t is table of input_record_t;
procedure process_data (
input_data in input_table_t) is
cursor data_cursor is select * from input_data; /* error */
begin
/* processin here */
end;
I've also tried:
cursor data_cursor (data_table in input_table_t) is select
* from data_table; /* also error */
How do I define a cursor on a passed in table of records? Any
help would be appreciated.Same thing I am doing
Its working finr in applications(If i call from VB or ASP I am
getting result set)
I want to see the result set in SQL plus window,How can i call it
SQL > execute packperson.oneperson(1,?);
SQL > execute packperson.oneperson(1);
SQL > execute packperson.oneperson(1,NULL);
Nothing is working
Need help please
Thanks
are you trying to assign records to a plsql table type?
CREATE OR REPLACE PACKAGE packperson
AS
TYPE tfname is TABLE of VARCHAR2(15)
INDEX BY BINARY_INTEGER;
PROCEDURE oneperson
(onessn IN integer,
fname OUT tfname);
END packperson;
CREATE OR REPLACE PACKAGE BODY packperson
AS
PROCEDURE oneperson
( onessn IN integer,
fname OUT tfname)
IS
CURSOR person_cur
IS
SELECT ssn, fname, lname
FROM person
where ssn = onessn;
percount NUMBER DEFAULT 1;
BEGIN
FOR singleperson IN person_cur
LOOP
fname(percount) := singleperson.fname;
percount := percount + 1;
END LOOP;
END;
END; -
Table of records from a stored procedure
Hi
Where could I find an example or documentation about how to retrive a table of records from a Stored Procedure ??
ThanksTry:
CREATE OR REPLACE TYPE scott.MYRECORDTYPE as object
(a int, b varchar2(40), c date, d number(10));
CREATE OR REPLACE TYPE scott.MYTABLETYPE is table of myrecordtype;
CREATE OR REPLACE PACKAGE BODY scott.MYPACKAGE
as
type number_collection is table of number(38) index by binary_integer;
type varchar2_collection is table of varchar2(4000) index by binary_integer;
type date_collection is table of date index by binary_integer;
g_data myTableType;
empno_col number_collection;
ename_col varchar2_collection;
hiredate_col date_collection;
mgr_col number_collection;
function my_function return myTableType
is
begin
select empno, ename, hiredate, mgr
bulk collect into empno_col, ename_col, hiredate_col, mgr_col
from emp
order by empno; -- Get some data
g_data := myTableType(); -- Initialize
for i in empno_col.first .. empno_col.last loop
g_data.extend; -- Write something in the array
g_data(i) := myRecordtype(empno_col(i), ename_col(i), hiredate_col(i), mgr_col(i));
end loop;
return g_data;
end;
end;
-- Demonstration-View
CREATE OR REPLACE VIEW scott.myview
AS
select a,b,c,d
from table(cast(myPackage.my_function() as mytabletype)); -
Payment Program Creation Date and User (is this in any table in SAP R/3)?
Dear Experts!
The treasury guy asked me whether there would be a way to recover the "Payment Program" Creation Date and Created by (User) from Payment Program Executions (F110 transaction).
I searched on the REGU* tables and I didn't find out this information.
Does anybody know whether there is any table where this is recorded?
NOTE: We cannot use the information from "Proposal Log" because the log is removed from the Productive System and only the last 3 (three) days are remaining.
Thanks and Kind Regards,
Daniel Carvalho.Hello "The Wirtschaftsmann",
Thanks for the reply. However, I need the Creation Date and Creation by of the Proposal / Payment Run steps.
Not sure if this information is available nowadays at SAP. I opened an incident with SAP, let's see what they reply to us.
Regards,
Daniel
Maybe you are looking for
-
MAC Mini and Sony TV LCD question
In the past, when I connected to my Sony projector tv, unable to use the highest setting because lost part of the desktop with icons on bottom and entire top bar. New Sony LCD used and same thing happening. I am using a HDMI connection on the Apple.
-
Error message in Premiere Elements 4 to 9 "Running short on Memory"
When you get the error message " RUNNING SHORT ON MEMORY" save your work > in Premiere Elements while editing with H.264 mov files in excess of 1GB is it related to the Microsoft Operating System Limit of 4GB and 2GB performance of the program to 2GB
-
Issue while installing SOA in Oracle Linux 6
Hi, I am getting below errors while installing SOA in oracle Linux 6:- entryPoint: entryPoint = oracle.installType.all condition = null className = null contextFile:/tmp/OraInstall2012-04-13_08-04-44PM/prereq/oui/agent_prereq_context.xml The entry po
-
Scriptlet within a jsp:include tag
In Jrun 2.3.3 you could include a scriptlet within a <jsp:include> tag like this: <% String language = "E"; %> <jsp:include page="/Conditions<%= language %>.html"/> Since I have to programme for four languages on our site, I used this convenient way
-
Hi, I recorded some lectures on a program called Sound Studio, and saved them as 96-bit encoded AAC files, and I can't get them to open in iTunes. Can iTunes only play them in 128+ bit format? Is there a way to convert them to 128-bit? Help!