TABLE OF Clause to fetch records from an object table.?
Hi All,
I want to know where in Oracle we can find material related to TABLE(OBJECT TYPE) Clause.
Please find the code below which I am using.
CREATE OR REPLACE TYPE OBJ_EMPNO AS OBJECT(EMPNO NUMBER);
CREATE OR REPLACE TYPE TAB_EMPNO AS TABLE OF OBJ_EMPNO;
DECLARE
TYP_EMPNO TAB_EMPNO := TAB_EMPNO(OBJ_EMPNO(10), OBJ_EMPNO(20));
BEGIN
FOR REC IN (SELECT FROM TABLE(TYP_EMPNO)) LOOP*
DBMS_OUTPUT.PUT_LINE(TREC.EMPNO);
END LOOP;
END;
THE ABOVE Code works fine. But my question is Where can I find document related to TABLE(OBJECT TYPE) Clause.
I searched a lot and found some in Oracle documentation, but most of them are not related to my requirement.
Would appreciate if someone provide me some information here.
Thanks,
MK.
where in Oracle we can find material related to TABLE(OBJECT TYPE) Clause.See TABLE().
Similar Messages
-
Deleting/Updating records from an object table in PL/SQL
Hello All,
VER:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
I have created an object and inserted records in it. Is there any way we can delete/update records from it. I do not want to delete based on iteration like delete.collection but I would like to know if we can delete directly from obj like delete from table...
CREATE OR REPLACE TYPE test_type AS OBJECT
col1 number,
col2 varchar2(100)
CREATE OR REPLACE TYPE tab_type is table of test_type;
DECLARE
test_tab tab_type;
l_cnt NUMBER;
BEGIN
select test_type(col1,col2) bulk collect
into test_tab from (select 1 as col1,'test1' as col2 from dual
union all
select 2,'test2' from dual);
IF test_tab.count>0
THEN
DELETE FROM TABLE(CAST(test_tab as tab_type)) a
where a.col1=1;
END IF;
l_cnt := test_tab.count;
END;Thx
Shank.SB,
I have a scenario wherein I insert few records into a collection table. I'm gonna filter few records from collection table based on the filter.
I want to delete the records that didn't match the filter. Right now, I'm inserting the records into a physical table and deleting from there. I do no want to use a physical table. Trying to avoid it.
Would like to delete from collection itself.
DELETE FROM TABLE(CAST(lv_attr_filter_tab as EDMS_CSPP_DISC_REQ_TAB_TYPE))
WHERE NOT EXISTS (SELECT 1
FROM edms_disc_lines_stg edls
WHERE edls.req_id = edrg.request_id
AND edls.disc_line_id = edrg.discount_id
AND UPPER(edls.disc_status) IN ('ACTIVE'); -
Sender JDBC Adapter : Fetch records from multiple tables
Hi Friends,
I am using sender JDBC adapter to select few records from DB2 database table.
This scenario is working fine.
Now my requirement is to fetch records from 3 tables. These table are independent to each other. There is no primary key or foreign key.
Please let me know how to write the sql in sender JDBC adapter to fetch records from these 3 tables.
Thanks,
Sandeep Mauryahi sandeep...
if the tables are completely independent and do not share any primary / foreign key relation ship...
why dont u think towards creating a seperate interface for each of them..
or if u still want to select from multiple table at once..the best way would be to write a stored procedure on the sender side which do all the fetching n processing and pass the final resultset to PI
or u can think towards fetching the data from 1 table and then in UDF do lookup from other tables..which again is tricky and performace intensive -
Time out error while fetching records from table BKPF
Hi,
I am fetching records from table BKPF using BUKRS & AWKEY in where clause. Query is as follows:
SELECT BELNR XBLNR AWKEY
FROM BKPF
INTO TABLE L_I_BKPF_TEMP
PACKAGE SIZE 500
WHERE BUKRS LIKE L_C_EG
AND AWKEY IN L_R_AWKEY .
APPEND LINES OF L_I_BKPF_TEMP TO I_BKPF .
ENDSELECT .
Program is giving time out error. There are 25628 records in range L_R_AWKEY , i m fetching 500 records at a time using PACKAGE SIZE. But the execution of prog stops on this query.
Please suggest something to overcome this problem.Hi
Rui is right,
if you need to get the data by operation parameters u have to use the fields AWTYP and AWKEY.
In this selection u can omit the company code.
SELECT BELNR XBLNR AWKEY FROM BKPF
INTO TABLE L_I_BKPF_TEMP
PACKAGE SIZE 500
WHERE AWTYP = <......> "<------------
AND AWKEY IN L_R_AWKEY .
APPEND LINES OF L_I_BKPF_TEMP TO I_BKPF .
ENDSELECT .
Max -
PDE-PLI031 Unable to fetch record from table tool_modulre
Dear ALL
I am creating PL/SQL Libraries in report builder.
but When I try to save the Library to database, a error
PDE-PLI031 Unable to fetch record from table tool_modulre.
Would you please tell me how to solve this problem
and why it coming
thankyou very much
pritam singhHi ,
Saving a library (.pll) to database would store the object inside specific tables that are to be created.
If you are using 6i, then you should find toolbild & toolgrnt.sql files which you have to run in the order specified. The above scripts creates the necessary tables and henceforth you won't get those errors while saving.
Hope this helps.
Thanks,
Vinod. -
How to use for all entires clause while fetching data from archived tables
How to use for all entires clause while fetching data from archived tables using the FM
/PBS/SELECT_INTO_TABLE' .
I need to fetch data from an Archived table for all the entries in an internal table.
Kindly provide some inputs for the same.
thanks n Regards
RameshHi Ramesh,
I have a query regarding accessing archived data through PBS.
I have archived SAP FI data ( Object FI_DOCUMNT) using SAP standard process through TCODE : SARA.
Now please tell me can I acees this archived data through the PBS add on FM : '/PBS/SELECT_INTO_TABLE'.
Do I need to do something else to access data archived through SAP standard process ot not ? If yes, then please tell me as I am not able to get the data using the above FM.
The call to the above FM is as follows :
CALL FUNCTION '/PBS/SELECT_INTO_TABLE'
EXPORTING
archiv = 'CFI'
OPTION = ''
tabname = 'BKPF'
SCHL1_NAME = 'BELNR'
SCHL1_VON = belnr-low
SCHL1_BIS = belnr-low
SCHL2_NAME = 'GJAHR'
SCHL2_VON = GJAHR-LOW
SCHL2_BIS = GJAHR-LOW
SCHL3_NAME = 'BUKRS'
SCHL3_VON = bukrs-low
SCHL3_BIS = bukrs-low
SCHL4_NAME =
SCHL4_VON =
SCHL4_BIS =
CLR_ITAB = 'X'
MAX_ZAHL =
tables
i_tabelle = t_bkpf
SCHL1_IN =
SCHL2_IN =
SCHL3_IN =
SCHL4_IN =
EXCEPTIONS
EOF = 1
OTHERS = 2
OTHERS = 3
It gives me the following error :
Index for table not supported ! BKPF BELNR.
Please help ASAP.
Thnaks and Regards
Gurpreet Singh -
How can i fetch records from 3 tables in a single query without using join
Hi.
Can any body please tell me <b>How can i fetch records from 3 tables with a single query without using joins</b>
Thanx
prabhuduttaHi Prabgudutta,
We can fetch the data by using the views concept.
Go throuth this info we can know the how to create view and same like database table only we can fetch the data.
Views conatin the data at runtime only.
Four different view types are supported. These differ in the
way in which the view is implemented and in the methods
permitted for accessing the view data.
Database views are implemented with an equivalent view on
the database.
Projection views are used to hide fields of a table (only
projection).
Help views can be used as selection method in search helps.
Maintenance views permit you to maintain the data
distributed
on several tables for one application object at one time.
step by step creation of Maintenance view:
With the help of the table maintenance generator, you are able to maintain the ENTRIES of the table in SM30 transaction.
It can be set in transaction SE11 - Tools - Table maintenance generator.
Table maintanance Generator is used to manually input values using transaction sm30
follow below steps
1) go to se11 check table maintanance check box under attributes tab
2) utilities-table maintanance Generator-> create function group and assign it under
function group input box. Also assign authorization group default &NC& .
3) select standard recording routine radio in table table mainitainence generator to move table
contents to quality and production by assigning it to request.
4) select maintaience type as single step.
5) maintainence screen as system generated numbers this dialog box appears when you click on create button
6) save and activate table
One step, two step in Table Maintenance Generator
Single step: Only overview screen is created i.e. the Table Maintenance Program will have only one screen where you can add, delete or edit records.
Two step: Two screens namely the overview screen and Single screen are created. The user can see the key fields in the first screen and can further go on to edit further details.
SM30 is used for table maintenance(addition or deletion of records),
For all the tables in SE11 for which Table maintenance is selected , they can be maintained in SM30
Sm30 is used to maintain the table ,i.e to delete ,insert or modify the field values and all..
It creates the maintenance screen for u for the aprticular table as the maintenance is not allowed for the table..
In the SE11 delivery and maintenance tab, keep the maintenance allowed..
Then come to the SM30 and then enter the table name and press maintain..,
Give the authorization group if necessary and give the function group and then select maintenance type as one step and give the screen numbers as system specified..
Then create,,,
Then u will able to see the maintenance view for the table in which u can able to insert and delete the table values...
We use SM30 transaction for entering values into any DB table.
First we create a table in SE11 and create the table maintenance generator for that Table using (utilities-> table maintenance generator) and create it.
Then it will create a View.
After that from SM30, enter the table name and Maintain, create new entries, change the existing entries for that table.
Hope this resolves your query.
Reward all the helpful answers.
Rgds,
P.Naganjana Reddy -
Fetching record from table and displaying in JSP while loading page -struts
Hi all,
I have a problem relating to struts .
I am fetching records from database and I want to diaplay those records in corresponding fields in the jsp page.
I am using Struts MVC Framework.
I am giving the sample code below.
In my action class i am giving the following code.
String sql="Select empname from emp where empcode='1' ";
ResultSet rs=S.executeQuery(sql);
if(rs.next()){
EditForm e=new EditForm();
e.setEmpname(rs.getString(1));
In my Action Form
I gave setter and getter methods for Empname
public String getEmpname() {
return empname;
public void setEmpname(String empname) {
this.empname = empname;
In my jsp gave
<html:form method="POST" action="submitForm.do?action=1" >
<html:text property="empname" />
</html:form>
The targets given are correct and it is being redirected.
But the value is not displaying in the textbox while the jsp is loading.
There is a record for the sql query.
Anybody please help me out
It is very urgent
Thank You
ParvathyNow in the following code, why are u creating a new form?
Why dont you use the form which is input to the Action Class's execute methof?
if(rs.next()){
EditForm e=new EditForm();
e.setEmpname(rs.getString(1));
}Thanks and regards,
Pazhanikanthan. P -
How to fetch records from the database into a combo box?
Hi:
I´m really new with ABLBPM and I´m trying to fetch records from the database to display them into a combo box as valid values for a presentation but I´m using a dynamic method with this code:
<em>for each row in SELECT campo1, campo2 from TABLE</em>
<em>do</em>
<em>solicitudes[] = [row.campo1, row.campo2]</em>
<em>end</em>
<em>return solicitudes
</em>And the debugger says that SQL instructions can be used only in fuctions and procedures that are executed on the server.
Do you know another way to do it?
P.D. Sorry for my terrible english
GreetingsHi Steve,
Thank you, your idea is perfect, but when I try to run the screenflow where the combo should be filled I get this error:
fuego.lang.ComponentExecutionException: No se ha podido ejecutar correctamente la tarea.
Motivo: 'java.lang.NullPointerException'.
at fuego.web.execution.InteractiveExecution.setExecutionError(InteractiveExecution.java:307)
at fuego.web.execution.InteractiveExecution.process(InteractiveExecution.java:166)
at fuego.web.execution.impl.WebInteractiveExecution.process(WebInteractiveExecution.java:54)
at fuego.webdebugger.servlet.DebuggerServlet.redirect(DebuggerServlet.java:136)
at fuego.webdebugger.servlet.DebuggerServlet.doPost(DebuggerServlet.java:85)
at fuego.webdebugger.servlet.DebuggerServlet.doGet(DebuggerServlet.java:66)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
at fuego.web.execution.servlet.ServletExternalContext.forwardInternal(ServletExternalContext.java:197)
at fuego.web.execution.servlet.ServletExternalContext.processAction(ServletExternalContext.java:110)
at fuego.webdebugger.servlet.DebuggerExecution.dispatchComponentExecution(DebuggerExecution.java:64)
at fuego.web.execution.InteractiveExecution.invokePrepare(InteractiveExecution.java:351)
at fuego.web.execution.InteractiveExecution.process(InteractiveExecution.java:192)
at fuego.web.execution.impl.WebInteractiveExecution.process(WebInteractiveExecution.java:54)
at fuego.web.execution.InteractiveExecution.process(InteractiveExecution.java:223)
at fuego.webdebugger.servlet.DebuggerServlet.doDebug(DebuggerServlet.java:148)
at fuego.webdebugger.servlet.DebuggerServlet.doPost(DebuggerServlet.java:82)
at fuego.webdebugger.servlet.DebuggerServlet.doGet(DebuggerServlet.java:66)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
Any ideas??
Thanks and greetings -
Unable to fetch records from database with huge selection screen
Hi all,
I have 20 fields from selection screen.
I have a z table with these 20 fields .
Now with the values entered in the selection screen i have to fetch the records from the z table.
All fields in the selection screen are not mandatory, the user may or may not enter the values.
I have to fetch the records based on the values entered.
I wrote a select with where condtion to all those 20 fields. but its not retreving the records.
All the fields in the selection screeen are parameters.
Could you help me on this, please. I wrote in the where conditon with field1 = value AND field 2 = value.. etc... field20 = value.
Please guys help me out.
KV.
Edited by: Nithin Kumar on Mar 18, 2008 8:48 AMGuys,
I have a problem with the select query.
as i said i have 20 fields, ranges are working for few fields.
But i have couple of fields as descriptions. So i have to fetch the records for pattenr as well.
Means, user can enter in the description............. like "ab". So in the description if there is anything with 'ab' it should fetch.
it works with a LIKE statement with % symbols.
but it doenst work with ranges and patterns in same select. I mean the below is not working.
SELECT *
FROM crmd_orderadm_h
INTO table itab
WHERE object_id IN r_obj AND
process_type IN r_pro AND
description LIKE s_des.
r_obj, r_pro are ranges and s_des is the pattern, ex: %ab%. so in this case how it has to be done... could you please help me on this.. the other fields could be blank( r_obj and r_pro)..
kindly help me out......
KV -
Select records from MS Access tables using multiple conditions
Hi,
I am trying to build s select list of team names for a
sporting club website. The select list should include teams if the
currently logged in user is a coach, team manager, assistant coach,
player or a parent of a player.
When I have only one group of conditions in the where clause
it works fine. But that only accounts for one of the above roles.
As soon as I ad an OR and another set of criteria my CF7 server's
swsoc.exe goes into an permanent loop (well, at least 10 minutes, I
reboot after that :-)
For example, this works fine ...
<!--- select teams I coach, assistant coach, manage, am a
parent of a player, or am a player --->
<cfquery name="teams"
Datasource="#Application.Datasource#">
SELECT distinct teams.uid_team, team_name, uid_coach,
uid_team_manager, uid_coordinator, team_asst
from teams, player_agegroups, players
where
(player_agegroups.uid_team=teams.uid_team and
players.uid_user=player_agegroups.uid_user
and teams.uid_season=#session.season# and
players.uid_invoice_to=#session.userid#)
Order by team_name
</cfquery>
But as soon as I add another condition cf7 goes into a
loop...
<!--- select teams I coach, assistant coach, manage, am a
parent of a player, or am a player --->
<cfquery name="teams"
Datasource="#Application.Datasource#">
SELECT distinct teams.uid_team, team_name, uid_coach,
uid_team_manager, uid_coordinator, team_asst
from teams, player_agegroups, players
where
(player_agegroups.uid_team=teams.uid_team and
players.uid_user=player_agegroups.uid_user
and teams.uid_season=#session.season# and
players.uid_invoice_to=#session.userid#) or
(player_agegroups.uid_team=teams.uid_team and
players.uid_user=player_agegroups.uid_user
and teams.uid_season=#session.season# and
players.uid_user=#session.userid#) or
(player_agegroups.uid_team=teams.uid_team and
players.uid_user=player_agegroups.uid_user
and teams.uid_season=#session.season# and
teams_uid_coach=#session.userid#) or
(player_agegroups.uid_team=teams.uid_team and
players.uid_user=player_agegroups.uid_user
and teams.uid_season=#session.season# and
teams.team_asst=#session.userid#) or
(player_agegroups.uid_team=teams.uid_team and
players.uid_user=player_agegroups.uid_user
and teams.uid_season=#session.season# and
teams.uid_team_manager=#session.userid#)
Order by team_name
</cfquery>
Any combination hangs CF7, whether it be two, three or all
conditions, and any combination of conditions..
The teams table stores team name, coach, team manager,
assistant coach and coordinator. Players table stores the player
records, and the parent (uid_invoice_to), is part of the player
record. player agegroups has the teams, with a record for each
player in a team. The whole system is based around seasons, hence
the #session.season# variable.
What should happen is I get a very short list of teams. When
I select a team from the select list I then go and grab all the
player records from the player_agegroups table joined to the users
table to get their names, date of birth etc...
Can anyone see what I am doing wrong?
thanks
TanyaYou might try to change your query using a SQL JOIN command,
so you can link the appropriate tables independently from the WHERE
selection criteria. You could use Access to create the query and
then go to the SQL command view to get the correct synyax. -
How to fetch data from single database table using 2 internal tables.
Hi friends,
i am a new user of ABAP and also SDN.
i need a help.
i want to fetch data from one database table based on primary keys of 2 internal tables. how to put in where clause.
Thanks in advance.hii
refer to following code ..i hope it will help you
SELECT matnr " Material Number
FROM mara
INTO TABLE i_mara
WHERE matnr IN s_matnr.
IF i_mara[] IS NOT INITIAL.
SELECT matnr " Material Number
werks " Plants
prctr " Profit Center
FROM marc
INTO TABLE i_marc
FOR ALL ENTRIES IN i_mara
WHERE matnr = i_mara-matnr
AND werks IN s_werks.
ENDIF. " IF i_mara[] IS NOT INITIAL
i_output = i_marc.
IF i_marc[] IS NOT INITIAL.
SELECT matnr " Material Number
werks " Plants
lgort " Storage Location
FROM mard
INTO TABLE i_mard
FOR ALL ENTRIES IN i_marc
WHERE matnr EQ i_marc-matnr
AND werks EQ i_marc-werks
AND lgort IN s_lgort.
ENDIF. " IF i_mara[] IS NOT INITIAL
regards
twinkal -
Fetch records from Database based on Input value
Hi Experts,
In my mobile application, I have designed one input field with F4 help or input assist. I need to fetch records from database based on that input and need to display records in table.
My question is:
How to fetch the records from database/back end based on the input value and display them as table format as we are doing in SAP ABAP?
Here, I need to fetch the records based on input value available in the UI screen and pass that value to gateway, fetch the records from database and need to bind with table in SAPUI5.
Kindly share the whole process flow with sample code for this requirement. Hope I have explained the requirement in detail.
Thanks In Advance..
Regards,
Arindam Samanta.Hi,
Try something like this.
In this, I am passing From date, To date, RelGrp, RelStr, Uname as input. Then I am storing those values in variables and passing this data in Odata request.
OData.read({ requestUri: "http://xxxx:8000/sap/opu/odata/sap/Z188_PO_SRV/pos?$filter=Docdate le datetime'"
+ todateformat+"T00:00:00' and Docdate ge datetime'"
+ fromdateformat+"T00:00:00' and RelGrp eq '"
+ relcode +"'and RelStr eq '"
+ relstg +"'and Uname eq '"
+ username+ "' "},
function (data) {
console.log(data);
When we are giving correct inputs it will goes to Success function and get the data from back end.
In console we can see the data.
Hope this will helps to you.
Thanks&Regards
Sridevi -
How to select first several records from a database table by using select?
Hi,
I want to select first 100 records from a database table by using select clause. How to write it?
Thanks a lot!hai long!
well select statement is used to retrive
records from the database.
following is the syntax to be used.
1) select * into corresponding fields of itab from basetable where condition.
endselect.
ex: select * into corresponding fields of itab from mara
where matnr >= '1' and matnr <= '100'.
append itab.
endselect.
select * is a loop statement.it will execute till matnr is less than or equal to 100.
note: you can also mention the required field names in the select statement otherwise it will select all the field from table mara.
note: itab means your internal table name.
hope you got the required thing.if it really solved u r problem then award me the suitable points.<b></b> -
Query regarding the data type for fetcing records from multiple ODS tables
hey guys;
i have a query regarding the data type for fetcing records from multiple ODS tables.
if i have 2 table with a same column name then in the datatype under parent row node i cant add 2 nodes with the same name.
can any one help with some suggestion.Hi Mudit,
One option would be to go as mentioned by Padamja , prefxing the table name to the column name or another would be to use the AS keyoword in your SQL statement.
AS is used to rename the column name when data is being selected from your DB.
So, the query Select ename as empname from emptable will return the data with column name as empname.
Regards,
Bhavesh
Maybe you are looking for
-
Case When Statement and ORA:1722 Invalid number error
Sorry I posted this in the wrong forum - I have the answer now Cheers HELP!!! We are trying to put together a calculation that returns the number of days absent an individual has had in a given time period. We need to cater for those absences that st
-
Invalid Serial Number for Photoshop CS6
We tried to download the software with the serial number, however fail. It prompts the following error message "Invalid Serial Number" Please re-enter a valid serial number. Please advise us a solution.
-
Install of Reader 11.0.0.3 automagically closes at open
I did an install of 11.0.0.3 When I try to open a pdf file, it opens, I can see it for about 1 sec and then the application closes In the forum it talks about running Eula.exe manually - I have done that. It prompts me for an accept... which I do I h
-
Starting a new discussion thread since the previous one has been locked and I'm still curious to hear people's experience with the update. I continue to delay downloading it because of all the concerns that have been expressed here.
-
HI all if any body could tail me whats about customer service if sap has any book on customer service means sap press book i check the sap press link i found service and crm so cs has changed to crm or what happened to this componenet i have a gener