Help for Pl/SQL Logic & Syntax used
Hi, in Ivan Bayross' book, following example is given illustrating use of triggers.
Create trigger audit_trail
After update or delete on customer
for each row
DECLARE
oper VARCHAR(20);
BEGIN
If updating then
oper :='UPDATE';
End if;
If deleting then
oper :='DELETE';
End if;
Insert into audit_cust
Values(*:OLD.CUST_NO* , *:OLD.FNAME* );
END;
Questions :*
1. Why : symbol is used in insert query above? Viz. :OLD.CUST_NO
what does it indicate ?? ALso, what does . ( dot operator) indicates?
OLD is not table name.
2. In the program above what does this line mean??
If deleting then
oper :='DELETE';
End if;
We are just assigning value 'DELETE' to oper variable ?? or something else??
Hi,
So, still struggling on Ivan's book, eh ;-) ?
1. :OLD and :NEW means you can refer to the old and new column values.
They are only usable in triggers.
So, if you're updating column X from 1 to 2, the value of :OLD.X = 1 and :NEW.X = 2 in your trigger only.
http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/triggers.htm#CNCPT118
http://www.oracle.com/pls/db102/search?word=TRIGGER&partno=
We are just assigning value 'DELETE' to oper variable ?? or something else??I guess the autor meant do do this:
Create trigger audit_trail
After update or delete on customer
for each row
DECLARE
oper VARCHAR(20);
BEGIN
If updating then
oper :='UPDATE';
End if;
If deleting then
oper :='DELETE';
End if;
Insert into audit_cust
Values( :OLD.CUST_NO, : OLD.FNAME, oper );
END;He probably forgot to insert the oper variable in his audit table,
Similar Messages
-
Creating webservice for pl/sql API without using BPEL
Hi All,
Using BPEL, We have created partner links using DB Adapter for accessing our pl/sql API's.
Is there any way to create a web service for a pl/sql API having complex datatype parameters like (Record, table of records etc) using DB Adapter or any other tool without using BPEL?
Thanks,
Uma.We introduced the use of JPublisher to automate the generation of wrappers for PL/SQL procedures that use types such as boolean, record and table. The wizard will invoke JPub and generate artifacts that the partnerlink will use to invoke the wrapper instead of the original API. Boolean is replaced by INT, record is replaced by an object type and table is replaced by a nested table. The wrapper will invoke the original API. JPub also takes care of converting between the different types (i.e. record <-> object).
-
SQL logic help for pl/sql block
Hi All,
I need your suggestions and comments for the below issue:
I have two tables: table A and table B
Table A has two columns as id and counts:
Id Counts
99 10
999 13
9999 7
Table B has two columns as Id and order:
Id Order
99 1
999 2
9999 3
We need to update Order in Table B such that Id having highest count in table A has Order as 1 in table B and it keep on increasing the order for other Ids based on decreasing counts in table A. This will be like a job which will run daily and look for counts in table A and update Order in table B according to it.
It seems to be simple but i am not getting it. Please help me out of this by writing some PL/SQL block.
I will really appreciate your all comments and responses.
Regards
DevHi,
Keen2Learn wrote:
Hi All,
I am really greatful to all fo you for all your replies and comments. I change ORDER table to ORDERS. All you replies worked for me but there is some slight change in scenario which i need to discuss with you all.
E.g: Table A has 10 rows like below:
Id Counts Type
99 10 A
999 13 A
9999 7 C
99 4 B
999 2 C
88 2 A
77 1 C
777 3 B
777 5 A
888 2 CIf you'd like help, please post CREATE TABLE and INSERT statements for your sample data (including table b as it is before the UPDATE or MERGE).
I populate data in Orders column Table B based on id, by grouping sum of counts for that id in table A.
Id 999 has highest sum(count) as 15, so it has orders as 1 in Table B and do same for descending counts for each Id.
Table B has 5 rows like below:
Id Orders
99 2
999 1
88 4
777 3
555 5
Assume Table B as static(no new record comes in it) but only its Orders changes for each Id based on counts for that Id in Table A. As you see, Table B has id 555 which is not in Table A, so we need to update its orders to the highest number by taking its Count as 0(zero). Sorry, it's unclear what you want to do.
Post what you'd like table b to look like after the UPDATE or MERGE.
Right now i am doing it like this:
declare
cursor c1 is
select Id, SUM (COUNT), RANK () OVER (ORDER BY SUM (COUNT)) rnk
from TableA AND Id IN (SELECT Id FROM TableB)
GROUP BY Id
ORDER BY rnk DESC;
i NUMBER := 1;
begin
for curr in c1
loop
update TableB
set orders = i
where id = curr.id;
i := i + 1;
end loop;
end;I'm not sure what you're trying to do, but I'll bet you don't need PL/SQL to do it. Use a single UPDATE or MERGE statement (inside PL/SQL if necessary).
But it is not updating orders for Id 555 in TableB.There is no row for id=555 in table b, and, according to your requirements, there never will be, because "Table B as static(no new record comes in it)". It's behaving exactly as you said you wanted it to. What's the problem?
Please provide your suggesstions on what needs to be done to take care of this scenario. I will really appreciate your all suggesstions and comments. Please let me know if need some more explanation.Whenever you have a problem, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and the results you want from that data.
In the case of a DML operation (such as UPDATE) the sample data should show what the tables are like before the DML, and the results will be the contents of the changed table(s) after the DML.
Explain, using specific examples, how you get those results from that data.
Always say what version of Oracle you're using. -
Help for Job BDLS - Logical System Conversion aftrer System Refresh
hi SAP Basis Gurus,
We have restored production data to test system. After that we are doing Logical System conversion - Renaming of Logical System Names. For that we are running BDLS job. The program used is IBDLS2LS.
Now one job is running for more than 200000 seconds. Job is doing "Sequential Read" on table ZARIXCO40. The following has been updated in the jobs log:
01.02.2008 10:20:06 Processing table ZARIXCO40
02.02.2008 01:59:56 Processing table ZARIXCO40
02.02.2008 22:26:44 Processing table ZARIXCO40
02.02.2008 23:04:05 Processing table ZARIXCO40
So as per above log, it looks like job got stuck in loop for table 01.02.2008 10:20:06 Processing table ZARIXCO40.
The oracle Session is showing following SQL Statement:
SELECT
/*+
FIRST_ROWS
FROM
"ZARIXCO40"
WHERE
"MANDT" = :A0 AND "LOGSYSTEM" = :A1 AND ROWNUM <= :A2#
~
Execution Plan is :
~
Execution Plan
Explain from v$sql_plan: Address: 00000003A2FD5728 Hash_value: 2772869435 Child_number: 0
SELECT STATEMENT ( Estimated Costs = 4.094.270 , Estimated #Rows = 0 )
3 COUNT STOPKEY
2 TABLE ACCESS BY INDEX ROWID ZARIXCO40
( Estim. Costs = 4.094.270 , Estim. #Rows = 32.799.695 )
1 INDEX RANGE SCAN ZARIXCO40~0
( Estim. Costs = 418.502 , Estim. #Rows = 65.599.390 )
Search Columns: 1
~
Table has been analyzed today. See the details below:
~
Table ZARIXCO40
Last statistics date 02.02.2008
Analyze Method mple 16.623.719 Rows
Number of rows 65.599.390
Number of blocks allocated 2.875.670
Number of empty blocks 7.912
Average space 934
Chain count 0
Average row length 313
Partitioned NO
UNIQUE Index ZARIXCO40~0
Column Name #Distinct
MANDT 1
KOKRS 14
BELNR 2.375.251
BUZEI 1.000
~
Index used for this table is also analyzed today:
~
UNIQUE Index ZARIXCO40~0
Column Name #Distinct
MANDT 1
KOKRS 14
BELNR 2.375.251
BUZEI 1.000
Last statistics date 02.02.2008
Analyze Method mple 24.510.815 Rows
Levels of B-Tree 3
Number of leaf blocks 418.499
Number of distinct keys 65.480.722
Average leaf blocks per key 1
Average data blocks per key 1
Clustering factor 40.524.190
~
Can you please let me know what could be the issue and how to resolve this issue so that job gets completed. Normally this job runs for 1,00,000 seconds. I can not afford to cancel this job and run again.
Any help is Highly appreciated,
Thanks
Best Regards,
Basis CKHi Markus,
The stastics of the table is already updated today. After that also it is not going faster. It is doing "Sequential Read" for more than 5 hours and then one update is issued. And in the job log, all other tables are preocess only once, only this table is selected to processed 4 times which is very abnormal.
01.02.2008 07:43:59 Processing table ZARIXCO11
01.02.2008 07:45:36 Processing table ZARIXCO16
01.02.2008 10:17:20 Processing table ZARIXCO21
01.02.2008 10:20:06 Processing table ZARIXCO26
01.02.2008 10:20:06 Processing table ZARIXCO29
01.02.2008 10:20:06 Processing table ZARIXCO33
01.02.2008 10:20:06 Processing table ZARIXCO37
01.02.2008 10:20:06 Processing table ZARIXCO40
02.02.2008 01:59:56 Processing table ZARIXCO40
02.02.2008 22:26:44 Processing table ZARIXCO40
02.02.2008 23:04:05 Processing table ZARIXCO40
~
I guess this will keep on going like this and not sure when it gets complete. Any other thing you can suggest which help to resolve the issue.
Thanks
Best Regards,
Basis CK -
Need help in this sql query to use Case Statement
hi All,
I have the below query -
SELECT DISTINCT OFFC.PROV_ID
,OFFC.WK_DAY
,CASE
WHEN OFFC.WK_DAY ='MONDAY' THEN 1
WHEN OFFC.WK_DAY ='TUESDAY' THEN 2
WHEN OFFC.WK_DAY ='WEDNESDAY' THEN 3
WHEN OFFC.WK_DAY ='THURSDAY' THEN 4
WHEN OFFC.WK_DAY ='FRIDAY' THEN 5
WHEN OFFC.WK_DAY ='SATURDAY' THEN 6
WHEN OFFC.WK_DAY ='SUNDAY' THEN 7
END AS DOW
,OFFC.OFFC_OPENG_TIME
,OFFC.OFFC_CLSNG_TIME
FROM GGDD.PROV_OFFC_HR OFFC
WHERE OFFC.PROV_ID='0000600'
WITH UR;
this query is bringing results in 6 differnt rows with opening and closing time for each day separately. I want to generate the data in one row with each day having opening and closing time, so for 7 days, total 14 columns with opening and closing time. But i am not able to do that using case statement.
can somebody help me in achieving that.
thanks,
iamhereHi,
Welcome to the forum!
That's called a Pivot .
Instead of having 1CASE expression, have 14, one for the opening and one for the closing time each day, and do GROUP BY to combine them onto one row.
SELECT OFFC.PROV_ID
, MIN (CASE WHEN OFFC.WK_DAY ='MONDAY' THEN OFFC.OFFC_OPENG_TIME END) AS mon_opn
, MIN (CASE WHEN OFFC.WK_DAY ='MONDAY' THEN OFFC.OFFC_CLSNG_TIME END) AS mon_cls
, MIN (CASE WHEN OFFC.WK_DAY ='TUESDAY' THEN OFFC.OFFC_OPENG_TIME END) AS tue_opn
, MIN (CASE WHEN OFFC.WK_DAY ='TUESDAY' THEN OFFC.OFFC_CLSNG_TIME END) AS tue_cls
FROM GGDD.PROV_OFFC_HR OFFC
WHERE OFFC.PROV_ID = '0000600'
GROUP BY offc.prov_id
;This assumes there is (at most) only one row in the table for each distinct prov_id and weekday. If not, what do you want to do? Post a little sample data (CREATE TABLE and INSERT statements) and the results you want from that data.
The staement above works in Oracle 8.1 and up, but there's a better way (SELECT ... PIVOT) available in Oracle 11. What version are you using? (It's always a good idea to include this when you post a question.)
Edited by: Frank Kulash on Jan 6, 2011 8:22 PM -
need help on this to performance better.
DECLARE
FILE_READ UTL_FILE.FILE_TYPE;
LOCATION VARCHAR2(128):='D:\PLSQL';
FILENAME VARCHAR2(128):='TEST.txt';
OPEN_MODE VARCHAR2(128):='r';
V_LINE VARCHAR2(128);
V_ORDERCODE CHAR(15);
V_REST CHAR(100);
V_OWNERCODE CHAR(5);
CURSOR C_ORD IS
SELECT ORD.ORDERID,ORD.OWNERID
FROM ORDERS ORD,OWNERS OWN
WHERE ORD.ORDERCODE=V_ORDERCODE
AND ORD.OWNERID=OWN.OWNERID
AND OWN.OWNERCODE=V_OWNERCODE
AND ORD.STATUS=10
ORDER BY ORD.SEQ DESC;
R_ORD C_ORD%ROWTYPE;
BEGIN
FILE_READ:=UTL_FILE.FOPEN(LOCATION,FILENAME,OPEN_MODE);
LOOP
BEGIN
UTL_FILE.GET_LINE(FILE_READ,V_LINE);
EXCEPTION
WHEN NO_DATA_FOUND THEN
EXIT;
END;
V_OWNERCODE:=RTRIM(SUBSTR(V_LINE,0,5));
V_ORDERCODE:=SUBSTR(V_LINE,7,15);
V_REST:=SUBSTR(V_LINE,23,LENGTH(RTRIM(LTRIM(V_LINE))));
OPEN C_ORD;
FETCH C_ORD INTO R_ORD;
IF C_ORD%FOUND THEN
UPDATE ORDERS SET UNDEF10=RTRIM(V_REST) WHERE ORDERCODE=V_ORDERCODE AND OWNERID=R_ORD.OWNERID;
END IF;
CLOSE C_ORD;
END LOOP;
UTL_FILE.FCLOSE(FILE_READ);
EXCEPTION
WHEN UTL_FILE.INVALID_MODE THEN
RAISE_APPLICATION_ERROR(-20001,'INVALID_MODE');
WHEN UTL_FILE.READ_ERROR THEN
RAISE_APPLICATION_ERROR(-20002,'READ_ERROR');
WHEN UTL_FILE.INVALID_PATH THEN
RAISE_APPLICATION_ERROR(-20003,'INVALID_PATH');
WHEN UTL_FILE.INVALID_FILEHANDLE THEN
RAISE_APPLICATION_ERROR(-20004,'INVALID_FILEHANDLE');
WHEN UTL_FILE.INVALID_OPERATION THEN
RAISE_APPLICATION_ERROR(-20005,'INVALID_OPERATION');
WHEN UTL_FILE.WRITE_ERROR THEN
RAISE_APPLICATION_ERROR(-20006,'WRITE_ERROR');
WHEN UTL_FILE.INTERNAL_ERROR THEN
RAISE_APPLICATION_ERROR(-20007,'INTERNAL_ERROR');
WHEN OTHERS THEN
RAISE_APPLICATION_ERROR(-20008,SQLERRM);
END;My obersvations for poor performance (although you have not defined what is "poor")
1. Why ORDER BY in cursor ?
2. Why CURSOR itself ?
It seems to me that all you are doing is checking whether the SQL (in cursor) returns any data. If yes, yo are updating ORDERS table. You should be able to eliminate cursor entirely. That will save all processing on cursor.
If you can explain (in english) what you are trying to achieve, I may be able to provide better solution. -
Search Help for field of standard table used on non standar report
Hi all.
I need to know whether is posible to set up a "Search Help" / "Matchcode" for one standard field (LFBK-BKTVP) of a standard table (LFBK) that is going to be used on the selection screen of one new non standard report ZFK01.
I was wondering if this could be posible under any special attributes, set up, ... for this field in the corresponding screen, but do not really know nor if that would work neither what to set up. Any other workaround would also be welcome.
Could somebodly help?
Thanks in advance. Regards,
AbdaliHi ,
Please try this code .It is working as per your requirement.
*& Report ZTESTPRO4 *
REPORT ztestpro4.
TYPES:BEGIN OF ty_lfbk,
bvtyp TYPE lfbk-bvtyp,
END OF ty_lfbk.
DATA:gt_lfbk TYPE STANDARD TABLE OF ty_lfbk,
gs_lfbk TYPE ty_lfbk.
PARAMETERS:bank TYPE lfbk-bvtyp.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR bank.
SELECT bvtyp
FROM lfbk
INTO TABLE gt_lfbk.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'BVTYP'
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'bank'
value_org = 'S'
TABLES
value_tab = gt_lfbk. -
Good source for learning - SQL Stored Proceedures using Dreamweaver
I am looking for a good source for learning how to integrate
Stored
Proceedures using Dreamweaver?
Is there a book or something online?
ThanksHey Lee,
You find yourself in that position, I find myself in that
position, every
damn developer/programer in the world find themselves in that
position. It
may be on different levels, but everyones in the same boat.
Here is my suggestion. Take the existing knowledge you have,
pick a
technology that is a bit more futureproof (if the one you
have is getting
outdated) and one that isn't too far removed from the one you
know and put
it all into that one area.
Databases are really important if you want to be a decent web
developer. If
you're serious and want to be good then devote time to a
particular database
and get to know it well. I would suggest SQL Server. You
don't have to be
DBA standard but get as much knowledge on it as you can.
Never underestimate
your required knowledge of databases.
Set yourself goals. Say to yourself "In 6 months I want to be
a proficient
developer in this language" and go for it. Don't get
side-tracked into
something else just keep focused on one area and get good at
it. Yes, that
language will become outdated in time but you will be all the
more ready to
take on the next because of your past experiences.
I try to look at it like this; It is better to a master of
one technology
and know enough to get by in others than a Jack of all
technologies but a
master of none.
Pat.
"lee" <[email protected]> wrote in message
news:[email protected]...
> Thanks Pat...I only looked at it briefly but it looks
like what I needed.
>
> The biggest problem that I have is that I don't have
enough time to look
> into some of this stuff...
>
> Over the years, I've gotten to a certain level of
proficiency in certain
> things, I can do quite a bit but there always seems to
be yet another
> technology to master as the Old Ways go away.
>
> To be honest, I really just want to be an artist with
some programming
> skills but the nature of this position demands that I
"learn It all."
>
> Meanwhile, all those other skills have to be put
asside...I really should
> master flash...I really should work on my illustration
skills...I really
> should master CSS. I really should master...I don't
know, name it. And if
> I really wanted to abandon my ...LIFE...I could,
perhaps, figure it all
> out.
>
> What is so tiring is that my skill set is stretched SO
f-ing thin that I
> can never, possibly catch up. The only cure is time but
often even that
> goes against me.
>
> Anyways, thanks for the link. I'll probably be back
later with questions.
>
> Thanks Pat.
>
> If anyone else finds a good source, let me know.
>
> -
How to find help for Apple Mail password problem -- using CLEAR/Verizon
I've established an alias e-mail address through Apple Mail. I've lost the password. Apple "Help" tells me to ask internet provider. But I only have a cell phone so Verizon doesn't allow me to ask my question. I use CLEAR to connect through Verizon.
This is confusing. I don't know where to go with this issue.What is the domain for the email address? You need to get help from the email provider.
If a forum member gives an answer you like, give them the Kudos they deserve. If a member gives you the answer to your question, mark the answer as Accepted Solution so others can see the solution to the problem.
"All knowledge is worth having." -
firefox 4 is not compatible with norton antivirus program. i need a solution for this
mohanSymantec need to update their Firefox add-ons so that they are compatible with Firefox 4. They have indicated that for Norton 360 they plan to release an update to Norton 360 to support Firefox 4 in early May - http://us.norton.com/support/kb/web_view.jsp?wv_type=public_web&docurl=20100720113635EN&ln=en_US
I do not know about the time scale for updates for other Norton products. Pending the update by Symantec, if you want to use the Norton add-ons you will need to downgrade to Firefox 3.6.
The core Norton components such as antivirus and firewall will still work, it will just be the add-ons that are not currently compatible.
To downgrade to Firefox 3.6 first uninstall Firefox 4, but do not select the option to "Remove my Firefox personal data". If you select that option it will delete your bookmarks, passwords and other user data.
You can then install the latest version of Firefox 3.6 available from http://www.mozilla.com/en-US/firefox/all-older.html - it will automatically use your current bookmarks, passwords etc.
To avoid possible problems with downgrading, I recommend going to your profile folder and deleting the following files if they exist - extensions.cache, extensions.rdf, extensions.ini, extensions.sqlite and localstore.rdf. Deleting these files will force Firefox to rebuild the list of installed extensions, checking their compatibility, and reset toolbar customizations.
For details of how to find your profile folder see https://support.mozilla.com/kb/Profiles -
Please help with the sql logic
The below is going to be a record set from for a view from the FROM CLAUSE
1. Find component DOCUMENT where the document type = Square Metres (DOC.UOM_STD_ID = 'METR_MTR) If any components are found, retrieve the Document records for these components ONLY.
2. Otherwise, if no components exist with a Document type = Square Metres, look for components with a Document type of Acres (DOC.UOM_STD_ID = 'ACRE'). If found, retrieve the Space Lease records for these components ONLY.
3. Otherwise, if the Document does not have components with a type = Square Metres or Acres, look for components with the type of (DOC.UOM_STD_ID = 'PARK'). Then retrieve the departments associated with these parking components.
For Space Lease records above, retrieve the associated Org ID (SPACE.SPORG).
Return all departments where
the associated Org Type (ORG.ORGCLASS) = 'NON'
or the associated Org Type (ORG.ORGCLASS) = 'GD'
Thank youmaybe something like:
SQL> select emp.empno, emp.ename, emp.deptno
2 from emp,
3 (select case when (select 1 from emp where deptno = 10 and rownum = 1) = 1 then 1
4 when (select 2 from emp where deptno = 60 and rownum = 1) = 2 then 2
5 else 3
6 end case_col
7 from dual) d1
8 where deptno = decode(d1.case_col,1,10,
9 2,60,
10 3,70);
EMPNO ENAME DEPTNO
7839 KING 10
7782 CLARK 10
7934 MILLER 10
SQL> in you code it will be something like:
select ...
from document t1,
(select case when (select 1 from document doc where DOC.UOM_STD_ID = 'METR_MTR' and rownum = 1) = 1 then 1
when (select 1 from document doc where DOC.UOM_STD_ID = 'ACRE' and rownum = 1) = 2 then 2
else 3
end case_col
from dual) d1
where t1.uom_std_id = decode(d1.case_col,1,'METR_MTR',
2,'ACRE',
3,'PARK',
null);note: untested -
Need help for the sql statement !!!!!
hi all,
i need a sql statement for a query, how can i get the result from the rownum between 100 and 150?
plz helpuse a scrollable statement:
PreparedStatement stat = Connection.prepareStement("select * from blah", ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_UPDATABLE);
ResultSet rs = stat.executeQuery();
rs.absolute(100);
while (rs.next()) {
String something = rs.get(1);
Look into the JDK API reference for ResultSet to get an expalantion of scrollable statements. -
Hi all
I am new to oracle.Can anybody suggest me the books,websites to practise procedure,cursor,triggers,function,packages.specially assignments on thishttp://www.oracle.com/pls/db112/portal.portal_db?selected=1&frame=#developer_essentials
http://asktom.oracle.com
http://www.sqlsnippets.com/en/home.html -
Request help for purchasing HD webcams using iMac, OSX &Lion
I am requesting help for purchasing a HD webcam using iMac, OSX &Lion. Any suggestions would help. The following is what I've done so far...
I purchased Logitech's HD C910 webcam. It was a mess in requards to freezing up, no zoom and most of all no adjustments in: contrast, hue, color, etc. You're stuck just like a car with no engine or wheels who wants that. The other Logitech products i.e. Pro 9000 is being discontinued with no software updates in the future and the same with the other products. Most of the other manufactures do not provide software that is really compatible provideing true HD with full features. I'm willing to spend around $199,00 or so. Any suggestions?Well I found my own answer to the webcam concern that I had ....I bought the Logitech C-910...Yes, I know the Logitech states their software is not compatible with OS X ...That's OK, I only use the basics supplied by Logitech to open the cam...Logitech does supply HD settings which are useful. I like the wide angle which is there to play around. Then I use a software program called "Webcams Settings" found at Apple's App Store. There is a small charge for this download but more than worth it to have a fully functioning system. The best way to get there is obliviously via your "Dock." Click on the icon and type in "Webcam Settings" in the top right portion of the page and presto....you have all the goodies to play like a professional. i.e.: zoom, pan, tilt, aperture. etc. of course your webcam camera(s) must have the capability to perform these options in order to use them.
Note I have used my webcam for everything you can imagine and have a 60 foot cord (several cords linked together) to go outside (LOL) 'Just love the goodies with "Webcam Settings". I take outstanding pics too if I do say so, please. Funny, I rarely use my cam to Skype but knowing the option is there for me anytime I wish. I my cam to photograph orchids and misc. even portraits and family play photos with my tripod in hand. Just because there is a big road block in your path doesn't mean there aren't other avenues. In the corporate life it's called take a negative and make it a positive or else.......and if you have to gripe then you better have an idea on how to turn it around. -So- I did Logitech and Apple. -
Help asked for a sql request - thanks
Hello,
I'm not a sql Guru... Who can help for this sql request ?
First I have this:
SELECT ADDINFO_ID, INFO, LANGUAGE_FK, ENGLISH_NAME
FROM V_ADDINFOS
WHERE LANGUAGE_FK = 'EN' (which is very simple...-)
But now complicated... I have to add this in the same request:
select sum(val) as nbrInfo
from(
select count(*) val from eccgis where addinfo1_fk = ADDINFO_ID
union all
select count(*) val from eccgis where addinfo2_fk = ADDINFO_ID
union all
select count(*) val from eccgis where addinfo3_fk = ADDINFO_ID
union all
select count(*) val from thirdgis where addinfo1_fk = ADDINFO_ID
union all
select count(*) val from thirdgis where addinfo2_fk = ADDINFO_ID
In other words, for each row of the first select, I need to know how much it is linked in the tables eccgis and thirdgis...
Hope is is clear... -)
Thank you very very much,
MichelHi, Michel,
Almost anywhere that SQL allows an expression (such as a column name, literal or function call) it also allows a scalar sub-query, a SELECT statement based on any table (or tables) that returns one column and (at most) one row. Like other sub-queries, scalar sub-queries can be corellated to the main query.
To get the grand total you want on each row of your output:
SELECT ADDINFO_ID, INFO, LANGUAGE_FK, ENGLISH_NAME
, (select count(*) from eccgis where addinfo1_fk = ADDINFO_ID)
+ (select count(*) from eccgis where addinfo2_fk = ADDINFO_ID)
+ (select count(*) from eccgis where addinfo3_fk = ADDINFO_ID)
+ (select count(*) from thirdgis where addinfo1_fk = ADDINFO_ID)
+ (select count(*) from thirdgis where addinfo2_fk = ADDINFO_ID)
AS nrbInfo
FROM V_ADDINFOS
WHERE LANGUAGE_FK = 'EN';VERY IMPORTANT: Each sub-query must be in parentheses. You'll get a run-time error if any scalar sub-query returns more than one row. (Returning no rows is okay: the value will be NULL).
By the way, this looks like a bad table design. If each row in eccgis or thirdgis can be associated with more than one foreign key, they should be kept in a separate table. That's the standard way to handle many-to-many relationships.
Maybe you are looking for
-
Printing issues with D1455 and Airport express
Hi, I'm having problems printing with an HP Deskjet D1455 and the airport express. The printing always halts after printing half the page. Attached is another post related with this problem: "HI, i just purchased the Deskjet 1455 and connected to the
-
Datagrid Checkbox item renderer Issue.
Hi There Recently I faced a requirement to have a checkbox inside a datagrid where I need to develop a music module with playlist management for ADOBE AIR based application. For this I have searched and found a source to use Datagrid and Checkbox co
-
Hi, Anyone know the code for find/change command on text for specific pages? Example: I want to change some text from page 20 to 40 - Please help
-
Hi All, I have the requirement where i need to give error msg then i have to go the last screen. I am implementing a customer exit in i check for vendor if it is initial then i have to give error msg and then i have to go the first screen(whose scree
-
What are the pre instaled softwares in a macbook pro?
pls let me know what are the pre instaled softwares in a mac? jose jacob