TABLE(CAST()) function not returning the correct results in few scenarios.
I am using TABLE(CAST()) operation in PL/SQL and it is returning me no data.
Here is what I have done:
1. Created Record type
CREATE OR REPLACE TYPE target_rec AS OBJECT
target__id NUMBER(10),
target_entity_id NUMBER(10),
dd CHAR(3),
fd CHAR(3),
code NUMBER(10),
target_pct NUMBER,
template_nm VARCHAR2(50),
p_symbol VARCHAR2(10),
pm_init VARCHAR2(3),
target_name VARCHAR2(20),
targe_type VARCHAR2(30),
target_caption VARCHAR2(30),
sort_order NUMBER (4)
2. Created Table type
CREATE OR REPLACE TYPE target_arr AS TABLE OF target_rec
3. Created Stored procedure which accepts parameter of type target_arr and runs the Table(Cast()) function on it.
Following is the simplified form of my procedure.
PROCEDURE get_target_weights
p_in_template_target IN target_arr,
p_out_count OUT NUMBER,
IS
BEGIN
SELECT count(*) into p_out_count
FROM TABLE(CAST(p_in_template_target AS target_arr)) arr;
END;
I am calling get_target_weights from my java code and passing p_in_template_target with 10140 records.
Scenario 1: If target_pct in the last record is 0, p_out_count returned from the procedure is 0.
Scenario 2: If target_pct in the last record is any other value(say 0.01), p_out_count returned from the procedure is 10140.
Please help me understand why the Table(Cast()) is not returning the correct results in Scenario 1. Also adding or deleting any record from the test data returns the correct results (i.e. if keep target_pct in the last record as 0 but add or delete any record).
Let me know how can I attach the test data I am using to help you debugging as I don’t see any Attach file button on Post Message screen on the forum.
I am not able to reproduce this problem with a small data set. I can only reproduce with the data having 10140 records.
I am not sure if this is the memory issue as adding a new record also solves the problem.
This should not be the error because of wrong way of filling the records in java as for testing purpose I just saved the records which I am sending from java in a table. I updated the stored procedure as well to read the data from the table and then perform TABLE(CAST()) operation. I am still getting 0 as the output for scenario 1 mentioned in my last mail.
Here is what I have updated:
1. Created the table target_table
CREATE Table target_table
target_id NUMBER(10),
target_entity_id NUMBER(10),
dd CHAR(3),
fd CHAR(3),
code NUMBER(10),
target_pct NUMBER,
template_nm VARCHAR2(50),
p_symbol VARCHAR2(10),
pm_init VARCHAR2(3),
target_name VARCHAR2(20),
target_type VARCHAR2(30),
target_caption VARCHAR2(30),
sort_order NUMBER (4)
2. Inserted data into the table : The script has around 10140 rows. Pls let me know how can I send it to you
3. Updated procedure to read data from table and stored into variable of type target_arr. Run Table(cast()) operation on target_arr and get the count
PROCEDURE test_target_weights
IS
v_target_rec target_table%ROWTYPE;
CURSOR wt_cursor IS
Select * from target_table;
v_count NUMBER := 1;
v_target_arr cws_target_arr:= target_arr ();
v_target_arr_rec target_rec;
v_rec_count NUMBER;
BEGIN
OPEN wt_cursor;
loop
fetch wt_cursor into v_target_rec; -- fetch data from table into local record.
exit when wt_cursor%notfound;
--move data into target_arr
v_target_arr_rec := cws_curr_pair_entity_wt_rec(v_target_rec target_id,v_target_rec. target_entity_id,
v_target_rec.dd,v_target_rec.fd,v_target_rec.code,v_target_rec.target_pct,
v_target_rec.template_nm,v_target_rec.p_symbol,v_target_rec.pm_init,v_target_rec.template_name,
v_target_rec.template_type,v_target_rec.template_caption,v_target_rec.sort_order);
v_target_arr.extend();
v_target_arr(v_count) := v_target_arr_rec;
v_count := v_count + 1;
end loop;
close wt_cursor;
-- run table cast on target_arr
SELECT count(*) into v_rec_count
FROM TABLE(CAST(v_target_arr AS target_arr)) arr;
DBMS_OUTPUT.enable;
DBMS_OUTPUT.PUT_LINE('p_out_count ' || v_rec_count);
DBMS_OUTPUT.PUT_LINE('v_count ' || v_count);
END;
Output is
p_out_count 0
v_count 10140
Expected output
p_out_count 10140
v_count 10140
Similar Messages
-
Ldapsearch does not return the correct result
We are using the Netscape Directory server 4.12. We try to use the Radiator Radius server to query the Directory server for authentication.
When we use the filter:
uid=itkychan
to query if the user is in the Directory, it returns the correct result.
However, we would like to query if the username is in a specified group, e.g. tss_ns_grp, in the Directory, we try to use the following command:
#./ldapsearch -b "o=The xxx University,c=HK" -h hkpu19
"(&(cn=tss_ns_grp)(|(&(objectclass=groupofuniquenames)(uniquemember=uid=itkychan))(&(objectclass=groupofnames)(member=uid=itkychan))))"
but no result is returned.
itkychan is a member of the group tss_ns_grp. The following is a portion of the LDIF file:
dn: cn=tss_ns_grp, o=The xxx University, c=HK
objectclass: top
objectclass: groupOfUniqueNames
objectclass: mailGroup
cn: tss_ns_grp
mail: [email protected]
mailhost: abcd.xxxu.edu.hk
uniquemember: cn=xxxxxxxxxxxxxx, uid=itkychan, ou=xxxu_ITS, o=The xxx University, c=HK
uniquemember: cn=xxxxxxxxxxxxxx, uid=itjcheng, ou=polyu_ITS, o=The xxx University, c=HK
uniquemember: .....You will have to use the full DN for the member and uniquemember e.g.
(...(uniquemember=cn=xxxxxxxxxxxxxx, uid=itkychan, ou=xxxu_ITS, o=The xxx University, c=HK)...) -
HttpServletRequest.getHeaders("accept") does not return the correct results
I noticed that when I use the invoke the HttpServletRequest.getHeaders("accept") method I do not get the result that I am expecting.
For instance, if the browser passes over the following accept header:
"text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8"
When i invoke the getHeaders() method, instead of it returning me a single value with the string that was passed over, it returns me 4 separate entries. It looks like Iplanet is parsing the header value and breaking it up by commas.
When I run the same code in TomCat, it returns the single comma separated string as I would expect.
Is there anything to keep Iplanet from breaking apart the header value?
I am running Oracle iPlanet Web Server 7.0.15 B04/19/2012 21:52
Thanks In Advance,
Marty
Edited by: MartyJones2 on Aug 30, 2012 2:44 PMYou will have to use the full DN for the member and uniquemember e.g.
(...(uniquemember=cn=xxxxxxxxxxxxxx, uid=itkychan, ou=xxxu_ITS, o=The xxx University, c=HK)...) -
When converting tables in a MS Word 2010 or 2007 to PDF the table borders do not retain the correct thickness as identified in the word document. Is there a solution for this issue?
Please try with latest version of MS Word and Acrobat.
Regards,
Anoop -
Date difference is not showing the correct result for date interval
Hi Expert,
I've created two formula variable one for PO date and another for GR date
while i am taking the date difference of GR and PO date for single PO date selection
it showing me correct result , but while i am taking the date interval for PO date it not
showing the correct result.
eg: PO date: 01.01.2010 for a particular PO and Gr date is suppose 03.01.2010, 06.01.2010
it showing the result 2 and 5.
But if i am taking date interval for PO date:
eg: 01.01.2010 - 31.01.2010
PO date: 10.01.2010 and GR date are suppose 15.01.2010, 22.01.2010 and 30.01.2010
it showing me 14, 21 and 29
Thanks and Regards
Lalit KumarHi Expert,
Through replacement path.
Thanks and Regards
Lalit Kumar -
V$session prev_hash_value not returning the correct value?
Hello,
I am executing a plsql package (which has the following query) in two modes: through Toad and through a deployed web application. I get two results.
SELECT sa.sql_text,
sa.sql_id,
ss.sid
FROM v$session ss,
v$sqlarea sa
WHERE ss.status = 'ACTIVE'
AND sa.hash_value = ss.prev_hash_value
AND ss.username = USER;
Toad gives me the correct result. The query above pulls the correct SQL statement. But when running through the web application it gives me
some random SQL statement executed during that session. I thought it might have something to do with pooled JDBC connections so I made sure for that
execution I created a new dedicated JDBC connection. Still did not work. I used the function SYS_CONTEXT('USERENV', 'SID') to report the session id
from my java program and from the query above. Both return the same SID. I've tried different variations of that query above (removing status = ACTIVE, removing username = USER, etc...)
and I still get the same result.
So any thoughts on what's going on?
Thanks,
PiyushI believe I figured it out. My testing was flawed. The testing in Toad was directly calling my package (e.g., pkg_b). The web app doesn't do that. It calls pkg_a which does a bunch of setup and then calls the target package (pkg_b) using EXECUTE IMMEDIATE. Apparently the v$session stops collecting info at that point. The current statement always shows as 'BEGIN :b1 := pkg_b; END;'. But it's still confusing why it would do that. Is there another way to access SQL statements from within that dynamic block?
-
Policy Trace not returning the Correct policy
Hi Everybody,
Our issue here is that when we run a policy trace on any of our Active Directory users - it does not match the Correct policies and match the Global Access policy although the Trace return right Identity policy
However if i try access an any URL and monitor the activity from the cli OR Ftp Access log - i cann see that the user has in fact had certain policies applied to it.
i think there ara problem in policy trace to fatch the coorect policy form GUI
Does anyone have any suggestions as to how resolve this.
Running the command testauthconfig - completes successfully.
Web Security Appliance Version Information
Model:
S160
Version:
7.5.1-079 for Web
Ahmed mostafaA TAC engineer informed me a while back that Policy Trace was currently unreliable, and they hope to fix it in the future. I wouldn't rely on it for accuracy.
-
OraDynaSet not returning the correct number of records.
Hello All, I am writing VB code in Excel 2007 and retrieving records from a Oracle 9i database. When I run my query from TOAD or any other sql app I get 56 records returned for certain query. However, when I do it from VB in excel and write the values to the excel file, it will not return the last 3 records, any suggestions? Here is part of my code:
Worksheets("Report").Range("A3").Value = ""
Worksheets("Report").Range("B3").Value = "Period"
Worksheets("Report").Range("C3").Value = "Budget"
Worksheets("Report").Range("D3").Value = "Projected"
strSQL = "select group_name,period_name,budget_value,budget_value project from nlas_bdgt_loading_stg where plant = " & plant & " and group_number = 1 order by group_number, period_num"
Set OraDynaSet = objDataBase.DBCreateDynaset(strSQL, 0&)
If OraDynaSet.RecordCount > 0 Then
OraDynaSet.MoveFirst
'Loop the recordset for returned rows
For i = 4 To OraDynaSet.RecordCount
'Put the results in columns
ActiveSheet.Cells(i, 1) = OraDynaSet.Fields(0).Value
ActiveSheet.Cells(i, 2) = OraDynaSet.Fields(1).Value
ActiveSheet.Cells(i, 3) = OraDynaSet.Fields(2).Value
ActiveSheet.Cells(i, 4) = OraDynaSet.Fields(3).Value
OraDynaSet.MoveNext
Next i
End If
Thanks,
ChrisHello.
It's a bit weird. It works for me. If you have a look at oo4o help:
CopyToClipboard Method
Example
Applies To
OraDynaset
Description
Copy the rows from the dynaset to the Clipboard in text format.
Usage
OraDynaset.CopyToClipboard(NumOfRows ,colsep [optional],rowsep [optional] )
Arguments
NumOfRows Number of rows to be copied to the dynaset ,
colsep Column separator in CHAR to be inserted between columns
rowsep Row seperater in CHAR to be inserted between Rows
Remarks
This method is used to facilitate transfer of data between Oracle Object for OLE’s cache (dynaset) and Windows applications such as Excel or Word. CopyToClipboard copies data starting from current position of the dynaset up to the last row.
Default column separator is TAB (ASCII 9).
Default row separator is ENTER (ASCII 13).
Can it be that you don't have all the References needed?
Octavio -
PLSQL function does not return the correct number of rows?
Hey folks. I'm still green when it comes to writing PLSQL. It's fun, rewarding and very frustrating. Hence, I'm turning to the experts. If you folks can help me understand what I'm doing wrong here, I'd really appreciate it.
The code is somewhat specific to my company's product, but I think it should be easy to read and understand what I'm doing. If not, please let me know what I can clarify.
All i'm trying to do is determine if the most recent iteration of data available for a particular host is a full scan or not (level2). I go about this in the following manner:
1. get the operatingsystem id, it's scandate (preferred), the most recent scandate and it's scan status from a table of where all operating systems data lives. Loop through all the Oses
(from this I set v_osid, v_mostrecentscandate, v_scandate).
2. Before doing the crazy logic, pick the low hanging fruit
2a. if the the level2 status of the host is N, then v_level2 = 'N';
2b. if the level2 = 'Y' and the mostrecentscandate and scandate are identical, then v_level2 = 'Y';
2c. for all other cases, go to 3
3. Using v_mostrecentscandate, find all table id that may hold the most recent instance of data for the host
4. Loop through through the concatenation of that id + _base. If you find the id in those tables, then store the id for the next step.
5. When you I find the right id, I now concatenate the id + attrdata. For the host id, I look for any rows where attribute_value in (..) and the corresponding number_value is not null.
5b. set v_level2 = 'Y'
5c. otherwise, set v_level2 = 'N'
6 end the loop
7 wash, rinse, repeat for each OS.
create or replace package body mostrecentlevel2 as
function getMostRecentL2 return bdna_mostrecent_level2 pipelined IS
v_lsid NUMBER;
v_sql VARCHAR2(5000);
v_sql_baseid NUMBER;
v_sql_numv NUMBER;
v_lsidt VARCHAR2(5000);
v_lsidt2 VARCHAR2(5000);
v_sql_rec VARCHAR2(5000);
v_osid NUMBER;
v_anchor DATE;
v_ls CHAR(2);
v_level2 CHAR(1);
v_mostrecentscandate DATE;
v_scandate DATE;
cursor getOSinfo_cur is select operatingsystem_id, scandate, mostrecentscandate, level2 from bdna_all_os;
cursor getlsID_cur is select id from local_scan where
((trunc(collect_start_time) - to_date(v_anchor))*24*60*60) <= ((to_date(v_mostrecentscandate) - to_date(v_anchor))*24*60*60)
and
((trunc(collect_end_time) - to_date(v_anchor))*24*60*60) >= ((to_date(v_mostrecentscandate) - to_date(v_anchor))*24*60*60);
getOSinfo_rec getOSinfo_cur%rowtype;
getlsID_rec getlsID_cur%rowtype;
BEGIN
v_ls := 'ls';
v_anchor := '01-JAN-01';
FOR getOSinfo_rec IN getOSinfo_cur LOOP
v_osid := getOSinfo_rec.operatingsystem_id;
v_mostrecentscandate := getOSinfo_rec.mostrecentscandate;
v_scandate := getOSinfo_rec.scandate;
IF getOSinfo_rec.level2 = 'N' THEN
v_level2 := 'N';
ELSIF getOSinfo_rec.level2 = 'Y' THEN
IF v_mostrecentscandate != v_scandate THEN
FOR getlsID_rec IN getlsID_cur LOOP
v_lsid := getlsID_rec.id;
v_lsidt := v_ls||v_lsid;
v_sql := 'select id from '||v_lsidt||'_base where id = '||chr(39)||v_osid||chr(39);
EXECUTE IMMEDIATE v_sql into v_sql_baseid;
IF SQL%ROWCOUNT > 0 THEN
v_lsidt2 := v_lsidt;
v_sql := '';
END IF;
END LOOP;
v_sql := 'select number_value from '||v_lsidt2||'_attr_data where
lower(attribute_name) IN ('||chr(39)||'numcpus'||chr(39)||', '||chr(39)||'totalmemory'||chr(39)||', '||chr(39)||'cpuutilpercent'||chr(39)||', '||chr(39)||'numprocesses'||chr(39)||')
and
number_value is not NULL
and
element_id = '||chr(39)||v_osid||chr(39);
EXECUTE IMMEDIATE v_sql into v_sql_numv;
IF SQL%ROWCOUNT > 0 THEN
v_level2 := 'Y';
ELSE v_level2 := 'N';
END IF;
END IF;
v_level2 := 'Y';
END IF;
PIPE ROW (mostRecentLevel2Format(v_osid,v_mostrecentscandate,v_level2));
END LOOP;
END;
END;
/Now some will ask why I'm using pipelining? Again, I'm green.. I was reading around, looking for a way to make this code run as fast as possible (because it's potentially got to go through 56K records and perform the expensive work on).
I also realize I'm not providing the type or package code, and that's because I think I'm good on that. The code above compiles just fine without errors and when it runs, it only returns 6 consecutive rows.. I'm expecting 70K lol. So I know I'm doing something wrong.
Any thoughts?
Oh forgot to add this is on 11g R1 Enterprise Edition
Edited by: ErrolDC on Nov 14, 2011 4:52 PM
Edited by: ErrolDC on Nov 14, 2011 5:07 PMErrolDC wrote:
Hey folks. I'm still green when it comes to writing PLSQL. It's fun, rewarding and very frustrating. Hence, I'm turning to the experts. If you folks can help me understand what I'm doing wrong here, I'd really appreciate it.
The code is somewhat specific to my company's product, but I think it should be easy to read and understand what I'm doing. If not, please let me know what I can clarify.Post a complete script that peoople who aren't as familiar with the application as you are can run to re-create the problem and test their ideas. In this case, that includes CREATE TABLE and INSERT statements for the tables used (just the columns needed for this job), a query that uses the function, and the results you want from that query given the data you posted.
All i'm trying to do is determine if the most recent iteration of data available for a particular host is a full scan or not (level2). I go about this in the following manner:
1. get the operatingsystem id, it's scandate (preferred), the most recent scandate and it's scan status from a table of where all operating systems data lives. Loop through all the Oses
(from this I set v_osid, v_mostrecentscandate, v_scandate).
2. Before doing the crazy logic, pick the low hanging fruit
2a. if the the level2 status of the host is N, then v_level2 = 'N';
2b. if the level2 = 'Y' and the mostrecentscandate and scandate are identical, then v_level2 = 'Y';
2c. for all other cases, go to 3
3. Using v_mostrecentscandate, find all table id that may hold the most recent instance of data for the host
4. Loop through through the concatenation of that id + _base. If you find the id in those tables, then store the id for the next step.
5. When you I find the right id, I now concatenate the id + attrdata. For the host id, I look for any rows where attribute_value in (..) and the corresponding number_value is not null.
5b. set v_level2 = 'Y'
5c. otherwise, set v_level2 = 'N'
6 end the loop
7 wash, rinse, repeat for each OS.
create or replace package body mostrecentlevel2 as
function getMostRecentL2 return bdna_mostrecent_level2 pipelined IS
v_lsid NUMBER;
v_sql VARCHAR2(5000);
v_sql_baseid NUMBER;
v_sql_numv NUMBER;
v_lsidt VARCHAR2(5000);
v_lsidt2 VARCHAR2(5000);
v_sql_rec VARCHAR2(5000);
v_osid NUMBER;
v_anchor DATE;
v_ls CHAR(2);
v_level2 CHAR(1);
v_mostrecentscandate DATE;
v_scandate DATE;
cursor getOSinfo_cur is select operatingsystem_id, scandate, mostrecentscandate, level2 from bdna_all_os;
cursor getlsID_cur is select id from local_scan where
((trunc(collect_start_time) - to_date(v_anchor))*24*60*60) <= ((to_date(v_mostrecentscandate) - to_date(v_anchor))*24*60*60)
and
((trunc(collect_end_time) - to_date(v_anchor))*24*60*60) >= ((to_date(v_mostrecentscandate) - to_date(v_anchor))*24*60*60);
getOSinfo_rec getOSinfo_cur%rowtype;
getlsID_rec getlsID_cur%rowtype;
BEGIN
v_ls := 'ls';
v_anchor := '01-JAN-01';
FOR getOSinfo_rec IN getOSinfo_cur LOOP
v_osid := getOSinfo_rec.operatingsystem_id;
v_mostrecentscandate := getOSinfo_rec.mostrecentscandate;
v_scandate := getOSinfo_rec.scandate;
IF getOSinfo_rec.level2 = 'N' THEN
v_level2 := 'N';
ELSIF getOSinfo_rec.level2 = 'Y' THEN
IF v_mostrecentscandate != v_scandate THEN
FOR getlsID_rec IN getlsID_cur LOOP
v_lsid := getlsID_rec.id;
v_lsidt := v_ls||v_lsid;
v_sql := 'select id from '||v_lsidt||'_base where id = '||chr(39)||v_osid||chr(39);
EXECUTE IMMEDIATE v_sql into v_sql_baseid;
IF SQL%ROWCOUNT > 0 THEN
v_lsidt2 := v_lsidt;
v_sql := '';
END IF;
END LOOP;
v_sql := 'select number_value from '||v_lsidt2||'_attr_data where
lower(attribute_name) IN ('||chr(39)||'numcpus'||chr(39)||', '||chr(39)||'totalmemory'||chr(39)||', '||chr(39)||'cpuutilpercent'||chr(39)||', '||chr(39)||'numprocesses'||chr(39)||')
and
number_value is not NULL
and
element_id = '||chr(39)||v_osid||chr(39);
EXECUTE IMMEDIATE v_sql into v_sql_numv;
IF SQL%ROWCOUNT > 0 THEN
v_level2 := 'Y';
ELSE v_level2 := 'N';
END IF;
END IF;
v_level2 := 'Y';
END IF;
PIPE ROW (mostRecentLevel2Format(v_osid,v_mostrecentscandate,v_level2));
END LOOP;
END;
END;
/Now some will ask why I'm using pipelining? Again, I'm green.. I was reading around, looking for a way to make this code run as fast as possible (because it's potentially got to go through 56K records and perform the expensive work on).
I also realize I'm not providing the type or package code, and that's because I think I'm good on that. The code above compiles just fine without errors and when it runs, it only returns 6 consecutive rows.. I'm expecting 70K lol. So I know I'm doing something wrong. You're calling TO_DATE with a DATE argument. Why are you calling TO_DATE at all?
It seems like this condition:
((trunc(collect_start_time) - to_date(v_anchor))*24*60*60) <= ((to_date(v_mostrecentscandate) - to_date(v_anchor))*24*60*60) is equivalent to
TRUNC (collect_start_time) <= v_mostrecentscandateThat probably has nothing to do with why you're only getting 6 rows. -
Table-Valued Function not returning any results
ALTER FUNCTION [dbo].[fGetVendorInfo]
@VendorAddr char(30),
@RemitAddr char(100),
@PmntAddr char(100)
RETURNS
@VendorInfo TABLE
vengroup char(25),
vendnum char(9),
remit char(10),
payment char(10)
AS
BEGIN
insert into @VendorInfo (vengroup,vendnum)
select ks183, ks178
from hsi.keysetdata115
where ks184 like ltrim(@VendorAddr) + '%'
update @VendorInfo
set remit = r.remit
from
@VendorInfo ven
INNER JOIN
(Select ksd.ks188 as remit, ksd.ks183 as vengroup, ksd.ks178 as vendnum
from hsi.keysetdata117 ksd
inner join @VendorInfo ven
on ven.vengroup = ksd.ks183 and ven.vendnum = ksd.ks178
where ksd.ks192 like ltrim(@RemitAddr) + '%'
and ks189 = 'R') r
on ven.vengroup = r.vengroup and ven.vendnum = r.vendnum
update @VendorInfo
set payment = p.payment
from
@VendorInfo ven
INNER JOIN
(Select ksd.ks188 as payment, ksd.ks183 as vengroup, ksd.ks178 as vendnum
from hsi.keysetdata117 ksd
inner join @VendorInfo ven
on ven.vengroup = ksd.ks183 and ven.vendnum = ksd.ks178
where ksd.ks192 like ltrim(@PmntAddr) + '%'
and ks189 = 'P') p
on ven.vengroup = p.vengroup and ven.vendnum = p.vendnum
RETURN
END
GO
Hi all,
I'm having an issue where my Table-Valued Function is not returning any results.
When I break it out into a select statement (creating a table, and replacing the passed in parameters with the actual values) it works fine, but with passing in the same exact values (copy and pasted them) it just retuns an empty table.
The odd thing is I could have SWORN this worked on Friday, but not 100% sure.
The attached code is my function.
Here is how I'm calling it:
SELECT * from dbo.fGetVendorInfo('AUDIO DIGEST', '123 SESAME ST', 'TOP OF OAK MOUNTAIN')
I tried removing the "+ '%'" and passing it in, but it doesn't work.
Like I said if I break it out and run it as T-SQL, it works just fine.
Any assistance would be appreciated.Why did you use a proprietary user function instead of a VIEW? I know the answer is that your mindset does not use sets. You want procedural code. In fact, I see you use an “f-” prefix to mimic the old FORTRAN II convention for in-line functions!
Did you know that the old Sybase UPDATE.. FROM.. syntax does not work? It gives the wrong answers! Google it.
Your data element names make no sense. What is “KSD.ks188”?? Well, it is a “payment_<something>”, “KSD.ks183” is “vendor_group” and “KSD.ks178” is “vendor_nbr” in your magical world where names mean different things from table to table!
An SQL programmer might have a VIEW with the information, something like:
CREATE VIEW Vendor_Addresses
AS
SELECT vendor_group, vendor_nbr, vendor_addr, remit_addr, pmnt_addr
FROM ..
WHERE ..;
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
in Sets / Trees and Hierarchies in SQL -
The Same Excel Functions Not Giving the Same Result in Numbers
I'm been using Excel for years and now that I've made the switch to Mac, I thought I should probably utilise the iWork suite of software and get rid of Microsoft once and for all.
Whilst I love the user-friendliness, there are so many small things that Apple to appear to have overlooked which keeps me hanging on to Microsoft Office just a little, but I digress.
OK, So I have one sheet in Numbers with the following data.
I am trying I need to search Column A for the TLDs in Column C, if they exist output the correct renewal price from Column D in Column B
e.g. A2 contains .net so B2 should have 12.50 in it.
A
B
C
D
1
Domain Name
Renewal Price 1
TLDs
Renewal Price 2
2
test.net
.com
5.00
3
test.co.uk
.co.uk
10.00
4
test.com
.net
12.50
So... can someone please explain to me why the same functions which exist in Numbers and Excel (VLOOKUP / LOOKUP / SEARCH) do not work in Numbers as they do in Excel? If there is a valid reason, fine, I'll accept that, but how do I acheive the above?
The formula which WORKS in B2 in Excel but NOT in Numbers is:
=VLOOKUP(LOOKUP(32768,SEARCH(C$2:C$4,A2),C$2:C$4),$C$2:$E$4,2,FALSE)
Thanks in advance.So... can someone please explain to me why the same functions which exist in Numbers and Excel (VLOOKUP / LOOKUP / SEARCH) do not work in Numbers as they do in Excel? If there is a valid reason, fine, I'll accept that, but how do I acheive the above?
That's a form of "array function" (searching a "table array"). Numbers can't do array functions the way Excel can.
Here's one way to achieve the same goal in Numbers:
The formula in B2, copied down:
=VLOOKUP(RIGHT(A2,LEN(A2)−SEARCH(".",A2)+1),Prices::$A:$B,2,FALSE)
SG -
ReadUTFBytes() not returning the correct characters
I am reading in a text file using FileReference() in a small AIR app i'm buliding. This text file contains translations for the site I'm working on, in a bunch of different languages. I correctly receive the byteArray in the data parameter of the FileReference object I created. I am using readUTFBytes() to convert the entire data block to a String so I can parse through it and create an XML for all the different phrases and such. I am finding that most characters are read correctly into the String except for example Ž (utf-8 code 142). I trace the index value in the byteArray and correctly get the binary value 10001110 (142). If I try and readUTFBytes() on this byte individually I get nothing in the character result.
var ba:ByteArray = new ByteArray();
ba.writeBytes( _loadFile.data, 126, 1 ); //where 126 is the index of the character...yes I quintuple checked it's the correct index
ba.position = 0; //not necessary but for safe measure
var char:String = ba.readUTFBytes(ba.bytesAvailable);
trace( char );
char traces blank. And the local variable value in Flashdevelop and Flash Builder is "".
I've tried readMultiByte() with a bunch of different charSet types as well, but nothing has yielded the correct character for this value (and many others).
Has anybody ever worked with loaded text files with odd characters and run into (and hopefully solved) this issue?
ThanksHey sinious,
No I am not using URLLoader(). I am using FileReference().
public function startLoadingFile( mEvt:MouseEvent ):void
_loadFile = new FileReference();
_loadFile.addEventListener(Event.SELECT, onFileSelected);
var fileFilter:FileFilter = new FileFilter("Plain Text (*.txt)", ";*.txt");
_loadFile.browse([fileFilter]);
private function onFileSelected( evt:Event ):void
_loadFile.removeEventListener(Event.SELECT, onFileSelected);
_loadFile.addEventListener(Event.COMPLETE, onFileLoaded );
_loadFile.load();
private function onFileLoaded( evt:Event ):void
_loadFile.removeEventListener(Event.COMPLETE, onFileLoaded );
var langText:String = _loadFile.data.readUTFBytes( _loadFile.data.bytesAvailable );
I'm doing this so the desktop application I'm making (using AIR) can be used to load any local translation text file and parse it's contents.
The readMultiByte functionality in FileStream is no different than the multibyte support for a standard byteArray. You choose your length and then declare your character set.
I've tried the majority of relevant characrter sets as outlined on the Adobe page http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/charset-codes.html including "Windows-1252". Th eother "Windowa-xxxx" are for Turkish and Thai and such. These characters are all visible in the text file I'm reading from. -
Query not giving the correct result
select Project_id, contractno
from elf_transactions
where(rtrim(contractno),rtrim(project_id)) not in
(select rtrim(contractno),rtrim(projectid)
from contract_proj
where report_month='1-May-2007' )
when I m firing this query, it is not giving correct result to me, it also select the recorts which are matches in both the table
i want to fine out those contract, with projectid which are not in contract_proj table
Please help me in this regardCREATE TABLE ELF_TRANSACTIONS
VENDOR_ORDER_REF VARCHAR2(60 BYTE),
BT_SUB_CON_REF VARCHAR2(10 BYTE),
PR_NO VARCHAR2(15 BYTE),
PO_NO VARCHAR2(15 BYTE),
PR_PO_DESCR VARCHAR2(200 BYTE),
ONE_IT_PROG VARCHAR2(50 BYTE),
BT_DEL_MANAGER_NAME VARCHAR2(40 BYTE),
DELIVERY_TYPE VARCHAR2(5 BYTE),
ACTUAL_DEP_DATE DATE,
ASSOC_ASG_BR_QUE VARCHAR2(50 BYTE),
PRE_AVG_P1_P2_INC_CNT NUMBER(3),
POST_P1_P2_INC NUMBER(3),
PERC_GROWTH_POST_REL NUMBER(3),
VENDOR_DEL_MANAGER VARCHAR2(50 BYTE),
REPORT_MONTH DATE,
COMMENTS VARCHAR2(200 BYTE),
PROJECT_ID VARCHAR2(20 BYTE),
CONTRACTNO VARCHAR2(15 BYTE),
CONTRACT_TYPE NVARCHAR2(15),
IDUNO VARCHAR2(10 BYTE),
STATUS VARCHAR2(10 BYTE),
DESCRIPTIONCODEDELIVERABLE VARCHAR2(255 BYTE),
UNIQUEID VARCHAR2(255 BYTE),
LOCK_RECORD CHAR(1 BYTE),
VERIFIED CHAR(1 BYTE),
VERIFIED_BY VARCHAR2(40 BYTE),
BT_VERIFIED CHAR(1 BYTE),
BT_VERIFIED_BY VARCHAR2(40 BYTE)
CREATE TABLE CONTRACT_PROJ
CONTRACTNO VARCHAR2(10 BYTE),
PROJECTID VARCHAR2(20 BYTE),
IDUNO VARCHAR2(10 BYTE),
CH_EMPID VARCHAR2(8 BYTE),
CHNAME VARCHAR2(40 BYTE),
GH_EMPID VARCHAR2(8 BYTE),
GHNAME VARCHAR2(40 BYTE),
PM_EMPID VARCHAR2(8 BYTE),
PMNAME VARCHAR2(40 BYTE),
SPM_EMPID VARCHAR2(8 BYTE),
SPMNAME VARCHAR2(40 BYTE),
PRJ_MONTH DATE,
BT_CONTRACT CHAR(1 BYTE)
REPORT_MONTH COMMENTS PROJECT_ID CONTRACTNO CONTRACT_TYPE IDUNO STATUS DESCRIPTIONCODEDELIVERABLE UNIQUEID
06/01/2007 00:00:00 1287 TML007452 OPEN Delivery of CRs DM CD and NSI N/A
06/01/2007 00:00:00 1280 TML007452 OPEN Delivery of CRs H&W OOR and WLTO N/A
06/01/2007 00:00:00 1231 TML007452 OPEN Delivery of CRs H&W OOR WLTO
06/01/2007 00:00:00 1097 TML007679 OPEN High Level Roadmap for Global Services and Wholesale with Feasibility study into BTR access to Switc N/A
06/01/2007 00:00:00 405 TML007942 OPEN RTRCC DEVELOPMENT -Q107
06/01/2007 00:00:00 405 TML007919 OPEN WLR3 DEVELOPMENT-Q107
06/01/2007 00:00:00 1170 TML008439 OPEN R-510
CONTRACTNO PROJECTID IDUNO CH_EMPID CHNAME GH_EMPID GHNAME PM_EMPID PMNAME SPM_EMPID SPMNAME PRJ_MONTH BT_CONTRACT
MBT003060 176 BT06 8694 Soman Sameer Surendra 1054 Bhadti Shripad Shivram 1054 Bhadti Shripad Shivram 1420 Rao Darbhamulla Kameswara 05/01/2007 00:00:00 N
MBT003842 1156 BT12 19992 Kalle Ajit Ashutosh 1539 Padgaonkar Shailesh Vishwanath 13948 Khunte Milind Vasant 16426 Kulkarni Vinay 05/01/2007 00:00:00 Y
MBT004677 458 BT09 20275 Mundassery George 5044 Kamalapurkar Leena Shrinivas 12849 Dave Ajay Yogeshchandra 2017 KIRKIRE SONAL MADHUKAR 05/01/2007 00:00:00 N
MBT004695 362 BT13 20276 Ghosh Sankar 2624 Avachat Jagdish Vasantrao 13592 Pal Sudipta 2624 Avachat Jagdish Vasantrao 05/01/2007 00:00:00 N
MBT004826 VITRIA BT09 20275 Mundassery George 26099 Saha Debendra Kumar 28134 Hinge Anand Sharad 12777 Karandikar Sumedh Vidyadhar 05/01/2007 00:00:00 Y
MBT004924 1027 BT03 1451 Tillu Ashirwad 15693 Devaraj Daniel G 6867 Jadhav Satyajit Ramesh 15693 Devaraj Daniel G 05/01/2007 00:00:00 N
MBT004927 1025 BT05 4436 Kelkar Subhash Manohar 20379 Gore Sujeet Narayan 13704 Vignesh Chandrasekaran 4347 BIJNORI REHANA GULAMWARIS 05/01/2007 00:00:00 N
MBT004927 1092 BT05 4436 Kelkar Subhash Manohar 15094 Jain Jitendra 13350 Bokil Shripad Raghunath 9511 Markande Balchandra Narayan 05/01/2007 00:00:00 N
MBT004927 1213 BT09 20275 Mundassery George 19996 Vege Sridhar 16401 Sibgathulla Mohammed 19996 Vege Sridhar 05/01/2007 00:00:00 N -
Discovery seach does not return the correct messages
We're trying to produce what I thought would be simple reports on the entire mail database. We have a simple single Exch2010 box. When using the discovery search tool, it is returning WAY too much of the wrong info. I just want to put in keywords, restrict
the FROM to a single @domain.com and limit by date. It seems like the tool would do such a simple thing, but it doesn't seem to filter out on the FROM at all. It just does the keywords and dates. Without the limit on the From domain there are thousands of
incorrect hits.
I have the latest CU's, the user is definitely part of the discovery role group, it works on just keywords, but its just spewing all kinds of useless information. Anyone have any ideas? I really don't use powershell and would prefer not to since I have a
bunch of these to do in various options, but I can't trust the data.
Curt Kessler - FLCHi Curt,
To know more about the issue, could you please let me know the search query you specified which give unexpected result? Since you mentioned you don’t want to use shell, are you using ECP? When
perform the search, how did you specify the “Keywords” and “Messages To or From Specific E-mail Address”? Which mailbox did you use as the destination mailbox to store the search result?
I recommend not choose the “Include items that can’t be searched” and “Enable deduplication” option. Please try again and give me a screenshot of the result
if still other emails from other senders appear in the search result. Please set the keywords as format
“Keywords”1 AND (“Keywords2” OR “Keywords3”)
Note: If we only specify one keywords, what’s the result? Please test and check.
Meanwhile, to narrow down the issue, it’s recommend to use shell to search, it’s useful to test the issue and verify if the same result using the same search queries and still emails form other
senders appear. For example:
New-MailboxSearch -Name "Search-20140307" -TargetMailbox “Target mailbox to store the search result” -StartDate "01/01/2014" -EndDate "03/07/2014" -Senders "sender
email address or domain name" -SearchQuery "search keywords" -ExcludeDuplicateMessages
For more information about discovery search, we can refer to the following articles:
Title: Mailbox Search
Link1:
http://technet.microsoft.com/en-us/library/dd298064(v=exchg.141).aspx
Link2:
http://technet.microsoft.com/en-us/library/dd335072(v=exchg.141).aspx#PDS
Link3:
http://www.msexchange.org/articles-tutorials/exchange-server-2010/compliance-policies-archiving/managing-multi-mailbox-search-exchange-server-2010-part2.html
Regards, Eric Zou -
FileReader does not return the correct byte value of the characters
I have some text in a very old persian code page and all I have from this code page is numerical table of the characters(like ASCII table).
With a HashMap, the equivalent Unicode characters are mapped to the numerical values. With using FileInputStream and its read() method, it converts corretly;
but by using the FileReader (following code snippet), just a few characters cannot be read correctly so it cannot be mapped correctly either.(I tryed several encodings too)
FileReader in = new FileReader("inputFile");
BufferedReader b = new BufferedReader(in);
Stirng s = b.readLine();
byte[] by = s.getBytes("encoding");
I need to work with strings for conversion; so is ther any solution for it?I have some text in a very old persian code page and
all I have from this code page is numerical table of
the characters(like ASCII table).
With a HashMap, the equivalent Unicode characters are
mapped to the numerical values. With using
FileInputStream and its read() method, it converts
corretly;
but by using the FileReader (following code snippet),
just a few characters cannot be read correctly so it
cannot be mapped correctly either.(I tryed several
encodings too)
FileReader in = new FileReader("inputFile");
BufferedReader b = new BufferedReader(in);
Stirng s = b.readLine();
byte[] by = s.getBytes("encoding");
I need to work with strings for conversion; so is ther
any solution for it?Use FileInputStream to read the data into bytes, then use your mapping to convert bytes to characters. Then create a string representation by appending the characters to a StringBuffer. You can't use FileReader because readers convert bytes to characters using a character encoding, which you don't have.
Maybe you are looking for
-
How to get to a 2nd Free iCloud Email Accounts under one Apple ID
How to get to a 2nd Free iCloud Email Accounts under one Apple ID. I just got my iphone 5 and I setup a icloud [email protected] with the email address. I am also using this as my Apple ID now due to I could not use it in facetime or imessge without
-
Unable to Open Canon 60D RAW files in PSE9
Since I got my new camera Canon 60D, I have not been able to open the RAW (CR2) files in my Photoshop Elements 9. The ones from my previous camera I could. I have installed the Solutions software that came with the camera and have gone to both the C
-
Inserting row in Updateable Report
Hi all, I have an updateable report that I can update no problem. However, when I try insert a record I get the following error ... Error in mru internal routine: ORA-20001: Error in MRU: row= 1, ORA-20001: ORA-20001: Current version of data in datab
-
I CAN'T INSTALL FINAL CUT PRO 3 ON MY NEW INTEL IMAC, HELP!!!
I'm trying to install FINAL CUT PRO 3 onto my new iMac but can't. It reads the disk but then says, "Original disk needed for install." I have the original disk, I own a registered copy of the program, so I'm stuck.
-
Updating to signed JARs causes problems for older Java versions?
Bear with me on this one -- not a Java developer, but an end user of Java products looking for a little clarification. We use a product which delivers a Java application via JAR file / web to end users (GlobalScape's EFT server). With the recent rel