Selecting record from a variable table
Hi,
I need to display the records from a table and the table name is saved in a variable. I am writing the code like
create or replace procedure test_col as
t_name VARCHAR2(40);
V_ID VARCHAR2(10);
cursor c_table is SELECT TABLE_NAME FROM ALL_TAB_COLS WHERE COLUMN_NAME = 'E_ID';
begin
OPEN C_TABLE;
LOOP
FETCH C_TABLE INTO T_NAME;
EXIT WHEN C_TABLE%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(T_NAME);
SELECT E_ID INTO V_ID FROM T_NAME;
DBMS_OUTPUT.PUT_LINE(V_ID);
END LOOP;
CLOSE C_TABLE;
end;
Its giving the error as table name doesn't exist. Its taking t_name as the table name but i wan to use the value saved in that variable as the table name;
Any help..
Thanks
Ashish
CREATE OR REPLACE PROCEDURE test_col
AS
t_name VARCHAR2 (40);
v_id VARCHAR2 (10);
CURSOR c_table
IS
SELECT table_name
FROM all_tab_cols
WHERE column_name = 'E_ID';
BEGIN
OPEN c_table;
LOOP
FETCH c_table
INTO t_name;
EXIT WHEN c_table%NOTFOUND;
DBMS_OUTPUT.put_line (t_name);
EXECUTE IMMEDIATE 'SELECT e_id FROM ' || t_name
INTO v_id;
DBMS_OUTPUT.put_line (v_id);
END LOOP;
CLOSE c_table;
END;
/
Similar Messages
-
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 can I select records from a DB table with intervals?
Hello,
Suppose my DB table is having 20 lakh records. I need to fetch 50000(for eg, this number may change ) records intially then the next 50000 records and so on , so that I never get a runtime error "memory low".
I can select the first 50000 records using "select up to " statement but once i select the first 50000 records how can i fetch the remainning records as parts.
Please help.Urgent.
Neeraj.Hi,
Use packaze size statement in select statement.
EX: This is syntax.
SELECT ... INTO|APPENDING [CORRESPONDING FIELDS OF] TABLE <itab> [PACKAGE SIZE <n>] ...
1. If you want first 50000 records and do the required functionality with those and refresh the 50000 records and go for next 50000 means use
SELECT CARRID CONNID
FROM SPFLI
INTO CORRESPONDING FIELDS OF TABLE ITAB
PACKAGE SIZE 50000.
ENDSELECT.
2. If you want to append all records means
SELECT CARRID CONNID
FROM SPFLI
INTO APPENDING FIELDS OF TABLE ITAB
PACKAGE SIZE 50000.
ENDSELECT.
Don't forghet to reward if useful.... -
Selecting Records from 125 million record table to insert into smaller table
Oracle 11g
I have a large table of 125 million records - t3_universe. This table never gets updated or altered once loaded, but holds data that we receive from a lead company.
I need to select records from this large table that fit certain demographic criteria and insert those into a smaller table - T3_Leads - that will be updated with regard to when the lead is mailed and for other relevant information.
My question is what is the best (fastest) approach to select records from this 125 million record table to insert into the smaller table. I have tried a variety of things - views, materialized views, direct insert into smaller table...I think I am probably missing other approaches.
My current attempt has been to create a View using the query that selects the records as shown below. Then use a second query that inserts into T3_Leads from this View V_Market. This is very slow. Can I just use an Insert Into T3_Leads with this query - it did not seem to work with the WITH clause? My Index on the large table is t3_universe_composite and includes zip_code, address_key, household_key.
CREATE VIEW V_Market as
WITH got_pairs AS
SELECT /*+ INDEX_FFS(t3_universe t3_universe_composite) */ l.zip_code, l.zip_plus_4, l.p1_givenname, l.surname, l.address, l.city, l.state, l.household_key, l.hh_type as l_hh_type, l.address_key, l.narrowband_income, l.p1_ms, l.p1_gender, l.p1_exact_age, l.p1_personkey, e.hh_type as filler_data, 1.p1_seq_no, l.p2_seq_no
, ROW_NUMBER () OVER ( PARTITION BY l.address_key
ORDER BY l.hh_verification_date DESC
) AS r_num
FROM t3_universe e
JOIN t3_universe l ON
l.address_key = e.address_key
AND l.zip_code = e.zip_code
AND l.p1_gender != e.p1_gender
AND l.household_key != e.household_key
AND l.hh_verification_date >= e.hh_verification_date
SELECT *
FROM got_pairs
where l_hh_type !=1 and l_hh_type !=2 and filler_data != 1 and filler_data != 2 and zip_code in (select * from M_mansfield_02048) and p1_exact_age BETWEEN 25 and 70 and narrowband_income >= '8' and r_num = 1
Then
INSERT INTO T3_leads(zip, zip4, firstname, lastname, address, city, state, household_key, hh_type, address_key, income, relationship_status, gender, age, person_key, filler_data, p1_seq_no, p2_seq_no)
select zip_code, zip_plus_4, p1_givenname, surname, address, city, state, household_key, l_hh_type, address_key, narrowband_income, p1_ms, p1_gender, p1_exact_age, p1_personkey, filler_data, p1_seq_no, p2_seq_no
from V_Market;I had no trouble creating the view exactly as you posted it. However, be careful here:
and zip_code in (select * from M_mansfield_02048)
You should name the column explicitly rather than select *. (do you really have separate tables for different zip codes?)
About the performance, it's hard to tell because you haven't posted anything we can use, like explain plans or traces but simply encapsulating your query into a view is not likely to make it any faster.
Depending on the size of the subset of rows you're selecting, the /*+ INDEX hint may be doing your more harm than good. -
How do I select rows from the same table that have multiple occurances
Hi Everybody,
I am trying to select records from a detail table by grouping it. The table has more than 1 million records and the query is not performing well. The basic question is how to select a distinct record from a table which matches all values in one column and any in the other.
desc SCV
ID NUMBER PK (ID + SCRID)
SCRID NUMBER FK(SC)
ID SCRID
1 1
2 1
3 1
4 2
5 2
6 3
7 4
8 4
desc PROJECTS
ID NUMBER PK
NAME VARCHAR2(100)
ID NAME
1 PROJECT1
2 PROJECT2
3 PROJECT3
4 PROJECT4
desc PJS
ID NUMBER
PROID NUMBER FK (PROJECTS)
SCRID NUMBER FK (SCV(SCRID + SCVID)
SCVID NUMBER
ID PROID SCRID SCVID
1 1 1 1
2 1 1 2
3 1 2 5
4 1 3 6
5 1 4 7
6 2 1 3
7 2 2 4
8 2 2 5
9 2 4 7
There are over 1 million records in PJS.
desc TBP
SCRID NUMBER
SCVID NUMBER
SCRID SCVID
1 1
1 2
1 3
2 4
2 5
3 6
4 7
4 8
The requirement is to select projects that have matching SCRID, SCVID from TBP such that
all distinct SCRID should match and within that and any SCVID match will do. (A "AND" between each SCRID and an "OR" for each SCVID in that SCRID like 'SCRID = 1 AND (SCVID = 1 OR SCVID = 2 OR SCVID = 3) AND SCRID = 2 AND (SCVID =....)
So, for the sample data it should return us PROID = 1
I have few queries written for this:
SELECT PROID FROM PJS,TBP WHERE TBP.SCVID = PJS.SCVID AND TBP.SCRID = 1
INTERSECT
SELECT PROID FROM PJS,TBP WHERE TBP.SCVID = PJS.SCVID AND TBP.SCRID = 2
INTERSECT
SELECT PROID FROM PJS,TBP WHERE TBP.SCVID = PJS.SCVID AND TBP.SCRID = 3
INTERSECT
SELECT PROID FROM PJS,TBP WHERE TBP.SCVID = PJS.SCVID AND TBP.SCRID = 4
This query performs well but the cost is very high, hardcoding, sorting.
The 2nd option is to:
SELECT pjs.PROID proid
FROM TBP tbp,
PJS pjs
WHERE pjs.SCVID = tbp.SCVID
AND pjs.SCRID = tbp.SCRID
GROUP BY pjs.PROID
HAVING COUNT(DISTINCT pjs.SCRID) = (SELECT COUNT(DISTINCT SCRID ) FROM TBP)
This has a low cost but runs slowly.
One more way I tried was with the IN operator like
SELECT DISTINCT PROID FROM PJS A,TBP T WHERE T.SCRID = 1 AND T.SCVID = A.SCVID
AND PROID IN (SELECT PROID FROM PJS A,TBP T WHERE T.SCRID = 2 AND T.SCVID = A.SCVID
AND PROID IN (...SO ON with each DISTINCT SCRID.
Again this involves too much of sorting.
Any help will be appriciated.
Thanks in advance.Hi Andrew,
Use DELETE t_itab statement inside the loop.
I have modified your code. It is perfectly working.See bellow -
LOOP AT it_zmember01 INTO wa_zmember01.
WRITE: / wa_zmember01-mnumber UNDER 'NUMBER',
wa_zmember01-mname UNDER 'NAME',
wa_zmember01-mdob UNDER 'DOB'.
WRITE / '-----------------------------------------------------------------'.
DELETE it_zmember01. " Modified
ENDLOOP.
DELETE it_zmember01. statement inside the loop will delete the current row of the table.
Regards
Pinaki -
Can i select Records from two tables into an itab.
Hi,
Suppose that i have two tables spfli and sflight.
Now i want the records from both the tables into a single internal table.
If so please let me know how this can be done.
itab should consist of all the columns in sflight and spfli.
Regards,
SaiSai,
Yes u can do it using JOINs.
Use this link for ref
http://www.sap-img.com/abap/inner-joins.htm
INNER JOIN results are an intersection of the tables being joined where in only if both the tables havethe data the result is pused onto the result set.
WHERE as in LEFT OUTR JOIN you can push the data of the LEF T table on the resultset even when the join condition is not met.
The use is that you wantto have all the data that is there in left table and also the right table if the join condition is a success then right table fileds will have data else they are initial.
OUTJOIN's are used in MAINTENANNCE VIEWS, HELP VIEWS .
INNER JOINS are used DATABSE VIEWS.
Inner Join:-
SELECT pcarrid pconnid ffldate bbookid
INTO CORRESPONDING FIELDS OF TABLE itab
FROM ( ( spfli AS p
INNER JOIN sflight AS f ON pcarrid = fcarrid AND
pconnid = fconnid )
INNER JOIN sbook AS b ON bcarrid = fcarrid AND
bconnid = fconnid AND
bfldate = ffldate )
WHERE p~cityfrom = 'FRANKFURT' AND
p~cityto = 'NEW YORK' AND
fseatsmax > fseatsocc.
Left Outer Join
SELECT scarrid scarrname p~connid
INTO CORRESPONDING FIELDS OF TABLE itab
FROM scarr AS s
LEFT OUTER JOIN spfli AS p ON scarrid = pcarrid AND
p~cityfrom = 'FRANKFURT'.
Reward if helpful,
Karthik -
Select record from database table
how to select a record from data-base table for current month in module-pool, i.e if current month is august then records selected should between 1/08/10 to 31/08/10.
And, i also want to select records for last month i.e if current month is august then records selected should be between 1/07/10 to 31/07/10.
And one thing more, it should work for every scenario. Like for months are changing then it should work according to that.
Example: If month changes to October then current month ll be October and last month ll become September.
Plz help me out.
Moderator message: you chose a better forum this time, but the question is still too basic to be asked here, please (re)search yourself first, these forums are not catering to beginners.
locked by: Thomas Zloch on Aug 8, 2010 9:41 PMHi Nishant,
You can use the option <b>ORDER BY </b> in your SELECT clause.
This is the SAP Documentation for <b>ORDER BY </b> option.
<i>Variant 1</i>
<b>...ORDER BY PRIMARY KEY</b>
<b>Effect</b>
Sorts the selected lines in ascending order by the primary key of the database table. This variant is only permitted for SELECT * ....
<i>Notes</i>
Since views do not have a primary key, specifying ORDER BY PRIMARY KEY only makes sense with database tables. If, however, you do specify ORDER BY PRIMARY KEY with a view, all fields of the view are sorted in ascending order.
<i>Variant 2</i>
<b>ORDER BY f1 ... fn</b>
<i>Effect</i>
Sorts the selected records in ascending order by the specified column references f1 ... fn. If a list is also specified in the SELECT clause, the column references f1, ..., fn must appear in this list.
By supplementing the statement with DESCENDING, you can sort in descending order using any of the fields f1, ..., fn.
The default sort sequence is ascending order, but you can make this explicit by adding the addition ASCENDING.
Consider this code this will select the latest 10 records form DB table(Note can use <b>Variant 2</b> for DB tables also.
REPORT zarun_1.
DATA : it_mara TYPE STANDARD TABLE OF mara WITH HEADER LINE.
START-OF-SELECTION.
SELECT * FROM mara
INTO TABLE it_mara
<b>UP TO 10 ROWS "No of rows you need(give 1 here)
ORDER BY matnr DESCENDING. "Specify the Key Fields here.</b>
LOOP AT it_mara.
WRITE : / it_mara-matnr,
it_mara-mtart.
ENDLOOP.
Regards,
Arun Sambargi.
Message was edited by: Arun Sambargi -
Selecting the last record from a database table
In my ABAP Program, I have to use a select statement to retrieve the last record from the database table with the same key. In other words, the Program will get more than one hit on the database table for the selected keys and I need to retrieve values from only the last record and not the first. I know I can use an internal table to sort the records first and then retrieve the right value. But to make things easier, is there a SELECT statement keyword than I can use to do this in one single step? Thanks!
hi,
tables:mara.
data: begin of it_mara occurs 0,
matnr like mara-matnr,
meins like mara-meins,
mtart like mara-mtart,
end of it_mara.
select-options:s_matnr for mara-matnr.
select matnr
meins
mtart
from mara
into table it_mara
where matnr in s_matnr.
if not it_mara[] is initial.
sort it_mara by matnr descending.
read table it_mara index 1.
endif.
then you get the last record of the select statement.
reward points if useful,
venkat. -
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> -
Performance problem with selecting records from BSEG and KONV
Hi,
I am having performance problem while selecting records from BSEG and KONV table. As these two tables have large amount of data , they are taking lot of time . Can anyone help me in improving the performance . Thanks in advance .
Regards,
PrashantHi,
Some steps to improve performance
SOME STEPS USED TO IMPROVE UR PERFORMANCE:
1. Avoid using SELECT...ENDSELECT... construct and use SELECT ... INTO TABLE.
2. Use WHERE clause in your SELECT statement to restrict the volume of data retrieved.
3. Design your Query to Use as much index fields as possible from left to right in your WHERE statement
4. Use FOR ALL ENTRIES in your SELECT statement to retrieve the matching records at one shot.
5. Avoid using nested SELECT statement SELECT within LOOPs.
6. Avoid using INTO CORRESPONDING FIELDS OF TABLE. Instead use INTO TABLE.
7. Avoid using SELECT * and Select only the required fields from the table.
8. Avoid nested loops when working with large internal tables.
9. Use assign instead of into in LOOPs for table types with large work areas
10. When in doubt call transaction SE30 and use the examples and check your code
11. Whenever using READ TABLE use BINARY SEARCH addition to speed up the search. Be sure to sort the internal table before binary search. This is a general thumb rule but typically if you are sure that the data in internal table is less than 200 entries you need not do SORT and use BINARY SEARCH since this is an overhead in performance.
12. Use "CHECK" instead of IF/ENDIF whenever possible.
13. Use "CASE" instead of IF/ENDIF whenever possible.
14. Use "MOVE" with individual variable/field moves instead of "MOVE-
CORRESPONDING" creates more coding but is more effcient. -
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 -
Download only selected record from ALV
Hi
I want to download only selected records from ALV output with button.
i hav to fix the button on ALV screen using &ZDL whenever user presses the button record should be downloaded.
Pl with coding
its very very urgent.Hi ,
i dont have the exact code which suits to your requirement
but declare the internal table
like
data: begin of itab occurs 0,
check type c,
fields
end of itab.
while filling the field catalog
fieldcatalog-checkbox = 'X'
for this check field.
and display the grid
now write this subroutine
*& Form USER_COMMAND
Called from within the ALV processes. Currently, '&IC1' is used
to process the hotspot and display the document 'picked' by the
user.
PV_UCOMM contains the sy-ucomm from ALV
SELFIELD is a structure that contains all the data required to
process a user selection. The following is an example
of the SELFIELD structure and sample values:
FORM USER_COMMAND USING PV_UCOMM LIKE SY-UCOMM
SELFIELD TYPE SLIS_SELFIELD.
CASE PV_UCOMM.
WHEN '&IC1'.
loop at itab where check = 'X'.
append all these records to another internal table itab1
endloop.
call function gui_download.
pass the internal table itab1 in the tables statement
and also you have to give the file path that may be static or dynamic
if dynamic you have to call the function module
f4_filename
and get the filename and pass the same value to gui_download
that will be download to the above said path
endcase.
end form.
reward points if helpful,
thanks & regards,
venkatesh -
Select records from one database and insert it into another database
Hi
I need to write a statement to select records from one database which is on machine 1 and insert these records on a table in another database which is on machine 2. Following is what I did:
1. I created the following script on machine 2
sqlplus remedy_intf/test@sptd @load_hrdata.sql
2. I created the following sql statements in file called load_hrdata.sql:
rem This script will perform the following steps
rem 1. Delete previous HR data/table to start w/ clean import tables
rem 2. Create database link to HR database, and
rem 3. Create User Data import table taking info from HR
rem 4. Drop HRP link before exiting
SET COPYCOMMIT 100
delete from remedy.remedy_feed;
commit;
COPY FROM nav/donnelley@hrp -
INSERT INTO remedy.remedy_feed -
(EMPLID, FIRST_NAME, MI, LAST_NAME, BUSINESS_TITLE, WORK_PHONE, -
RRD_INTRNT_EMAIL, LOCATION, RRD_OFFICE_MAIL, RRD_BUS_UNIT_DESCR) -
USING SELECT EMPLID, FIRST_NAME, MI, LAST_NAME, BUSINESS_TITLE, WORK_PHONE, -
RRD_INTRNT_EMAIL, LOCATION, RRD_OFFICE_MAIL, RRD_BUS_UNIT_DESCR -
FROM ps_rrd_intf_medium -
where empl_status IN ('A', 'L', 'P', 'S', 'X')
COMMIT;
EXIT;
However, whenever I run the statement I keep getting the following error:
SP2-0498: missing parenthetical column list or USING keyword
Do you have any suggestions on how I can fix this or what am I doing wrong?
Thanks
AliThis doesn't seem to relate to Adobe Reader. Please let us know the product you are using so we may redirect you or refer to the list of forums at http://forums.adobe.com/
-
I HAVE A SOURCE TABLE WITH 10 RECORDS AND TARGET TABLE 15 RECORDS. MY QUESTION IS USING WITH THE TABLE COMPARISON TRANSFORM .I WANT TO DELETE UNMATCHED RECORDS FROM THE TARGET TABLE ?? HOW IT IS ??
Hi Kishore,
First identify deleted records by selecting "Detect deleted rows from comparison table" feature in Table Comparison
Then Use Map Operation with Input row type as "delete" and output row type as "delete" to delete records from target table. -
Deleting records from a recursive table query
Hi All,
I have the follow query, I would like to ask for your help, please: we use recursive tables for various purposes and one of them may have 100,000's records.
What would be the best approach to delete records from such a table?
I was thinking about two below, but any additional one will be more than welcome as well:
(1) I can DELETE FROM my_table WHERE my_table_id IN (SELECT my_table_id FROM my_table START WITH my_table_parent_id = X CONNECT BY PRIOR my_table_id = my_table_parent_id, but it means that I will run on my_table twice, no?
(2) I thought also to create a Foreign Key of my_table_id REFERENCES my_table_parent_id, but then I am afraid it will effect DML commands on that table.
Thank you in advanceHi,
kdwolf wrote:
... (1) I can DELETE FROM my_table WHERE my_table_id IN (SELECT my_table_id FROM my_table START WITH my_table_parent_id = X CONNECT BY PRIOR my_table_id = my_table_parent_id, but it means that I will run on my_table twice, no?Sorry, I'm not sure whqt you mean by "I will run on my_table twice". Assuming you don't already have a foreign key constraint (as you described below) I don;t know any other way, let alone a more efficient way, to get the same results.
(2) I thought also to create a Foreign Key of my_table_id REFERENCES my_table_parent_id, but then I am afraid it will effect DML commands on that table.You're right; a foreign key constraint always costs a little whenever you do DML. Someone who knows your application and your system as well as you do will have to decide if the benefit of having accurate, consistent data justifies that additional cost. If you're not sure, I suggest you add the constraint.
One advantage of having a foreign key constraint is that you can create it with the "ON DELETE CASCADE" option. Then, if you simply say "DELETE FROM my_table WHERE my_table_patrent_id = X", all the descendants of those rows will automatically be deleted, exactly as you requested in (1) above.
Maybe you are looking for
-
Why can't I rent a movie from iTunes on my Macbook Pro?
I am trying to rent a movie from iTunes on my Macbook Pro but when I click on the gray rent movie button it does NOTHING, like I never clicked on it. I am signed in, I authorized the computer and have rented movies in the past. I do have OS X 10.5
-
Urgent : Soap Receiver Adapter
Hi Im using SOAP adapter on receiver side to call a web service. Initialy when i tried my end to end scenario I got the following error - 2007-08-07 05:30:57 Error Delivery of the message to the application using connection SOAP_http://sap.com/xi/XI/
-
File.applicationDirectory.resolvePath fails to return the correct path in iOS
I have click.mp3 file in "assets/sounds/" directory. When I try to load a sound like below, both works fine when testing on my PC but when deployed on iOS(my iPad2), #1 works but #2 will result in no sound. Am I doing something wrong? I'm using Adobe
-
Engineering BOM and production BOM-very critical help
Hello All, I am working for a client and below is the requirement, please guide me. 1) Customer has 2 department here one is engg and other is production as usual. 2) He needs BOMs only for 2 purposes a) For R and D b) Production. 3) He needs any ch
-
SAP IS-U Upgrading 4.6B to ECC 6.0
Hi Does any one has documentation about upgrade and problem fixing in Upgrading from 4.6B to ECC 6.0 in ISU and about problems and errors with BPME/EMMA? Best Regards Luis Jesus