Why is this query working??
According to the rules of GROUP BY statement, this query shoun't work
SELECT e.secction_id,
COUNT(*) AS num,
(SELECT s.capacity FROM section S WHERE E.section_id=S.section_id ) capacity
FROM enrollment e
GROUP BY e.section_id
The column capacity is obtained from a correlated subquery, it is not a group function. I made this query , it gives correct results, but after a while i recognized that it doesn't follow the rules of group by statements.
Thanks in advance.
Edited by: chg78 on 16-mar-2011 2:11
Edited by: chg78 on 16-mar-2011 2:11
chg78 wrote:
SELECT e.secction_id,
COUNT(*) AS num,
(SELECT s.capacity FROM section S WHERE E.section_id=S.section_id ) capacity
FROM enrollment e
GROUP BY e.section_idThe column capacity is obtained from a correlated subquery, it is not a group function. I made this query , it gives correct results, but after a while i recognized that it doesn't follow the rules of group by statements.The query fetching collumn capacity is executed for each row of the outer query. So this is a ugly but valid statement.
bye
TPD
Similar Messages
-
Why doesnt this query work on CF when it works fine on MYSQL?
Topic says it all. I can run this through mysql console and
get the result i need but when i place it inside a cfquery it wont
process.
SET @saldo=20000;
SELECT
IF(co.transtipo=0,@saldo:[email protected],@saldo:=@saldo+t.transmonto),
@saldo:[email protected],
t.transid,
t.cuentaid,
t.operacionid,
t.fechatrans,
t.voucher,
t.cheque,
t.transtitular,
t.transmonto,
t.transdetalle,
t.modificado,
co.transtipo,
co.operacion
FROM cuentastrans t
LEFT JOIN cuentasoperacion co ON
t.operacionid=co.operacionid
WHERE t.cuentaid= 7
ORDER BY t.fechatrans ASCThank you for the info, here is my robust:
[Table (rows 30 columns
IF(CO.TRANSTIPO=0,@SALDO:[email protected],@SALDO=@SALDO+T.TRANSMONTO),
TRANSID, CUENTAID, OPERACIONID, FECHATRANS, VOUCHER, CHEQUE,
TRANSTITULAR, TRANSMONTO, TRANSDETALLE, MODIFICADO, TRANSTIPO,
OPERACION):
[IF(CO.TRANSTIPO=0,@SALDO:[email protected],@SALDO=@SALDO+T.TRANSMONTO):
coldfusion.sql.QueryColumn@fc48ce] [TRANSID:
coldfusion.sql.QueryColumn@10fdc46] [CUENTAID:
coldfusion.sql.QueryColumn@469b16] [OPERACIONID:
coldfusion.sql.QueryColumn@16fcbc0] [FECHATRANS:
coldfusion.sql.QueryColumn@a9be7a] [VOUCHER:
coldfusion.sql.QueryColumn@184a49] [CHEQUE:
coldfusion.sql.QueryColumn@b525a6] [TRANSTITULAR:
coldfusion.sql.QueryColumn@badda8] [TRANSMONTO:
coldfusion.sql.QueryColumn@2e6d14] [TRANSDETALLE:
coldfusion.sql.QueryColumn@1fb3f37] [MODIFICADO:
coldfusion.sql.QueryColumn@1f35ded] [TRANSTIPO:
coldfusion.sql.QueryColumn@9b967b] [OPERACION:
coldfusion.sql.QueryColumn@b49cf1] ] is not indexable by
IF(CO.TRANSTIPO=0
Now to the ":=" statement...
http://dev.mysql.com/doc/refman/5.0/en/user-variables.html
This is an example on the documentation
mysql> SET @t1=0, @t2=0, @t3=0;
mysql> SELECT @t1:=(@t2:=1)+@t3:=4,@t1,@t2,@t3;
You can run that on your sql console and check the results.
Perhaps there is another way to write the statement? -
I have many projects made in imovie HD that are not updating to iMovie 10 on my new iMac. Why is this not working as stated on the article HT202853? How do I get my projects back from backup after old iMac crashed?
According to:
Update projects and events from previous versions of iMovie in iMovie (2014) - Apple Support
you can update from iMovie versions 7, 8 and 9, but iMovie HD is iMovie 6.
Maybe you can update in two steps, first from iMovie 6 to iMovie 7, 8 or 9 then to iMovie 10.
Geoff. -
Why is this query not using the index?
check out this query:-
SELECT CUST_PO_NUMBER, HEADER_ID, ORDER_TYPE, PO_DATE
FROM TABLE1
WHERE STATUS = 'N'
and here's the explain plan:-
1
2 -------------------------------------------------------------------------------------
3 | Id | Operation | Name | Rows | Bytes | Cost (%CPU)|
4 -------------------------------------------------------------------------------------
5 | 0 | SELECT STATEMENT | | 2735K| 140M| 81036 (2)|
6 |* 1 | TABLE ACCESS FULL| TABLE1 | 2735K| 140M| 81036 (2)|
7 -------------------------------------------------------------------------------------
8
9 Predicate Information (identified by operation id):
10 ---------------------------------------------------
11
12 1 - filter("STATUS"='N')
There is already an index on this column, as is shown below:-
INDEX_NAME INDEX_TYPE UNIQUENESS TABLE_NAME COLUMN_NAME COLUMN_POSITION
1 TABLE1_IDX2 NORMAL NONUNIQUE TABLE1 STATUS 1
2 TABLE1_IDX NORMAL NONUNIQUE TABLE1 HEADER_ID 1
So why is this query not using the index on the 'STATUS' Column?
I've already tried using optimizer hints and regathering the stats on the table, but the execution plan still remains the same, i.e. it still uses a FTS.
I have tried this command also:-
exec dbms_stats.gather_table_stats('GECS','GEPS_CS_SALES_ORDER_HEADER',method_opt=>'for all indexed columns size auto',cascade=>true,degree=>4);
inspite of this, the query is still using a full table scan.
The table has around 55 Lakh records, across 60 columns. And because of the FTS, the query is taking a long time to execute. How do i make it use the index?
Please help.
Edited by: user10047779 on Mar 16, 2010 6:55 AMIf the cardinality is really as skewed as that, you may want to look at putting a histogram on the column (sounds like it would be in order, and that you don't have one).
create table skewed_a_lot
as
select
case when mod(level, 1000) = 0 then 'N' else 'Y' end as Flag,
level as col1
from dual connect by level <= 1000000;
create index skewed_a_lot_i01 on skewed_a_lot (flag);
exec dbms_stats.gather_table_stats(user, 'SKEWED_A_LOT', cascade => true, method_opt => 'for all indexed columns size auto');Is an example. -
Hypertext links are not always preserved from Word to PDF, using Aperçu or Adobe, depending on OS 10 or Lion. Why? This generally works perfectly in Windows. Why are Apple and Adobe unable to correctly handle links when converting from Word to PDF?
Depending on the system version, and Office Word version:
- a pure URL link starting with http or even www sometimes works in PDF, either produced by Aperçu or Adobe, sometimes does not work;
- other kind of links where the text under display is not a URL, never work!
I like everything with Apple computers and software, except PDF generation. Output files are usually bigger in size, and no better quality, than under Windows. Furthermore, it is weird that something as common as hyperlinks does not work correctly!
I related this question with Mac OS X Snow Leopard, but the problem is still there with Mac OS Lion.
This problem seems to have been around for years, without any proper solution from Apple and/or Adobe! To me, this is very embarrassing!Greetings NoNameGiven,
If I understand the problem correctly (I’m not sure I do) you would prefer ‘iii’ to be read as “eye eye eye” rather than “three”? The alt text property is the only way that I know of to make this happen. Hope this helps.
a ‘C’ student -
Why would this query return three rows?
select pc.tour_id,
pcp.project_id,
pc.contr_num,
pc.current_contr_status,
pc.current_contr_substat
from p_contract_lead pcl
left join p_contract pc on pc.contr_num = '2385108'--pcl.contr_num
left join p_contract_purchase pcp on pcp.contr_num ='2385108'-- pc.contr_num
where pcl.lead_id = '179772978'
in this query it returns me 3 rows,
in p_contract there is only 1 row with contr_num = '2385108'
and p_contract_purchase also has 1 row with contr_num = '2385108'
in p_contract_lead the lead_id = '179772978' has 3 records but they dont have contr_num=2385108
im just wondering why is giving me these results?
shouldnt it give me zero results since the pcl.lead_id = '179772978' does not equal contr_num=2385108?
i have version 12.0.0.6, maybe is the way i dont understand the left join works, or could be something else?
sorry for not creating a example , because i really dont know how.
thanks for your helpHi,
FROM l
LEFT OUTER JOIN r ON ...
means include all rows from l whether or not they have a match in r.
If you have 3 rows in l, then there will always be at least 3 rows in the result set, regardless of what's in r (if anything).
natpidgeon wrote:
in p_contract there is only 1 row with contr_num = '2385108'
and p_contract_purchase also has 1 row with contr_num = '2385108'
in p_contract_lead the lead_id = '179772978' has 3 records but they dont have contr_num=2385108
im just wondering why is giving me these results?
shouldnt it give me zero results since the pcl.lead_id = '179772978' does not equal contr_num=2385108? ...
What you just described is basically how an inner join works.
In this case, it doesn't matter in the least whether pcl.lead_id equals anything in pc or not. The join condition between pcl and pc is
pc.contr_num = '2385108'
That is, a row from pcl will match a row in pc if (and only if) pc.contr_num='2385108'. The join condition makes no mention of pcl.lead_id (or any other column in pcl, for that matter), so what's in pcl.lead_id (or any other column of pcl) doesn't play any role in deciding if rows match.
sorry for not creating a example , because i really dont know how.
Post CREATE TABLE statements for all 3 tables. You only need to include the columns that are used in this query.
Post 1 INSERT statement for p_contract, with contr_num = '2385108'. It wouldn't hurt to post an additional row that you know shouldn't appear in the results.
Post 1 INSERT statement for p_contract_purchase, also with contr_num = '2385108'. Again, it wouldn't hurt to post a 2nd row that does not meet the join condition.
Post 3 INSERT statements p_contract_lead with lead_id = '179772978' , but NOT contr_num='2385108'. Again, having another row with a different lead_id would make a better example. -
How does this query work?
UPDATE medfileinfo mf
SET total_tap_count = total_tap_count-
(SELECT COUNT (1)
FROM rating_temp rt
WHERE ( ( ( (calledcallzone IS NULL) OR (callingcallzone IS NULL)) AND calltype = 0) OR (charges_inr IS NULL))
AND rt.fileid=mf.fileid
WHERE EXISTS (SELECT COUNT (1)
FROM rating_temp rt
WHERE ( ( ( (calledcallzone IS NULL) OR (callingcallzone IS NULL)) AND calltype = 0) OR (charges_inr IS NULL))
AND rt.fileid=mf.fileid)
AND chargedamount=0;After the question has solved on HOW this works. I guess you have a issue with this? Performance?
This query will tell you what it will do:
SELECT mf.fileid,mf.total_tap_count,rt.cnt,
mf.total_tap_count-rt.cnt new_total_tap_count
FROM
medfileinfo mf
INNER JOIN (SELECT fileid,count(*) cnt FROM rating_temp
WHERE ( ( ( (calledcallzone IS NULL) OR (callingcallzone IS NULL)) AND calltype = 0) OR (charges_inr IS NULL))
GROUP BY fileid ) rt
ON rt.fileid=mf.fileid)
WHERE chargedamount=0;And if you want to get rid of subselects use MERGE like this:
MERGE medfileinfo target
USING
(SELECT mf.fileid,mf.total_tap_count,rt.cnt,
mf.total_tap_count-rt.cnt new_total_tap_count
FROM
medfileinfo mf
INNER JOIN (SELECT fileid,count(*) cnt FROM rating_temp
WHERE ( ( ( (calledcallzone IS NULL) OR (callingcallzone IS NULL)) AND calltype = 0) OR (charges_inr IS NULL))
GROUP BY fileid ) rt
ON rt.fileid=mf.fileid) source
ON (target.fileid = source.fileid
and target.chargedamount=0)
WHEN MATCHED THEN UPDATE
SET total_tap_count = source.new_total_tap_count; -
After BI Stats installation: Why is this query not reporting on my query?
Hi,
ok, so I thought I was done with BI Stats installation and I run a query:
Detailed Query Runtime Statistics: Analysis 0TCT_MC02_Q0200 0TCT_MC02
which came with the installation.
I see query QueryColleague in this query with the information:
Time = 21.992
Time:Ste =29.480
Counter = 0
1.
What is the significance of these 3 figures (Time, Time:Ste, Counter)? Does it in any way give a sense of the performance of the query?
2.
Under the Settings for BI Statistics I verified and QueryColleague was set as:
Statistics = D
OLAP detail level = (blank)
I have a query QueryMyOwn which following the installation guidelines, I set up as:
Statistics = X
OLAP detail level = 2
I have since run QueryMyOwn a and run the delta process chains again but this query still not does appear in this Detailed Query Runtime Statistics. Any idea what may be going on?
3.
Am I misinterpreting this report? I thought it was going to show a list of queries which BS Stats has collected data and reporting on them.
4.
Which of the many queries which come with the BI Stats have you found useful so far? I will appreciate the reason. Any particular one standing out if you need to track why a particular report may not be performing well?
ThanksHi,
I think you are viewing the queries from Admin cockpit 0TCT_MC02_Q0200 which has filter to display the query that had been executed in last 24 hours.
Most of the queries from Admin Cockpit will be help you to monitor the data load stats, which load taken long time to complete including the process chains, DTP etc. There are some other queries with have conditional / Expection which filter the data based on top 10 process etc.
Few Queries that was useful to me are
0TCT_MC22_Q0104 - Long term trends in total runtime
0TCT_MC12_Q0110 - Process status
0TCT_MC01_Q0122 - Deviation in runtime of BI Application Object
Hope it helps,
Cheers,
Balaji -
Why will a query work in SQL Developer but not in Apex?
Here's a good one. I created a dynamic LOV with the following query.
select
e.DESCR d,
ee.ENTRD_EVNT_SK r
from
PT_EVNT_IN_DIV eid,
PT_ENTRD_EVNT ee,
PT_EVNT e
where ee.PGNT_SK = :PGNT_SK
and ee.CNTSNT_SK = :CNTSNT_SK
and ee.EVNT_IN_DIV_SK = eid.EVNT_IN_DIV_SK
and eid.EVNT_SK = e.EVNT_SK
and ee.ENTRD_EVNT_SK not in
(select js.ENTRD_EVNT_SK
from PT_JDG_SCR js
where js.JDG_SK = :JDG_SK
and js.PGNT_SK = :ai_pgnt_sk
and js.CNTSNT_SK = :CNTSNT_SK)
order by 1
The query works fine in SQL Developer, but Apex gives the following error when compiling it in the LOV editor.
"1 error has occurred
- LOV query is invalid, a display and a return value are needed, the column names need to be different. If your query contains an in-line query, the first FROM clause in the SQL statement must not belong to the in-line query."
I tried rearranging the entries in the From clause, but that didn't do any good.
Do you see what I can do to make Apex accept it?
Thanks,
KimKim
Kim2012 wrote:
select
e.DESCR d,
ee.ENTRD_EVNT_SK r
from
PT_EVNT_IN_DIV eid,
PT_ENTRD_EVNT ee,
PT_EVNT e
where ee.PGNT_SK = :PGNT_SK
and ee.CNTSNT_SK = :CNTSNT_SK
and ee.EVNT_IN_DIV_SK = eid.EVNT_IN_DIV_SK
and eid.EVNT_SK = e.EVNT_SK
and ee.ENTRD_EVNT_SK not in
(select js.ENTRD_EVNT_SK
from PT_JDG_SCR js
where js.JDG_SK = :JDG_SK
and js.PGNT_SK = :ai_pgnt_sk
and js.CNTSNT_SK = :CNTSNT_SK)
order by 1
The column named ENTRD_EVNT_SK is used twice in a select. Once in the main select and once in the inline query.
The validation maybe choking on that.
Try giving the column in the inline query an alias and see if that helps.
Nicolette -
HT4113 why isnt this thing working
why isnt this working
Because of the actions of an unsympathetic deity.
Try to ask a sensible question with a clue or two, and us folk might be able to help you. With your present standard of asking, you have no hope. -
Problem: Why does this only work for powers of 2?
I wrote this program to create a golf league schedule for, ideally, eight players. However I want it to be flexible enough to permit for other denominations, such as 10 or 12. When I run the program it works perfectly for any number that is a power of 2 (2,4,8,16,32,etc...) but it will not work for other even numbers such as 6,10, or 12. If anyone has any insights it would be most helpful.
*(This is my first post on this forum so if anything looks not quite right or if this post isn't worded exactly how it should be then I apologize in advance)*
Here's the three classes.
public class ScheduleDriver
public static void main(String[] args)
//instance variables
int max; //size of flight matches array
ScheduleMaster master;//instance of class
//get max number of players for flight
System.out.print("Max number of players in this flight:");
max = Keyboard.readInt();
master = new ScheduleMaster(max);
//create weekly schedules for season
master.createSchedule();
//display weekly schedules
master.displayWeekly();
}//end main
}//end ScheduleDriver
public class ScheduleMaster
//instance variables
int maxPlyrs;//maximum number of players in flight
Week[] weeklySchedule;//array of weekly matches
public ScheduleMaster(int plyrs)
//set up instance data and declare array size
maxPlyrs = plyrs;
weeklySchedule = new Week[plyrs];
//set up the size of each week's matches array
for (int pos = 0; pos < plyrs; pos++)
weeklySchedule[pos] = new Week(plyrs);
}//end for
}//end constructor
public void createSchedule()
int count = 0;//index of weeklySchedule array
final int QUIT = -1; //quit value for loop
int flag = 0; //value to continue or exit loop
//for each player A
for (int a = 1; a < maxPlyrs; a++)
//for each opponent of player A
for (int b = (a + 1); b <=maxPlyrs;b++)
//set count/index and reset flag to zero
count = (a - 1);
flag = 0;
//while still haven't found correct week for this match
while (flag != QUIT)
//if at least one of these players are already scheduled
//for a match this week
if (weeklySchedule[count].checkPlayers(a,b) == true)
//if last valid index of array has been reached
if (count == (maxPlyrs - 2))
//reset count/index to zero
count = 0;
else
//incriment count
count++;
}//end if
else
//assign this match to array of matches for week
//and then exit loop
weeklySchedule[count].setMatch(a,b);
flag = -1;
}//end else
}//end while
}//end for
}//end for
//fill in last week/position night
for (int pos = 0; pos < maxPlyrs;pos++)
//set up position match
weeklySchedule[maxPlyrs - 1].setMatch(pos + 1, pos + 2);
//incriment pos
pos++;
}//end for
}//end createSchedule
public void displayWeekly()
//for each week in schedule
for (int pos = 0; pos < maxPlyrs;pos++)
//display header
System.out.print("WEEK " + (pos + 1));
//if pos/index is 0 or even, flight plays front 9
if ((pos % 2) == 0)
System.out.println(" [FRONT 9]");
//else flight plays back 9
else
System.out.println(" [BACK 9]");
//display lines
System.out.println("----------------");
//display week's matches
weeklySchedule[pos].display();
//skip a line
System.out.println("\n");
}//end for
}//end displayWeekly
}//end ScheduleMaster
public class Week
int[] schedule; //array of players involved in matches for week
int max; //max number of players
int count = 0; //number of players currently involved in matches
public Week(int size)
//set up instance data and size of array
max = size;
schedule = new int[size];
}//end constructor
public boolean checkPlayers(int playerA, int playerB)
boolean flag = false; //flag to determine if at least one of
//the players to check are already playing
//this week
//for each element of array
for (int pos = 0; pos < max; pos++)
//if player A matches player already playing this week
if (schedule[pos] == playerA)
flag = true;
}//end for
//for each element of array
for (int pos = 0; pos < max; pos++)
//if player B matches player already playing this week
if (schedule[pos] == playerB)
flag = true;
}//end for
return flag;
}//end checkPlayers
public void setMatch(int playerA, int playerB)
//if array can take more matches
if (count <= (max - 2))
//insert players into array of active players for week
schedule[count] = playerA;
schedule[count + 1] = playerB;
//incriment count of players playing this week by 2
count = count + 2;
}//end if
else
System.out.print("No more matches can be entered!!!");
}//end setMatch
public void display()
//for every even numbered index starting at zero
for (int num = 0;num < max;num++)
//display the player at that position and the next consecutive
//player who will be his opponent for the week
System.out.println(schedule[num] + "VS" + schedule[num + 1] +
//incriment num
num++;
}//end for
}//end display
}//end WeekAh, I have discovered the problem. The reason for the infinite loop was because of the resetting of the counter/index after every successful match entry back to (a - 1). This was causing matches to be put into weeks where they didn't belong, which caused the program to infinitely loop because it couldn't find an appropriate week to place it's next match. The only time the count should be reset back to zero is when a new player A is being processed or the last valid array index has been referenced before an out of bounds exception would be thrown. I'm still not entirely sure why this doesn't occur on powers of 2 but theh again I haven't put too much thought into it having solved the initial problem! :)
Anyways thanks for the input all who posted, much appreciated.
Happy programming!!!! -
Why does the query work in SQL Developer, but not in APEX?
Hi, guys:
I have a silly question. I have a complicated query, and I tested it successfully with SQL developer, and result is correct. However, when I put it into APEX to generate a report, it always reports no data found. I also know the condition related to "other marks" select list in the where clause part causes this problem. It also looks strange: before I add this condition, everything works OK; after I add this condition, even I do not choose the "other marks" select list, other components do not work neither. I always got no data found result. Could anyone help me on this problem? You can also visit our developing site as http://lsg-solutions.com:8888/apex/f?p=206 to check the problem.
Thanks a lot
Sam
select distinct 'MAP','Detail',so.doc_number as "DOC Number", so.offender_id as "Offender ID", so.first_name||' '|| so.middle_name||' '||so.last_name as "Offender Name",
so.date_of_birth as "Date of Birth",
(select sc1.description from sor_code sc1 where sc1.code_id=so.race) as "Race",
(select sc2.description from sor_code sc2 where sc2.code_id=so.sex) as "Sex",
(select sc8.description from sor_code sc8 where sc8.code_id=so.hair_color) as "Hair Color",
(select sc9.description from sor_code sc9 where sc9.code_id=so.eye_color) as "Eye Color",
replace(replace(nvl2(sl.address1, sl.address1||' '||sl.address2 ||' '||sl.city ||' '||sl.county||' '||(select sc3.description from sor_code sc3 where sc3.code_id=sl.state)||' '||sl.zip, 'No Known Address'),'#'),',') as "Address",
replace(replace(nvl2(sl.physical_address1,sl.physical_address1||' '||sl.physical_city ||' '||sl.physical_county||' '||(select sc4.description from sor_code sc4 where sc4.code_id=sl.physical_state)||' '||sl.physical_zip, 'No Known Address'),'#'),',') as "Physical Address",
sl.status as "Status",
sl.jurisdiction as "Jurisdiction",
to_char(sl.ADDRESS_LATITUDE) as "Address Latitude",to_char(sl.address_longitude) as "Address Longitude",
to_char(sl.physical_address_latitude) as "Physical Latitude",to_char(sl.physical_address_Longitude) as "Physical Longitude",
decode(rox.habitual, 'Y', 'Habitual', '') as "Habitual",
decode(rox.aggravated, 'Y', 'Aggravated', '') as "Aggravated",
rox.status as "Registration Status",
rox.registration_date as "Registration Date",
rox.end_registration_date as "End Registration Date"
from sor_location sl, sor_offender so, registration_offender_xref rox, sor_last_locn_v sllv
where rox.offender_id=so.offender_id
and sllv.offender_id(+)=so.offender_id
and sl.location_id(+)=sllv.location_id
and rox.status not in ('Merged')
and rox.reg_type_id=1
and upper(rox.status)='ACTIVE'
and nvl(rox.admin_validated, to_date(1,'J'))>=nvl(rox.entry_date, to_date(1,'J'))
and (((select sc11.description from sor_code sc11 where sc11.code_id=so.race and sc11.description=:P5_SL_RACE) is not null ) or (:P5_SL_RACE is null))
and (((select sc12.description from sor_code sc12 where sc12.code_id=so.sex and sc12.description=:P5_SL_SEX) is not null ) or (:P5_SL_SEX is null))
and (((select sc13.description from sor_code sc13 where sc13.code_id=so.hair_color and sc13.description=:P5_SL_HAIR_COLOR) is not null ) or (:P5_SL_HAIR_COLOR is null))
and (((select sc14.description from sor_code sc14 where sc14.code_id=so.eye_color and sc14.description=:P5_SL_EYE_COLOR) is not null ) or (:P5_SL_EYE_COLOR is null))
and (( so.offender_id in(select sm.offender_id from sor_code sc15, sor_mark sm, sor_offender so1 where sm.offender_id=so1.offender_id and sc15.code_id=sm.code and sc15.description=:P5_SL_OTHER_MARKS and sm.description is not null)) or (:P5_SL_OTHER_MARKS is null))My suggestion would be to put some instrumentation into your query and see what values you are using.. Or even simpler take out ALL the where clauses you can until data starts to sho wup and then add them back in one at a time until you find the culprit..
My bet would be on any date comparisons you are doing between page items and database columns..
Thank you,
Tony Miller
Dallas, TX -
Option Explicit
Sub BatchProcess()
Dim strFileName As String
Dim strPath As String
Dim oDoc As Document
Dim oLog As Document
Dim oRng As Range
Dim oHeader As HeaderFooter
Dim oSection As Section
Dim fDialog As FileDialog
Set fDialog = Application.FileDialog(msoFileDialogFolderPicker)
With fDialog
.Title = "Select folder and click OK"
.AllowMultiSelect = False
.InitialView = msoFileDialogViewList
If .Show <> -1 Then
MsgBox "Cancelled By User", , _
"List Folder Contents"
Exit Sub
End If
strPath = fDialog.SelectedItems.Item(1)
If Right(strPath, 1) <> "\" _
Then strPath = strPath + "\"
End With
If Documents.Count > 0 Then
Documents.Close savechanges:=wdPromptToSaveChanges
End If
Set oLog = Documents.Add
If Left(strPath, 1) = Chr(34) Then
strPath = Mid(strPath, 2, Len(strPath) - 2)
End If
strFileName = Dir$(strPath & "*.doc?")
While Len(strFileName) <> 0
WordBasic.DisableAutoMacros 1
Set oDoc = Documents.Open(strPath & strFileName)
'Do what you want with oDoc here
For Each oSection In oDoc.Sections
For Each oHeader In oSection.Headers
If oHeader.Exists Then
Set oRng = oHeader.Range
oRng.Collapse wdCollapseStart
InsertMyBuildingBlock "ASAP 1", oRng
End If
Next oHeader
Next oSection
'record the name of the document processed
oLog.Range.InsertAfter oDoc.FullName & vbCr
oDoc.Close savechanges:=wdSaveChanges
WordBasic.DisableAutoMacros 0
strFileName = Dir$()
Wend
End Sub
Function InsertMyBuildingBlock(BuildingBlockName As String, HeaderRange As Range)
Dim oTemplate As Template
Dim oAddin As AddIn
Dim bFound As Boolean
Dim i As Long
bFound = False
Templates.LoadBuildingBlocks
For Each oTemplate In Templates
If InStr(1, oTemplate.Name, "Building Blocks") > 0 Then Exit For
Next
For i = 1 To Templates(oTemplate.FullName).BuildingBlockEntries.Count
If Templates(oTemplate.FullName).BuildingBlockEntries(i).Name = BuildingBlockName Then
Templates(oTemplate.FullName).BuildingBlockEntries(BuildingBlockName).Insert _
Where:=HeaderRange, RichText:=True
'set the found flag to true
bFound = True
'Clean up and stop looking
Set oTemplate = Nothing
Exit Function
End If
Next i
If bFound = False Then 'so tell the user.
MsgBox "Entry not found", vbInformation, "Building Block " _
& Chr(145) & BuildingBlockName & Chr(146)
End If
End Function
This works, using the ASAP 1 watermark that is in bold. ASAP 1 is a built-in building block, if i just rename this to ASAP, but save it in the same place with buildingblocks.dotx it wont work. What do i need to do to be able to use this with my custom building
blocks?Hi,
This is the forum to discuss questions and feedback for Microsoft Excel, this issue is related to Office DEV, please post the question to the MSDN forum for Excel
http://social.msdn.microsoft.com/Forums/en-US/home?forum=exceldev&filter=alltypes&sort=lastpostdesc
The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
George Zhao
TechNet Community Support
It's recommended to download and install
Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
programs. -
This query worked, then it didn't with ORA-00600
select decode (level, -1, -1, -1) initial_level,
level node_depth,
decode (level, 0, parent_id, child_id)||' '||rule_desc node_label,
'expand' node_icon,
child_id node_data,
parent_id node_parent
from rule_tree, rule_master
where rm_id = child_id
start with nvl(parent_id,' ') = 'MASTER'
connect by parent_id = prior child_id
select decode (level, -1, -1, -1) initial_level,
ERROR at line 1:
ORA-00600: internal error code, arguments: [12406], [], [], [], [], [], [], []
Anyone know why this code once worked but now doesn't and what does the error mean?http://download.oracle.com/docs/cd/B19306_01/server.102/b14219/e0.htm#sthref371
http://forums.oracle.com/forums/search.jspa?threadID=&q=ORA-00600%3A+internal+error+code&objID=c84&dateRange=all&userID=&numResults=15&rankBy=10001 -
Email id in one of my tables A is stored in the format -- email://[email protected]
If I want this to get displayed as just [email protected] where X is any address and its value is varying for eg -- [email protected] or [email protected] etc
Can I give my query like this?
insert into A values(select trim(substr(email,1,9)); -- I am trying to trim email://
Will trim(substr) work?
Please adviseuser6440749 wrote:
Email id in one of my tables A is stored in the format -- email://[email protected]
If I want this to get displayed as just [email protected] where X is any address and its value is varying for eg -- [email protected] or [email protected] etc
Can I give my query like this?
insert into A values(select trim(substr(email,1,9)); -- I am trying to trim email://
Will trim(substr) work?
Please adviseYou are on the right track. Just that you need to change the substr function a little bit.
You just need to remove the email:// (8 characters) and get the string from 9th character. So, it would be something like
insert into A values(select trim(substr(email,9))); -Arun
Maybe you are looking for
-
Problem installing sharepoint foundation 2013 on windows server 2008 r2
anybody has experience installing sharepoint 2013 on windows server 2008 r2? I failed to install it even if I have all the latest patches installed and the sql server 2012 express installed. it keeps failing to install the prerequisites. • Microsoft
-
I tried out Apple's new Photos app and it grabbed iPhoto and Aperture libraries. I don't like Photos and I want to get those photos into Lightroom. Any ideas how to do that? I already moved an Aperture library on another computer months ago, using a
-
Iphone App not Opening, Please Help!
I keep trying to open the game app "what's the phrase". It will start to launch and act like it's going to open, but then the screen goes black and it goes back to my home page. This seemed to start happening after I downloaded the update for that pa
-
I have CS3 Windows and have been reading Kelby's book 7-Point System where he opens jpegs into camera raw. However, the explanation is poorly written for someone who has never done that. Can someone explain? Thanks. Don
-
Exporting to PDF - CS4 trouble
In exporting my file, If I choose > Acrobat 4, (Acrobat 5 and above) I get missing elements to my PDF file (attached, v5.) pg 2 shows correctly, pg 1 doesn't (white box around text on left page is missing on the first page). At least v4 consistently