Append string to each column value
Version:11.2
create table test1 (name1 varchar2(10));
insert into test1 values ('JUPITER');
insert into test1 values ('EARTH');
insert into test1 values ('MARS');
insert into test1 values ('VENUS');
commit;
SQL> select * from test1;
NAME1
JUPITER
EARTH
MARS
VENUSFor each values of this table, I want three rows to be returned with the string
JUPITER is a planet
JUPITER is almost round
JUPITER revolves around the sun
EARTH is a planet
EARTH is almost round
EARTH revolves around the sun
MARS is a planet
MARS is almost round
MARS revolves around the sun
.Any idea how I could do this ?
You'll need to cross join a set of three rows to your base table.
There are different ways to do it, for example :
SQL> select name1 ||
2 case n when 1 then ' is a planet'
3 when 2 then ' is almost round'
4 when 3 then ' revolves around the sun'
5 end as final_name
6 from test1
7 cross join (
8 select level n
9 from dual
10 connect by level <= 3
11 )
12 order by 1
13 ;
FINAL_NAME
EARTH is a planet
EARTH is almost round
EARTH revolves around the sun
JUPITER is a planet
JUPITER is almost round
JUPITER revolves around the sun
MARS is a planet
MARS is almost round
MARS revolves around the sun
VENUS is a planet
VENUS is almost round
VENUS revolves around the sun
12 rows selected
SQL> select name1 || text as final_name
2 from (
3 select name1
4 , ' is a planet' as text1
5 , ' is almost round' as text2
6 , ' revolves around the sun' as text3
7 from test1
8 )
9 unpivot (text for text# in (text1, text2, text3))
10 ;
FINAL_NAME
JUPITER is a planet
JUPITER is almost round
JUPITER revolves around the sun
EARTH is a planet
EARTH is almost round
EARTH revolves around the sun
MARS is a planet
MARS is almost round
MARS revolves around the sun
VENUS is a planet
VENUS is almost round
VENUS revolves around the sun
12 rows selected
Similar Messages
-
Getting count of occurances of a string in a column value
Hi,
Is there a way to get the number of occurences of a string in a single column value?
Example:
CREATE TABLE STRING_CNT(X VARCHAR2(100));
INSERT INTO STRING_CNT(X) VALUES('OracleXXOracleXXOracleXXOracle');
Commit;
Now the string 'Oracle' is repeated 4 times in the inserted value. I would like to get this count using SQL.Can some one tell me how to get this?
I was asked this interesting question in an interview today.hi<br>
u can get the occurrence of a string in text as
follow<br>
>
SELECT (LENGTH(x)-LENGTH(REPLACE(x,'Oracle', ' ' )))<br>
/ LENGTH('Oracle') as<br>
Occurrence FROM STRING_CNT;<br><br>
<br>
Are you sure...?<br>
<br>
<br>
SQL> with STRING_CNT as
2 (select '1.Oracle2.Oracle3.' x
3 from dual)
4 SELECT (LENGTH(x)-LENGTH(REPLACE(x,'Oracle', ' ' ))) / LENGTH('Oracle') as Occurrence
5 FROM STRING_CNT;
OCCURRENCE
1.66666667
<br>
Sidenote: Please give a try before posting..<br>
And you are posting a wrong solution after a TESTED right solution posted hours before.. -
Getting number for each column value based on Date order
Hi,
I have Data look like:
I need to create new column highlighted in red (Team Number). Even if same team comes in several number of times, it should be tracked as new team with whatever is the next number. For eg. team2 comes second time, its is called as 3. If Team 2 comes again
then it will be 4.
Any help is appreciated.
Thanks,
PuniaThanks for you reply Ricardo. It does work (but only if select 1 ticket).
My bad I only posted one Ticket Number. Actually there are lots of them ( as below). Your code take all the tickets as one tickets.
TicketNumber
OwningTeam
Status
Date
Team Number
123
TEAM 1
Pick Up
11/12/2014
1
123
TEAM 1
Complete
11/12/2014
1
123
TEAM 2
Pick Up
11/12/2014
2
123
TEAM 2
Complete
11/12/2014
2
123
TEAM 2
Resolve
11/17/2014
2
123
TEAM 2
Complete
11/24/2014
2
123
TEAM 2
Pick Up
12/8/2014
2
123
TEAM 2
Complete
12/9/2014
2
123
TEAM 2
Provide Info
12/17/2014
2
123
TEAM 1
Pick Up
1/8/2015
3
123
TEAM 1
Resoved
1/8/2015
3
456
TEAM 1
Pick Up
11/12/2014
1
456
TEAM 1
Complete
11/12/2014
1
456
TEAM 2
Complete
11/24/2014
2
456
TEAM 2
Pick Up
12/8/2014
2
456
TEAM 2
Complete
12/9/2014
2
456
TEAM 3
Pick Up
12/17/2014
3
456
TEAM 3
Working
12/18/2014
3
456
TEAM 1
Pick Up
1/8/2015
4
456
TEAM 1
Resoved
1/8/2015
4
789
TEAM 1
Pick Up
11/12/2014
1
789
TEAM 1
Complete
11/12/2014
1
789
TEAM 2
Complete
11/24/2014
2
789
TEAM 2
Pick Up
12/8/2014
2
789
TEAM 2
Complete
12/9/2014
2
789
TEAM 1
Complete
12/12/2014
3
Any work around is really appreciated.
Thanks,
Rajneet -
Format check for each column in csv file
i want to find out how to check each column value is correct or not while uploading flat file(csv).
after uploading to internal table,
it should display error record and line no of the record.
ex matnr(18) type c,
werks(4) type c.
if we input matnr value more than 18 characters in csv file,
the entire record of internal table should be displayed in log file.
it should validate before sap database validations.Hi,
Since the file format is csv, while uplaoding the data to the program using the function module, the importing FILE FORMAT is 'ASC' and not 'DAT'.
For this the Internal table should contain only one filed of type C length (255 or 1024, upto you).
Then after this using SPLIT command you will push into another Internal table.
This is where you have to perform the validations.
In my opinion instead of checking the number of characters, chcek whether the material or plant exists in SAP or not?
This is because you have already fixed the filed length of material to 18 charecters, obvious when you try to move a variable with more than 18 charecters to this filed, it will automatically truncate and take only 18 charecters..
Hope I haev answered you. If still have any questions. shoot.
BR
Sree -
Concatenating column values does not work (in SQLplus)
I entered the following command in SQLplus and expected to get a string where all column values are (comma) concatenated:
select ''||username||','||'' from dba_users;
Unfortunatly instead of
SYSTEM,SYS,ANONYMOUS,XDB,.....
all users were listed in a column of a result table.
How else can I concat them as intended
PeterHi,
That's called "String Aggregation".
Starting in Oracle 11.2, the function LISTAGG does that.
AskTom:
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:2196162600402
shows several different ways to do it, for versions 9 and up.
I recommend the first one, the user-defined function STRAGG, which is similar to LISTAGG, and which you can copy from that page.
Once you have STRAGG installed, your query is simply
SELECT STRAGG (username) AS all_usernames
FROM dba_users
;On Oracle 10 (and up) you may have a similar function, WM_CONCAT (owned by WMSYS), already installed.
WM_CONCAT is not documented, so you may not want to use it in your Production applications.
Another good site concerning String Aggregation is
http://www.oracle-base.com/articles/10g/StringAggregationTechniques.php
If you're wondering why your original query didn't do what you hoped:
SELECT ...
FROM table_x;(withoiut a WHERE clause or any other clauses) is guaranteed to produce on row of output for every row in table_x. It doesn't matter what is in the SELECT clause; there will always be one output row fro every original row. -
How to select each character of column value
Hi All,
How can i get each character separately of a column value in a select statement.
LIKE i emp table if ename='Test' then i want
a select statement that can give me the result like this
T,e,s,t
Regards,
Anil Ror this?
SQL> create table mytable
2 as
3 select 'test' text from dual union all
4 select 'a text, containing two comma''s (,)' from dual union all
5 select 'a text ending with a comma,' from dual
6 /
Tabel is aangemaakt.
SQL> select text
2 , substr(regexp_replace(text,'(*?)',',\1'),2,length(text)*2-1) with_commas
3 from mytable
4 /
TEXT WITH_COMMAS
test t,e,s,t
a text, containing two comma's (,) a, ,t,e,x,t,,, ,c,o,n,t,a,i,n,i,n,g, ,t,w,o, ,c,o,m,m,a,',s, ,(,,,)
a text ending with a comma, a, ,t,e,x,t, ,e,n,d,i,n,g, ,w,i,t,h, ,a, ,c,o,m,m,a,,
3 rijen zijn geselecteerd.Regards,
Rob.
Message was edited by:
Rob van Wijk
Slight modification to cater for strings beginning and ending with commas. -
How i pass table column value to string variable or return to java applete
Hi Master,
How do I pass a table column value into string variable. See my code below:
import java.sql.*;
public class Waheed {
public Waheed() {
public static void main (String args [])
String s = "9 23 45.4 56.7";
System.out.println ("going for connection");
// DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn =
DriverManager.getConnection("jdbc:oracle:thin:@fahim:1521:aamir","muhammad","mfa786");
Statement stmt = conn.createStatement();
ResultSet rset = stmt.executeQuery("select accid from accbal");
System.out.println ("going for connection");
while (rset.next())
s= rset.getString("accid"); this line give me error
System.out.println (rset.getString("accid"));
System.out.println (s);
catch(Exception e){
e.printStackTrace();
This line give me an error:
s= rset.getString("accid");
s is string variable
Plese give me an idea how I can pass accid in s variable.
Thanks.
AamirSee the code sample in the following thread (try using upeercase).
JDBC connection
Kuassi -
How to display the value of a column in a chart at the top of each column
How to display the value of each column in a chart at the top of each column?
Like this?
Done using chart Inspector.
For details, see Chapter 7, Creating Charts from Numerical Data in the Numbers '09 User Guide. The guide may be downloaded via the Help menu in Numbers.
Regards,
Barry -
i have a text file with numerical data in three columns,(first i need to skip the few lines of text within the file above the three column of data values)then i need to convert the numerical values above "-999" to zero,then take the average of each 500 values in the first column (second and third colum needs the same operation separately),thus found average values are to be stored into a text file and finally plotted in a graph separately. Please help.Its apart of my project work.
Solved!
Go to Solution.
Attachments:
data file.txt 715 KBi have a text file with numerical data in three columns,(first i need to skip the few lines of text within the file above the three column of data values)then i need to convert the numerical values above "-999" to zero,then take the average of each 500 values in the first column (second and third colum needs the same operation separately),thus found average values are to be stored into a text file and finally plotted in a graph separately.
" i am attaching the code tht i hv done so far, its for reading and plotting the numerical data from text, but its not working :-( "
Attachments:
read from text and plot.vi 26 KB
sample input.txt 1 KB
final input to be read and plot.txt 345 KB -
Find the average of each 500 values in a column [text file]
please help, i hv a text file with three columns of integer values. I need to take 500 values in each column and replace them with their average.
Solved!
Go to Solution.
Attachments:
11.txt 715 KBA lof if this could probably be simplified. Here are some ideas.... Many thing could be improved even more.
LabVIEW Champion . Do more with less code and in less time .
Attachments:
averageMOD.vi 16 KB -
Distinct values in each column
Hi
I have a table with three columns and I would like to display distinct values in each column. Could any one please help me to get the output.
col1 col2 col3
==== ==== ====
a 1 x
a 2 y
a 3 z
a 4 u
b 5 v
b 6 x
b 7 x
b 9 x
b 10 y
b 11 y
b 12 y
b 13 y
b 14 x
b 15 y
b 16 z
b 17 u
b 18 v
b 19 x
b 20 x
c 21 x
c 22 y
c 23 y
c 24 y
c 25 y
c 26 x
c 27 y
c 28 z
Output needed
===========
col1 col2 col3
==== ==== ====
a 1 x
b 2 y
c 3 z
4 u
5 v
6
7
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Thanks
Vasanthbut the only drawback - you need to know the column, comprising the biggest amount of distinct values beforehand.No. There is no any difference in which column will be chosen as "based".
For demo purposes I've added extra row number column to show full generality and symmetry of the approach:
exec dbms_random.seed(0)
with t as ( select chr(ascii('a') + dbms_random.value(0, 3)) as c1,
trunc(dbms_random.value(1, 20)) as c2,
chr(ascii('u') + dbms_random.value(0, 6)) as c3
from dual connect by level <= 20
tt1 as ( select lag( null, 1, c1) over (partition by c1 order by null) as c1,
lag(to_number(null), 1, c2) over (partition by c2 order by null) as c2,
lag( null, 1, c3) over (partition by c3 order by null) as c3
from t
tt2 as ( select tt1.*,
row_number() over (order by c1) as rn1,
row_number() over (order by c2) as rn2,
row_number() over (order by c3) as rn3,
rownum rn
from tt1
tt3 as ( select case when rn1 > rn
then last_value(c1) over (order by rn1 range between abs(rn1 - rn) preceding
and abs(rn1 - rn) preceding)
else last_value(c1) over (order by rn1 range between abs(rn - rn1) following
and abs(rn - rn1) following)
end as c1,
case when rn2 > rn
then last_value(c2) over (order by rn2 range between abs(rn2 - rn) preceding
and abs(rn2 - rn) preceding)
else last_value(c2) over (order by rn2 range between abs(rn - rn2) following
and abs(rn - rn2) following)
end as c2,
case when rn3 > rn
then last_value(c3) over (order by rn3 range between abs(rn3 - rn) preceding
and abs(rn3 - rn) preceding)
else last_value(c3) over (order by rn3 range between abs(rn - rn3) following
and abs(rn - rn3) following)
end as c3
from tt2
select c1, c2, c3 from tt3
where c1 || c2 || c3 is not null
order by c1, c2, c3
C1 C2 C3
a 1 u
b 3 v
c 4 w
5 x
7 y
8 z
9
11
13
15
16
17
19
13 rows selected.P.S. Thanks to [url http://www.sql.ru/forum/actualthread.aspx?bid=3&tid=482506&hl=over+range#4785373]Vladimir Sitnikov for the demo of the approach. -
How find out the duplicate value from each columns.
I have below four columns,
How can i find out the duplicate value from each columns.
with All_files as (
select '1000' as INVOICE,'2000' AS DELIVERYNOTE,'3000' CANDELINVOICE,'4000' CANDELIVERYNOTE from dual union all
select '5000','6000','7000','8000' from dual union all
select '9000','1000','1100','1200' from dual union all
select '1200','3400','6700','8790' from dual union all
select '1000','2000','3000','9000' from dual union all
select '1230','2340','3450','4560' from dual
SELECT * FROM All_files
Output should be as per below.
1000 2000 3000 4000
9000 1000 1100 1200
1200 3400 6700 8790
1000 2000 3000 9000
Required to check uniqueness in cross columns.
Thanks.Try this (sorry about the formatting)...
WITH all_files AS (SELECT '1000' AS INVOICE,
'2000' AS DELIVERYNOTE,
'3000' CANDELINVOICE,
'4000' CANDELIVERYNOTE
FROM DUAL
UNION ALL
SELECT '5000',
'6000',
'7000',
'8000'
FROM DUAL
UNION ALL
SELECT '9000',
'1000',
'1100',
'1200'
FROM DUAL
UNION ALL
SELECT '1200',
'3400',
'6700',
'8790'
FROM DUAL
UNION ALL
SELECT '1000',
'2000',
'3000',
'9000'
FROM DUAL
UNION ALL
SELECT '1230',
'2340',
'3450',
'4560'
FROM DUAL),
t_base
AS (SELECT invoice
|| ','
|| deliverynote
|| ','
|| candelinvoice
|| ','
|| candeliverynote
str
FROM all_files),
t_str
AS (SELECT str || ',' AS str,
(LENGTH (str) - LENGTH (REPLACE (str, ','))) + 1
AS no_of_elements
FROM t_base),
t_n_rows
AS ( SELECT LEVEL AS i
FROM DUAL
CONNECT BY LEVEL <=
( SELECT SUM (no_of_elements) FROM t_str)),
t_build AS (SELECT t_str.str,
nt.i AS element_no,
INSTR (t_str.str,
DECODE (nt.i, 1, 0, 1),
DECODE (nt.i, 1, 1, nt.i - 1))
+ 1
AS start_pos,
INSTR (t_str.str,
1,
DECODE (nt.i, 1, 1, nt.i))
AS next_pos
FROM t_str
JOIN
t_n_rows nt
ON nt.i <= t_str.no_of_elements),
t_build2
AS (SELECT RTRIM (str, ',') AS original_string,
SUBSTR (str, start_pos, (next_pos - start_pos))
AS single_element,
element_no
FROM t_build),
t_build3
AS (SELECT single_element,
COUNT( * )
OVER (PARTITION BY single_element
ORDER BY single_element)
ele_count
FROM t_build2)
SELECT DISTINCT INVOICE,
DELIVERYNOTE,
CANDELINVOICE,
CANDELIVERYNOTE
FROM all_files, t_build3
WHERE ele_count > 1
AND ( INVOICE = single_element
OR DELIVERYNOTE = single_element
OR CANDELINVOICE = single_element
OR CANDELIVERYNOTE = single_element)I think this will be faster than the previous solution?
Cheers
Ben
Edited by: Munky on Feb 17, 2011 2:11 PM - "I think this will be faster than the previous solution?", nope - it's not :( -
Update table based on ID reference comparing each column and value
Hi,
Through UI user can update any information and click save. In backend i will be receiving only ID as reference . Based on the ID value i should update multiple tables wherever i have the reference tables. Here i will not get the values or column name updated.
I just get a ID to find which row is updated.
I should do a comparision now.
I have a history table where i get the row before updation. and i get a row after updation from current data i.e. from ssdb_Railroad[This will be updated by java after updation we will get the ID inorder to update remaining tables]. Now i need to compare
both the table column values and know which column is updated and after getting the value i should update reference tables.
Below is the structure for comparision table , History table and Main table.
Create table Comparision_History (
ID int IDENTITY(1,1) PRIMARY KEY,
InsertUser_UpdateUser varchar(50),
Old_ColVal varchar(100),
New_ColVal varchar(100),
TableName varchar(100),
[Action] varchar(50),
InsertDate_UpdateDate Datetime NOT NULL DEFAULT getdate()
CREATE TABLE SSDB_Railroad_History (
ID int IDENTITY PRIMARY KEY,
SCAC varchar(4) ,
Name varchar(50) NOT NULL,
RailroadID int NOT NULL UNIQUE,
RC2Key
varchar(50),
NOTES varchar(1000),
[Action] varchar(50),
InsertDate_UpdateDate Datetime NOT NULL DEFAULT getdate(),
InsertUser_UpdateUser varchar(50),
CREATE TABLE SSDB_Railroad (
ID int IDENTITY(1,1)PRIMARY KEY,
SCAC varchar(4) UNIQUE,
Name varchar(50) NOT NULL,
RailroadID int NOT NULL UNIQUE,
RC2Key
varchar(50),
InsertDate Datetime NOT NULL DEFAULT getdate(),
UpdateDate Datetime,
InsertUser varchar(50),
UpdateUser varchar(50)
Here SSDB_Railroad table and History table needs to be compared and get a updated value and it should be inserted in a comparision table. as well as it should be updated in reference tables.
Please help me with the code.
Thanks in Advance
DeepaHi Deepa_Deepu,
According to your description, personally, the merge function can meet your requirements. Usually, we can synchronize two tables by updating or inserting rows in a target table based on differences found in the source tables. Just as your description, when
the value of ID and InsertDate_UpdateDate in the source table matches a value, update them in the target table. When the values does not match, the source row is inserted into the target table.
For more information, see: using MERGE to perform UPDATE and INSERT operations on a target table by using a derived source table.
http://msdn.microsoft.com/zh-cn/library/bb510625.aspx
Regards,
Sofiya Li
Sofiya Li
TechNet Community Support -
Powershell Script - Convert Managed Metadata column Value to string
HI,
I have written a small PowerShell Script to pull records from a SP List and put them in a csv file. Here is the script:
$MyWeb = Get-SPWeb "http://dev-apps:8800/applications/PA"
$MyList = $MyWeb.Lists["Alist"]
$exportlist = @()
$Mylist.Items | foreach {
$obj = New-Object PSObject -Property @{
“PName” = $_["Port Name"]
"AName" = $_["Agent Name"]
"Address 1" = $_["Address 1"]
"Address 2" = $_["Address 1"]
"Address 3" = $_["Address 3"]
"Address 4" = $_["Address 4"]
$exportlist += $obj
$exportlist | Export-Csv -path 'C:\Filename.csv'
The script is running all right, the output file is also created, data is also correct for all columns but 1. This PName is a
Managed metadata type column and the output values I am getting for this column are like this:
"ERICA|a6d1e8fd-1f6b-4e09-9830-d21e35950881"
"CLIVE|24dff17f-a1b5-4abe-ae86-57299e1e098b"
viz. the ["Actual Value"|"its GUID"] (seems so). I do not want this GUID to be included in the result csv. Is there a way to remove it.
P.S. Choice column values are being fetched just file.Try this (you'll need to add in your other properties)
$items = New-Object psobject
$items | Add-Member -MemberType NoteProperty -Name "AName" -value "" ;
$items | Add-Member -MemberType NoteProperty -Name "PName" -value "" ;
$items | Add-Member -MemberType NoteProperty -Name "Address1" -value "" ;
$items | Add-Member -MemberType NoteProperty -Name "Address2" -value "" ;
$items | Add-Member -MemberType NoteProperty -Name "Address3" -value "";
$exportlist = @();
$Mylist.Items | foreach {
$pname = $_["PName"] -as [Microsoft.SharePoint.Taxonomy.TaxonomyFieldValue];
$obj = $items | Select-Object *;
$obj.AName = $_["AName"];
$obj.PName = $pname.Label;
$obj.Address1 = $_["Address 1"];
$obj.Address2 = $_["Address 2"];
$obj.Address3 = $_["Address 3"];
$exportlist += $obj
$exportlist | Export-Csv -path 'C:\AData.csv'
Regards, Matthew
MCPD | MCITP
My Blog
View
Matthew Yarlett's profile
See my webpart on the TechNet Gallery that allows administrative users to upload, crop and format user profile photos. Check it out here:
Upload and Crop User Profile Photos -
How to add spaces to the column value to make it up specifi length string please
Hello There,
Could you please guide me here to solve this issue,
in my column (named as State) contains values as below
California
Washington
Utah
Connecticut
Massachusets
in the output how can i add a spaces to make up every column values as 15 length (for ex, Utah is 4 length then need to add 11 spaces, California is 10 would like to add 5 spaces)
i tried below but no use in Sql 2008 R2
SELECT distinct state
state
+SPACE(35-len(state)),
len(state+SPACE(35-len(state)))
FROM dbo.ordersInfo
Thank you in advance
MilanFixed length CHAR(n) data in SQL is automatically padded with spaces. Either change the column's data type or cast to it. Also, the ISO-11179 rules are that the column should be "state_name" and not just the root attribute "state" -- state_code, state_population,
etc are a few of the confusions you created.
Another rule of RDBMS is that we do not do display formatting in the data. That is what presentation layers do. Why are you trying to fake COBOL in SQL?
--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
Maybe you are looking for
-
Changing the query on a view object
I have a view object right now, based on an entity. It is the default view object, so that means the query in the view object is straight forward, it grabs all of the attributes from the table. And there is no WHERE clause. In reality I only want to
-
How to Make a field User Entered - Required by javaScript
Dear all, How can I make a field User Entered - Required on some conditions e.g. it is required in the following conditions. 1)I have a group of radio buttons of Yes and No.I want if the user select yes then a particular text field should Required ot
-
QT Pro, movie recording, 2 questions
I have QT Pro and a firewire camera. I can make a movie recording, great !. Now two questions 1] What is the maximum size of the movie (I want to make one recording of 24 hr) 2] Now the movie is saved to my desktop. Can i change the directory (extern
-
Connect mysql from with dreamweaver using ruby on rails
hi, i just finish form my database using mysql front, but i begin to do the interface uisng dreamweaver i find difficulties to connect it with the database can someone tell how or tell about a tutorial that talks about this. notice: i am using ruby o
-
Phones getting unregistered frequently from call Manager
Hi We have Call manager in our HQ and some phones in Branch in a different country. From CUCM there is a SIP trunk towards router in branch. Users in branch occassionally complain of phones getting unregistered.HQ and branch are connected through int