How to take the last 7 digits of a varchar column
How to take the last 7 digits of a varchar2 colum
COL1
12345678
12345
1234567890123
1234567
Out put should be as below
COL1
2345678
12345
7890123
1234567
everything built in function or in any other way please
Hello
assuming that the entry contains only numbers, as in the example, the addition of 7 spaces to the left and selecting the 7 last characters toured:
with dataset as
(select col1 from column_value
table
(dbmsoutput_linesarray
("12345678"
'12345 '.
'1234567890123'
"1234567".
)
)
)
Select col1
, substr (lpad (", 7,' ') | col1-7) col1_last7
of the dataset
/
COL1 COL1_LAST7
-------------------- --------------------
12345678 2345678
12345 12345
1234567890123 7890123
1234567 1234567
Rob
Tags: Database
Similar Questions
-
I've lost the last two digits of my valid key for xp pro sp2 and notebook, how do I get the key and support? where?
Hi Jonathan,.
Please go to the Microsoft Community Forums.After the description of the question, I understand that you have lost the last 2 digits of the product key.Let me go ahead and help you with the issue.Please answer these questions, which will help us to help you best.1. How did you get the product key?2. the operating system come preinstalled on the computer?I suggest you for the link and check if that helps:How to identify, locate, and replace a product keySee also:
I hope this helps. If you have any other queries/issues related to Windows, write us and we will be happy to help you further. -
How to make the transition to digital in 10g
Hi all
We have 10g database of primary and standby, I have never worked before sleep, customer wants me start switch, can you please let me know how to make the transition to digital in 10g.
Thank you very much.It's the way I'm following passage in the
------------------------------------------------------------(1) check that there is no active users connected to databases.
(2) select message from v$ dataguard_status;
(3) select protection_mode from database v$.Step 1 check if it is possible to perform a failover.
SQL > select database_role, db_unique_name, SWITCHOVER_STATUS, v database name $;
DATABASE_ROLE DB_UNIQUE_NAME SWITCHOVER_STATUS NAME
---------------- ------------------------------ -------------------- ---------
PRIMARY OFMSREGT_SIM UNAUTHORIZED OFMSREGTSQL >
If you get NO allow status for SWITCHOVER_STATUS, verify that the standby database is connectivity.
If the SWITCHOVER_STATUS column displays ACTIVE SESSIONS, you can successfully achieve a failover by adding the WITH clause LOGOFF to the statement ALTER DATABASE COMMETTRE through PHYSICAL standby
Step 2 open the passage on the primary database.
SQL > SHUTDOWN IMMEDIATE;
SQL > STARTUP MOUNT;
SQL > ALTER DATABASE COMMIT TO SWITCH STANDBY MODE PHYSICAL;Step 4, check the transition state in the view V$ DATABASE.
SQL > SELECT SWITCHOVER_STATUS FROM V$ DATABASE;
SWITCHOVER_STATUS
-----------------
TO_PRIMARY
1 selected lineStep 5 place yourself in the role of physical standby database target the main role.
You can switch a standby database physical role ensures the primary role
When the standby database instance is mounted mode redo apply or open
for read-only accessSQL > ALTER DATABASE COMMIT AT THE GRADE CROSSING;
Step 6 complete the transition of the database ensures the main role.
If the physical standby database has not been opened in read-only mode since the
the last time it was started, run the SQL ALTER DATABASE OPEN to open
the new primary database:SQL > ALTER DATABASE OPEN;
If the physical database was opened read only since the last
time it was launched, you must close the database waiting for target and restart:SQL > SHUTDOWN IMMEDIATE;
SQL > STARTUP;Note: There is no need to close and restart other bases before (not involved in the digital switchover) who are online at the time of the failover. These databases on hold will continue to
function normally once the failover is completed.Step 7 if necessary, restart log apply services on standby databases.
He must deliver the command FRO repeat apply as:
SQL > change database recovery managed standby database disconnect from the session.
or
And stop repeating applies to give
SQL > alter database recover managed standby database cancel;Step 3 Shut down and restart the former primary instance.
SQL > SELECT OPEN_MODE FROM V$ DATABASE;
Step 9 check the synchronization between the primary and standby:
Primary
SQL > select thread #, max(sequence#) in v$ archived_log where archived = 'YES' group by thread #;Sleep mode
SQL > select thread #, max(sequence#) in v$ archived_log in case of application = 'YES' group by thread #;Stop the former primary instance and restart and mount the database:
Sense of SWITCHOVER_STATUS
--------------------------------------------
The column SWITCHOVER_STATUS of v$ database can have the following values:NOT ALLOWED - this is a database of pending and the primary database has
not been first switched, or it's a back-end database and there is no data pending.ACTIVE SESSIONS - indicates that there are active sessions of SQL attached to
the primary database or emergency that must be disconnected before the
failover operation is allowed.Transition to THE PENDING - this is a database of relief and the primary database
application of the digital switchover has been received but untreated.LATENT pass - the digital switchover has been waiting mode, but has not completed
and I went back to the primary database.Primary SCHOOL - this is a database of pending, any sessions active, i.e.
allows to switch to a primary database.In STANDBY mode - this is a primary database, any sessions active, i.e.
allows to switch to a standby database.RECOVERY NEEDED - this is a database of pending that has not received the
application of the digital switchover. -
Instant ink: ruined the last 4 digits of my instant ink trial code.
Hello
I bought a HP Envy 5530 printer that came with a free trial of two months of instant ink system. While scraping off the coast to reveal the code, I accidentally damaged the last 4 digits of the series of 16 digits.
Is there a way I can get a replacement for it / get to know the last 4 digits?
Thank you
Stefan
Hey @_Stefan,.
Welcome to the Forum from HP Support.
I see that you are looking to complete the configuration of your instant ink after having a problem with the registration card. Do not worry - what is happening and there is an easy solution. I would like to help.
Your fastest path to resolution of reaching out to our cloud support team. You can click on the following link to start a business:
Once you complete the form online to build your business, you can choose among different ways to contact direct. Let me know if you are able to finish your sign. If I helped you to solve the problem and that you liked this post, feel free to give me virtual accessories by clicking on the "Thumbs Up" icon below by clicking on "Accept as Solution" (this will help others find the solution).
Thanks for posting in the Forum from HP Support.
Have a great day!
-
phishing scam?
I receive e-mail from hotmail telling me that my credit card has expired. they are capable of the id of the card with the last 4 digits showing. I checked and the card does not expire for another year. I need to get direct support to verify or deny that billing is accurate or false.
original title: phishing scam?Hello Dougharada
Please see this link about Phishing scams. A lot of information about the grateful and prevent them. I hope this helps. -
How to get the last date of 3 days for the current month?
Hello. Guy
How to get the last date of 3 days for the current month?
MY OUTPUT WOULD LOOK LIKE THIS
JANUARY 29, 2016
JANUARY 30, 2016
JANUARY 31, 2016
GUYS HELP ME / / /...
SQL > select last_day (sysdate) - level + 1 double connect by level<= 3="" order="" by="">=>
LAST_DAY)
---------
29 JANUARY 16
30 JANUARY 16
31 JANUARY 16
-
How long is the last free trial?
How long is the last free trial before purchising?
The free trial for 30 days.
Concerning
Hervé Khare
-
How to get the last day of a month for every 2 months for a given period?
Hello
Can is it some please let me know how to get the last day, last day of the week, the weekend last day, last Monday, one month for every 2 months for a given period?
Thanks in advance.
Try the below
SELECT LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))) lastday.
BOX WHEN TO_CHAR (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))), 'DY') = 'SAT '.
SO LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))-1
WHERE TO_CHAR (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))), 'DY') = 'Sun '.
THEN LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))-2
Of OTHER LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))
END as lastweekday,
BOX WHEN TO_CHAR (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))), 'DY') IN ('Sam', 'SUN')
THEN LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))
Of OTHER LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))
-(TO_NUMBER (TO_CHAR (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))),' from)) - 1).
END as lastweekendday,
BOX WHEN TO_CHAR (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))), 'DY') = 'MY
THEN LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))
Of OTHER NEXT_DAY (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))), "LUN")-7
END AS lastmonday
FROM (SELECT SYSDATE startdate,
SYSDATE + 300 enddate
THE DOUBLE)
CONNECT BY LEVEL<=>=>
-
I don't know if I should get the last two digits of
Mylenium
-
How to find the last date of execution of the objects in database
Hi all
We're going for an upgrade of the database 11g and for the same thing, we want to know the last date of the following-
Packages, Tables, views
Conc. programs / value Sets / look up / profile options
Is there a way we can find the same thing.
The answers would be really useful.
Kind regards
ShrutiSo can you provide clues on how to find the last opportunity registration
I don't think you can find such a script with having activated audit.
Thank you
Hussein -
How to revive the last work, then from the APP? Or system restart?
How to revive the last work, then from the APP? Or system restart?
EIB zu ADOBE: "geht nicht mehr! (this function is not longer possible)
-
How to take the laboratory test, possible?
I'm not able to study for vmware.
I did the course, but the company has not set environment for me and work.
How to take the laboratory test, possible?
I need a help from you.
Thank you
________________________________
Thiago Rodrigues | Network management
Mobile: (011) 6122-0994
www.DIGISYSTEM.com.br
Engine certified Manager
Certified Itil v2 Foundation
________________________________
My VCP410 exam, it is not easy to take the exam without laboratory. Try to get a lab by installing a copy of assessment on VMware Play or work station. I hope this helps.
Tim
VCP on vSphere 4
-
How to find the last pasted paragraphs FMP?
I'm sticking FMP several objects at once in a file (a file of changes to the sections containing the changebars) in the main text flow. I want a separator line to go at the end of each pasted section, so I try to insert one after the paste operation. But instead of a line between each section, all lines are added at the end of the file, after all the sections. So if there are 3 glued sections at the end of the file are three lines. My code is below, do you know how I could fix this?
Thank you, Mark
function copyPasteChanges (doc, chgRange) {}
Select the section with changebar and copy it.
doc. TextSelection = chgRange;
doc. Copy();
Prepare for the changes doc and paste there the modified section.
var firstChgPgf = changesDoc.MainFlowInDoc.FirstTextFrameInFlow.LastPgf;
var changesTloc = new TextLoc (firstChgPgf, Constants.FV_OBJ_END_OFFSET);
var changesTRange = new TextRange (changesTloc, changesTloc);
changesDoc.TextSelection = changesTRange;
changesDoc.Paste ();
To go at the end of the file again (I think)
var lastPgf = changesDoc.MainFlowInDoc.FirstTextFrameInFlow.LastPgf;
var dividerPgf = changesDoc.NewSeriesPgf (lastPgf);
var TLoc = new TextLoc (dividerPgf, 0);
changesDoc.AddText (TLoc, '_');
}
Hi Mark,
The problem is that the dough does not occur when you think. The dividing line is added at the end of the file, but are not your actions of dough. Actually, I think that maybe a little random where pasta is produced, because this line:
var changesTloc = new TextLoc (firstChgPgf, Constants.FV_OBJ_END_OFFSET);
.. .is does not create a valid text location. You can check this by abandoning the service after:
changesDoc.TextSelection = changesTRange;
.. and look at where's the insertion point. It will probably be everywhere where you left it last, because the call is not valid. I can't tell you exactly why, except that it has something to do with the fact that you are using the last paragraph in the stream. There is something weird to try to define a range of full-paragraph text with the last paragraph. I'm sure it's related to how the last TFP in a stream does not show a mark of FMP, but beyond that, I don't know how to do what you're trying to do with the last paragraph.
Having no knowledge of how do it right, any time I need to do this, I create a paragraph "dummy" at the end of the flow to fill that space strange 'last FMP", then do the work around it. In the end, I just want to remove fake TFP. I don't know if it's a good idea or not, but it's the only way I ever get it to work and it sorts the mirror how you could do this manually in the GUI.
With this, I modified your script as follows, and it seems to work better. Note that I also modified the logic of how to find the last paragraph of the flow by writing a separate function. Your call to the 'FirstTextFrameInFlow' is OK, unless your doc begins to span several pages and/or begins with several empty pages. The function I wrote ensures that you really the last TFP in the stream.
I hope this helps.
Russ
function copyPasteChanges (doc, chgRange) {}
Select the section with changebar and copy it.
doc. TextSelection = chgRange;
doc. Copy();
Prepare for the changes doc and paste there the modified section.
var lastPgf = getLastPgf (changesDoc);
var dummyPgf = changesDoc.NewSeriesPgf (lastPgf);
var changesTloc = new TextLoc (dummyPgf, 0);
var changesTRange = new TextRange (changesTloc, changesTloc);
changesDoc.TextSelection = changesTRange;
changesDoc.Paste ();
To go at the end of the file again (I think)
Don't forget that last TFP is now fake TFP
lastPgf = getLastPgf (changesDoc);
var dividerPgf = changesDoc.NewSeriesPgf (lastPgf.PrevPgfInFlow);
var TLoc = new TextLoc (dividerPgf, 0);
changesDoc.AddText (TLoc, '_');
dummyPgf.Delete ();
}
function getLastPgf (doc)
{
textFrame var is doc. MainFlowInDoc.LastTextFrameInFlow;
var lastPgf = textFrame.LastPgf;
While (! lastPgf.ObjectValid () & textFrame.ObjectValid ())
{
textFrame = textFrame.PrevTextFrameInFlow;
lastPgf = textFrame.LastPgf;
}
Return lastPgf;
}
-
How to get the last day of the week?
HII
I can get the week number of calendar for a given date using
SELECT to_char (to_date('04/04/2011','MM/DD/YYYY'), 'WW') FROM dual
can any body tell me, how to get the last day of the week?
and the answer should be: 04/08/2011(8th april)
Thank you
San
Published by: sandeep9 on April 4, 2011 03:50Perhaps this...
SQL> select trunc(sysdate,'WW')+6 from dual; TRUNC(SYSDATE,'WW')+ -------------------- 08-APR-2011 00:00:00 SQL>
-
Mr President, how to find the last DML operations
Hello
Please tell me how to find the last DML operations at least a minimum of 30 queries.
Thanks in advance,Select sql_id, sql_text, last_load_Time from V$ SQLAREA
or
Select * from v$ sqltext
Must be one of them. But don't know what exactly you are looking at.
I usually use v$ sqlarea to see recent queries.
Maybe you can limit the rows using rownum, order of last_load_time.
I understand, if the same query is used again then only recent transaction is stored.
Maybe you are looking for
-
What are the parameters of police to 7.0
I'm looking for that by default, including advanced font settings should be for 7.0.1. I changed things and I'm too far away from the default and I would start again. There is no set default button. At this point the web pages are ok, but the text is
-
What is it's ok to keep Satellite U500 closed while using the external monitor?
Hello I have a Satellite U500.At home, I use a monitor and a keyboard. So I closed the laptop while working at home. I can do this, or would it damage the display or otherwise hinder ventilation properly somehow laptop? Thank you very much for your a
-
Windows Update was giving me problems and would not install 5 updates as a result of an error on the search for a solution I found that I need to download (Checksur.exe) system update readiness tool but the only ones available are for and 86-64 bit s
-
I have an Xbox 360 (the older white kind) that I used to share media files to my network wireless for my laptop. Recently it has stopped working. I replaced my old Linksys G Router for a new Netgear N300. I have set my network sharing settings in
-
Start & restart time is 5-6 minutes - Blank screen when starting the process.
Every time I have start or restart my computer and I timed several times he and average is 5.5 minutes. It's the sequence of events; Start or restart Computer stops HP will appear instantly Scaning of Windows bar Appearance of Windows Logo A black sc