How to calculate XOR in pl/sql
could you please tell me how to calculate XOR in pl/sql?
Here are some examples
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1284001741333
Similar Messages
-
Dynamically how to calculate expression through PL/SQL ..?
My senario like...
I want to calculate the expression using array values from input parameter and then I want to send that calculated values as a output parameter.
How to do through PL/SQL..?
I am passing two parameter.
1. expression variable value as array,
2. expression as string
I want to execute that expression using Execute immediate or any other way through PL/SQL.
For Example,
exec myPL_SQLproc(p1,p2)
p1,p2 = (1,2,3), 'a*(a+10)-b+c'
p1,p2 = (1,2,3,4,5), '((a+b+c+d+e)+(a-b-c-d-e))*log(a)' here base10 for log(a).
here p1 is array (pl/sql table type)
p2 is string (expression: varchar2 type)Although I think this is likely to be a bad design decision, you can use something like:
DECLARE
TYPE values_tp IS VARRAY(10) OF NUMBER;
l_values_tp values_tp := values_tp(1,2,3);
l_expr VARCHAR2(25) := 'a*(a+10)-b+c';
l_exec VARCHAR2(25);
l_result NUMBER;
BEGIN
FOR i IN 1 .. l_values_tp.COUNT LOOP
l_expr := REPLACE(l_expr, CHR(96+i), l_values_tp(i));
END LOOP;
DBMS_OUTPUT.Put_Line(l_expr);
EXECUTE IMMEDIATE 'SELECT '||l_expr||' FROM dual' INTO l_result;
DBMS_OUTPUT.Put_Line('Result is '||l_result);
END;Minimally, you should check the formula string for things like semi-colons (;) and two consecutive hyphen (--) which could indicate a sql injection attempt. You would also probably need much more error handling.
TTFN
John -
How to calculate HASH_VALUE for Specific SQL
I have an auditing trigger and want to filter out known statements.
I can, from within the trigger, obtain the SQL that fired the trigger (dbms_standard.sql_txt function).
I want to be able to calculate the HASH_VALUE for this SQL to use in a decision tree.
If I have auditing enabled (I do) I can use the audsid {sys_context('USERENV','SESSIONID')} to lookup my SID and from there peruse several V$ views. This seems rather cumbersome.
Does anyone know of a built-in function to either calculate the HASH_VALUE, when given SQL_TEXT or to return the HASH_VALUE for the firing SQL statement?
ThanksHi,
SQL> select count(1) from user_tables;
COUNT(1)
21805
SQL> select hash_value,sql_text
2 from v$sqlarea
3 WHERE sql_text LIKE 'select count(1) from user_tables%';
HASH_VALUE
SQL_TEXT
2802460921
select count(1) from user_tables
SQL> Nicolas. -
How to calculate IO on SQL Query.
Hi all,
Could u please tell me how to calculate IO for specific SQL Query.
Regards,
Santosh.In what context you are looking the IO consumed for the query? One option you have got is Autotrace,another can be tracing the query and formatting the results using Tkprof.
Aman.... -
How to calculate the HFM Cube size in SQL Server-2005
Hi
How to calculate the HFM Cube size in SQL Server-2005 ?
Below query used for Oracle. Then what is query for SQL Server?
SQL> select sum(bytes/1024/1024) from dba_segments where segment_name like 'FINANCIAL_%' and owner='HFM';
SUM(BYTES/1024/1024)
SQL> select sum(bytes/1024/1024) from dba_segments where segment_name like 'HSV FINANCIAL%' and owner='HFM';
SUM(BYTES/1024/1024)
Regards
SmileeWhat is your objective? The subcube in HFM is a concept which applies to the application tier - not so much to the database tier. The size of the subcube is the unique number of data strips (data values for January - December inclusive, for example) for the given entity, currency triplet or Parent.Child node. You have to account for parent accounts and customs which don't exist in the database but are generated in RAM in the application tier.
So, if your objective is to find the largest subcubes, you could do this by querying the database and counting the number of records per entity/value (DCE tables) or parent.child entity combination (DCN tables). I'm not versed in SQL, but I think the script below would just tell you the schema size and not the subcube sizes.
Check out Accelatis.com for a third party software product that can do this for you. The feature is called the Subcube Analyzer and was written by the same team that wrote HFM, so they ought to know how this works :-)
--chris -
How to calculate the total running time for process from sysssislog entries
Hi All,
I have the below query which gets me the log entries form the logs table when the process started/completed.
Select row_number() over (order by starttime) row_num,Substring( Substring(message, CharIndex('''',message) +1 ,Len(message)) ,0, CharIndex('''',Substring(message, CharIndex('''',message) +1 ,Len(message)))) as Description,
starttime,endtime,message
from dbo.sysssislog
where (message like 'start%' or message like 'finish%' ) and
LEFT(Substring( Substring(message, CharIndex('''',message) +1 ,Len(message)) ,0, CharIndex('''',Substring(message, CharIndex('''',message) +1 ,Len(message)))),1) between 'A' and 'Z'
order by starttime
However,I have to build a report on the top of it showing how much time that attribute/dimension/heirarchy took to execute(Ex-How much time did YearlyReview dimension take to complete).I dont have much knowledge of T-SQL and unable to figure out how to calculate
that on SQL or report level.
Could someone please assist me in getting the exact query for that?
Thanks a lot.I get the below output(sample 20 rows) on executing this query.Also,a start process does not necessarily follow up a finished message for the same dimension as it may have been stopped or it failed.So we need to leave it as NA in case it started but dint
finish
Row_Num Description starttime endtime Message
1 PAC SC Super Type 12/13/12 16:38 12/13/12 16:38 Started processing the 'PAC SC Super Type' dimension.
2 PAC SC Super Type 12/13/12 16:38 12/13/12 16:38 Started processing the 'PAC SC Super Type' dimension.
3 Team Member Indicator 12/13/12 16:38 12/13/12 16:38 Started processing the 'Team Member Indicator' dimension.
4 Team Member Indicator 12/13/12 16:38 12/13/12 16:38 Started processing the 'Team Member Indicator' dimension.
5 PAC SC Super Type 12/13/12 16:38 12/13/12 16:38 Started reading data for the 'PAC SC Super Type' attribute.
6 PAC SC Super Type 12/13/12 16:38 12/13/12 16:38 Started reading data for the 'PAC SC Super Type' attribute.
7 Specialist Merger Indicator 12/13/12 16:38 12/13/12 16:38 Started reading data for the 'Specialist Merger Indicator' attribute.
8 Specialist Merger Indicator 12/13/12 16:38 12/13/12 16:38 Started reading data for the 'Specialist Merger Indicator' attribute.
9 YearlyReview 12/13/12 16:38 12/13/12 16:38 Started processing the 'YearlyReview' dimension.
10 YearlyReview 12/13/12 16:38 12/13/12 16:38 Started processing the 'YearlyReview' dimension.
11 PAC SC Repeat Caller 12/13/12 16:38 12/13/12 16:38 Started processing the 'PAC SC Repeat Caller' dimension.
12 PAC SC Repeat Caller 12/13/12 16:38 12/13/12 16:38 Started processing the 'PAC SC Repeat Caller' dimension.
13 Year 12/13/12 16:38 12/13/12 16:38 Started reading data for the 'Year' attribute.
14 Year 12/13/12 16:38 12/13/12 16:38 Started reading data for the 'Year' attribute.
15 Staffing Function 12/13/12 16:38 12/13/12 16:38 Started processing the 'Staffing Function' dimension.
16 Staffing Function 12/13/12 16:38 12/13/12 16:38 Started processing the 'Staffing Function' dimension.
17 PAC SC Repeat Caller 12/13/12 16:38 12/13/12 16:38 Started reading data for the 'PAC SC Repeat Caller' attribute.
18 PAC SC Repeat Caller 12/13/12 16:38 12/13/12 16:38 Started reading data for the 'PAC SC Repeat Caller' attribute.
19 PAC HV Cust 12/13/12 16:38 12/13/12 16:38 Started processing the 'PAC HV Cust' dimension.
20 PAC HV Cust 12/13/12 16:38 12/13/12 16:38 Started processing the 'PAC HV Cust' dimension. -
How to calculate the Daily Call Volume
Hello,
Can anyone please advise how to calculate the daily call volume in a contact center - the counts of the calls terminated in ICM ?
Is there any webview report or a SQL query which provides the count ?
Many thanks in advance for the help!
Thanks & Regards,
NareshThe ICM software generates a Termination_Call_Detail record for each call that arrives at the peripheral. From This report you can get the number of calls to ICM as well as the call details.
To get the report run this sql query
select * from dbo.t_Termination_Call_Detail where convert (varchar(10), DateTime, 101) = '12/03/2010' -
How to calculate AP invoice and AP downpayment AR Credit Memo together?
Dear All,
Does anyone know how to calculate AP invoice and AP downpayment AR Credit Memo together for the purchase summary, by using SQL statement?
Is it sum altogether...like AP_Invoice + AP downpayment - AP Credit Memo?
The result as shown below:
BP_Code Total
XXXXXXXX $10,000
From Samson
Edited by: samson leung on Jun 10, 2009 9:49 AMTry this to start:
Select T0.CardCode 'Vendor#', Sum(t0.DocTotal - isnull(t3.DocTotal,0)) 'Total'
from dbo.opch t0
inner join dbo.pch1 t1 on t1.docentry = t0.docentry
left join dbo.rpc1 t2 on t2.docentry = t1.TrgetEntry
left join dbo.orpc t3 on t3.docentry = t2.docentry
group by T0.CardCode
Thanks,
Gordon -
How to calculate #Buffer Gets # Exec Buffer Gets/Exec
Hi,
How to calculate #Buffer Gets,# Execution time,Buffer Gets/Exec for a sql query?Nirmal
You can find out these statistics from two places
1) using SQL_TRACE (10046 trace) and then TKPROF (or Autotrace in SQL*Plus)
2) or looking at V$SQL which records the cost assigned to each SQL statement since the statement was first cached.
If you use Statspack or AWR, you can see the difference between two points in time, so you can calculate the cost for a period of time.
See Using SQL_Trace and TKPROF
http://download-uk.oracle.com/docs/cd/B10501_01/server.920/a96533/sqltrace.htm#1018
and Using Statspack
http://download-uk.oracle.com/docs/cd/B10501_01/server.920/a96533/statspac.htm#34837
(see the 10g documentation equivalents if necessary).
Remember, ratios (eg gets/exec) aren't always very helpful. You're best off concentrating on those operations which take longest (ie where there is the most potential to save time). See (eg) www.hotsos.com, www.oraperf.com, and others to identify effective performance methodologies.
HTH
Regards Nigel -
How to calculate table size given the structure.
Today i was asked how to estimate the size of the table given th transactions,.
table has 90 column all varchar(10)
How to calculate the size of table which has no data.
Message was edited by:
Maran.Ehi,
SQL> create table test as select * from all_objects ;
Table created.
SQL> create table test1 as select * from all_objects where 1 = 2 ;
Table created.
sql>select segment_name,bytes/1024/1024 "size", blocks
from dba_segments
where segment_name in ('TEST','TEST1')
SEGMENT_NAME
size BLOCKS
TEST1
.0625 8
TEST
6 768regards
Taj -
How to calculate percentage and difference of two values in matrix report in ssrs 2008
Hi everyone,
DB--SQL server
SSRS-2008
I am creating matrix report with grouping on WEEK and Fiscalyearweek,
I need to calculate of difference between FY14W01,FY15W01 ande percentage of those..
how to calculate in ssrs level.
Thank You, Manasa.VHi veerapaneni,
According to your description, you want to calculated the increment percentage and difference between two fiscal year week within each week. Right?
In this scenario, since we need to do calculation based on values between dynamically generated cells, we can't simply use expression to achieve this goal. In this scenario, we need to use custom code to record the value for fiscal 14 and fiscal 15, then
we can calculate the difference and percentage within the column group. We have tested your case in our local environment, please refer to the steps and screenshots below:
1. Add the custom code below into the report (you may need to modify the data type based on your scenario:
Public Shared Value1 as Integer
Public Shared Value2 as Integer
Public Shared previous as string
Public Shared previousweek as string
Public Shared Function GetValue(Value as Integer,product as String,Week as String) as Integer
If product =previous and Week =previousweek Then
Value2=Value
Else
previous=product
previousweek=Week
Value1=Value
End If
return Value
End Function
Public Shared Function GetPct()
return (Value2-Value1)/Value1
End Function
Public Shared Function GetDiff()
return Value2-Value1
End Function
2. Design the matrix like below:
3. The result look like below:
If you have any question, please feel free to ask.
Best Regards,
Simon Hou -
How to calculate number of threads running on Windows 2000 terminal?
How to calculate number of threads running on Windows 2000 terminal for the oracle process?
I have installed Oracle 9i DataBase with 6 patch(9.2.0.6.0) on Windows 2000 Terminal.
But,after database is started up, when i check up the sessions in v$session view.
It is showing like for SYSTEM osuser alone, 10 ORACLE.EXE sessions running on this server machine in active state.
Why it is creating 10 ORACLE.EXE sessions for a single Oracle Server.
This is the output of v$session view.
SQL> select terminal,osuser,status,sid,serial#,program from v$session;
TERMINAL OSUSER STATUS SID SERIAL# PROGRAM
IMGDBSVR SYSTEM ACTIVE 1 1 ORACLE.EXE
IMGDBSVR SYSTEM ACTIVE 2 1 ORACLE.EXE
IMGDBSVR SYSTEM ACTIVE 3 1 ORACLE.EXE
IMGDBSVR SYSTEM ACTIVE 4 1 ORACLE.EXE
IMGDBSVR SYSTEM ACTIVE 5 1 ORACLE.EXE
IMGDBSVR SYSTEM ACTIVE 6 1 ORACLE.EXE
IMGDBSVR SYSTEM ACTIVE 7 1 ORACLE.EXE
IMGDBSVR SYSTEM ACTIVE 8 1 ORACLE.EXE
IMGDBSVR SYSTEM ACTIVE 9 1 ORACLE.EXE
IMGDBSVR SYSTEM ACTIVE 10 1 ORACLE.EXE
SUGANTHI_DBA suganthi ACTIVE 11 91 sqlplusw.exe
11 rows selected.
SQL>This is how i have related these two views:
SQL> select s.terminal,s.osuser,s.status,s.paddr s_paddr,b.paddr p_paddr,s.program
2 from v$session s,gv$bgprocess b
3 where s.paddr=b.paddr;
TERMINAL OSUSER STATUS S_PADDR P_PADDR PROGRAM
IMGDBSVR SYSTEM ACTIVE 33AF2270 33AF2270 ORACLE.EXE
IMGDBSVR SYSTEM ACTIVE 33AF2654 33AF2654 ORACLE.EXE
IMGDBSVR SYSTEM ACTIVE 33AF2A38 33AF2A38 ORACLE.EXE
IMGDBSVR SYSTEM ACTIVE 33AF2E1C 33AF2E1C ORACLE.EXE
IMGDBSVR SYSTEM ACTIVE 33AF3200 33AF3200 ORACLE.EXE
IMGDBSVR SYSTEM ACTIVE 33AF35E4 33AF35E4 ORACLE.EXE
IMGDBSVR SYSTEM ACTIVE 33AF39C8 33AF39C8 ORACLE.EXE
IMGDBSVR SYSTEM ACTIVE 33AF3DAC 33AF3DAC ORACLE.EXE
IMGDBSVR SYSTEM ACTIVE 33AF4958 33AF4958 ORACLE.EXE
IMGDBSVR SYSTEM ACTIVE 33AF4D3C 33AF4D3C ORACLE.EXE
10 rows selected.
SQL>
Here, It shows 10 sessions are running.
Whether this means 10 threads are running on the particular server or not? -
How to calculate memory usage base on graphic utilization
Dear All ,
We have t2000 server with solaris 10 and 15 zones inside , and install SMC server include module ,Harddware configuration is 16 Gb Memory , 4 x 72 gb Hardisk and Swap 4Gb .,from menu Manage container manager , we select host of the server then click utilization , but i see memory usage 19759 Mb , How to calculate memory from this graph ? cause maximum ream RAM only 16 Gb in our server.
Regards
HadiPL/SQL collections are stored in the PGA. So you can monitor the PGA utilization of the session(s) to see how much PGA they use.
SELECT sid, name, value
FROM v$statname name
JOIN v$sesstat using (statistic#)
WHERE name.name in ('session pga memory', 'session pga memory max' )That will show you, for each session, the current PGA consumed by the session and the high water mark of PGA consumption by that session. You can join to V$SESSION and add additional predicates to narrow things down to the particular sessions you are interested in.
Justin -
How to calculate New customers and Returning customers in a Pivot Table?
Hi,
I have a Pivot table with columns as Order Date, Customer Name, Qty, Cost, Freight, Invoice, Adv Payment. I have only 30 customers and 11000 transactions for 4 years sales period.
How to calculate New customers and Returning customers in Pivot Table for any given Month or Quarter or Year. I am open to use helper column, formula or a calculated field etc
Thanks
ArjunHi Arjun,
I have received the file and read it, based on your further explain, I know your requested more clarity. In my view, the requested could be done via VBA code or Select function in other dataset, like Access/SQL. (Because before we count the new
customer and return customer, we might to filter them via rule, the formula need to assign the customer one by one. So, it's inefficient)
Thus, I recommend we try the above workaround: Use macro or Select function in Access. If you have further question about the coding, please post 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. -
Hi all
How to calculate the salary of the employees when they are differentiated by monthly and hourly basis
How can we write the logic though sql
Thanks in advance(case when pay_basis like 'HOURLY'
then PROPOSED_SALARY_N*pay_annualization_factor
when pay_basis like 'ANNUAL'
then PROPOSED_SALARY_N*pay_annualization_factor
end )
I was actually trying to write the logic in this way but it was not calculating in correct format for hourly paid employees
Maybe you are looking for
-
I need help, speach over got accidently turned on in my Iphone 6, now i cant get into my phone it wont take my pass word and when I try to use Siri it says not available what do I do
-
ICloud : error message when trying to delete iPhone 4 back up
Just wondering if any one else is having this problem. I got my new iphone 4S in the mail yesterday. I went on my older iPhone 4 and did a iCloud back up of it. The only snag I have hit thus far is its still downloading photos. Which does not bother
-
I need to add bluetooth/wireless capabilities to g5?
i'm basically computer illiterate - picked up an older powermac g5 w/ 1.8 dual processor - model id powermac 7,2 what do i need to get for wireless and bluetooth - i know i need a card and antenna - dont know which ones will work and i dont want to s
-
Canceled service before end of contract and billing cycle. Being charged an extra month!
Hi. I have been a loyal Verizon wireless customer for a long while, but have had such a bad experience in the past year (where I have paid bills as high as $700.00) that I decided to cancel my services and move to another network. My billing cycle ru
-
GetCharIndexAtPoint() equivalent in Spark RichEditableText
I want to find a way to get the character index in a Spark based RichEditableText based on mouse x, y position. The mx.controls.TextArea has a protected getCharIndexAtPoint() method but I can't find an equivalent of this in the Spark RichEditableT