How do count the character in the given string?
hi all,
i have astring like 'AAAARAMARAOAAA'.
i want count how many 'A's in this string using sql statement.
Is that a joke? You asked that in a previous thread of yours: how do count how many 'A' s in this string using sql stmt?.
C.
Similar Messages
-
How to count the number of rows in a resultser object?
hi there
how to count the number of rows in a resultser object which may contains millions of rows? besides using a while loop? thanksYou don't, you execute a query whose result is the record count of those records that match the search and then you execute the actual query to create your record set. Typically you do
select count(id) from YourTable where [filter]
from the resulting ResultSet do
int res.getInt(1);
which gives you the count and then
select id from YourTable where [filter]
to produce the actual result set.
in the second query the id part can be substituted with the actual fields you want. -
How to count the no of digits entered in the NumericField & print the same
Hi!
How to count the no of digits entered in the Numberic Field and print the content of Numberic Field.
Thanks.Hi Venkat,
To check the number of digits, just convert it to a string and use the length() method. to get the number of characters. However, I am not getting your second point of printing the number?
Kindly explain in detail.
Regards,
Poojith MV -
How to count the number of lines dynamically,
In the below code am trying to read the lines which are selected using a check box, also am categorizing the contents depending on the follow up material.
after displaying one category contents am displaying a line
which also counts to a line in the internal table.
My question is how to count the number of lines(ULINE) displayed dynamically.
FORM GET_LINES .
DATA: LV_LINES TYPE I,
LV_TIMES TYPE I,
LV_TABIX TYPE SY-TABIX.
DESCRIBE TABLE IT_REC LINES LV_LINES.
DO LV_LINES TIMES.
LV_TIMES = SY-INDEX .
READ LINE LV_TIMES FIELD VALUE IT_REC-CHECK INTO GV_CHECK.
IF SY-SUBRC EQ 0 AND GV_CHECK IS NOT INITIAL.
LV_TABIX = LV_TIMES.
READ TABLE IT_REC INDEX LV_TABIX INTO GWA_UPDATE.
IF SY-SUBRC EQ 0.
APPEND GWA_UPDATE TO GT_UPDATE.
ENDIF.
ENDIF.
ENDDO.
ENDFORM. " GET_LINESIn the below code am trying to read the lines which are selected using a check box, also am categorizing the contents depending on the follow up material.
after displaying one category contents am displaying a line
which also counts to a line in the internal table.
My question is how to count the number of lines(ULINE) displayed dynamically.
FORM GET_LINES .
DATA: LV_LINES TYPE I,
LV_TIMES TYPE I,
LV_TABIX TYPE SY-TABIX.
DESCRIBE TABLE IT_REC LINES LV_LINES.
DO LV_LINES TIMES.
LV_TIMES = SY-INDEX .
READ LINE LV_TIMES FIELD VALUE IT_REC-CHECK INTO GV_CHECK.
IF SY-SUBRC EQ 0 AND GV_CHECK IS NOT INITIAL.
LV_TABIX = LV_TIMES.
READ TABLE IT_REC INDEX LV_TABIX INTO GWA_UPDATE.
IF SY-SUBRC EQ 0.
APPEND GWA_UPDATE TO GT_UPDATE.
ENDIF.
ENDIF.
ENDDO.
ENDFORM. " GET_LINES
The display function is:
FORM DISPLAY_DATA .
ULINE.
WRITE : /1 SY-VLINE, 'check',
10 SY-VLINE, 'Plant',
20 SY-VLINE, 'Material number',
50 SY-VLINE, 'Follow up material',
70 SY-VLINE, 'Safety stock',
100 SY-VLINE, 'Partc'.
ULINE.
LOOP AT IT_MARC.
MOVE: IT_MARC-WERKS TO IT_REC-WERKS,
IT_MARC-MATNR TO IT_REC-MATNR,
IT_MARC-NFMAT TO IT_REC-NFMAT,
IT_MARC-EISBE TO IT_REC-EISBE,
IT_MARC-PARTC TO IT_REC-PARTC .
APPEND IT_REC.
CLEAR IT_MARC.
ENDLOOP.
DATA: GV_TABIX TYPE SY-TABIX.
LOOP AT IT_REC.
GV_TABIX = SY-TABIX.
READ TABLE GT_TOTAL WITH KEY WERKS = IT_REC-WERKS
NFMAT = IT_REC-NFMAT.
IF SY-SUBRC EQ 0.
IT_REC-PARTC = GT_TOTAL-PARTC.
MODIFY IT_REC INDEX GV_TABIX TRANSPORTING PARTC.
ENDIF.
ENDLOOP.
LOOP AT IT_REC.
WRITE : /1 SY-VLINE, IT_REC-CHECK AS CHECKBOX,
10 SY-VLINE, IT_REC-WERKS,
20 SY-VLINE, IT_REC-MATNR,
50 SY-VLINE, IT_REC-NFMAT,
70 SY-VLINE, IT_REC-EISBE,
100 SY-VLINE, IT_REC-PARTC.
AT END OF NFMAT.
ULINE.
ENDAT.
ENDLOOP.
ULINE.
ENDFORM. " DISPLAY_DATA
Solved -
Find the alteast one number and one character in the given string
Hi All,
How to find the given input string it contains at least one alpha and one number.
My test data like this
test123 ->pass
test -> Fail
123test -pass
123 -> Fail
select * from dual where regexp_like ('test123','[0-9]')Purvesh K wrote:
One of easiest ways:
with data as
select 'test123' col from dual union all
select '123test' from dual union all
select 'test' from dual union all
select '123' from dual
select *
from data
where regexp_like(col, '[[:digit:]]+[[:alpha:]]+|[[:alpha:]]+[[:digit:]]+', 'i');
COL
test123
123test
Just a note - This will fail, if any characters like SPACE (or any non alpha numeric characters) appears in the string like..
with data as
select 'test 123' col from dual union all
select '123test' from dual union all
select 'test' from dual union all
select '123' from dual
select *
from data
where regexp_like(col, '[[:digit:]]+[[:alpha:]]+|[[:alpha:]]+[[:digit:]]+', 'i');Edited by: jeneesh on Mar 5, 2013 12:04 PM
You could change like
where regexp_like(col, '[[:digit:]].*?[[:alpha:]]|[[:alpha:]].*?[[:digit:]]', 'i'); -
How to write the given query using 'ANY ' operator
Hi,
How to write the given query using 'ANY ' operator , I dont need to fetch to grade_master table twice in database, just need to fetch within the result set.
SELECT dsg_code,dsg_name,dsg_grade FROM designation_master WHERE dsg_orgn='&&Orgn' and dsg_ctry='&&ctry'
And dsg_loc ='&&loc' And dsg_oru = '&&oru' and dsg_grade in decode('&&radio_group',
1, SELECT grd_code FROM grade_master WHERE grd_osm_code in (Select grd_osm_code FROM grade_master WHERE grd_orgn='&&Orgn' and grd_ctry='&&ctry' And grd_loc ='&&loc' And grd_oru = '&&oru' and grd_code ='&&emp_grade'),
2, SELECT grd_code FROM grade_master WHERE grd_osm_code > (Select grd_osm_code FROM grade_master WHERE grd_orgn='&&orgn' and grd_ctry='&&ctry' and grd_loc ='&&loc' And grd_oru = '&&oru' and grd_code),
3, SELECT grd_code FROM grade_master WHERE grd_osm_code < (Select grd_osm_code FROM grade_master WHERE grd_orgn='&&orgn' and grd_ctry='&&ctry' And grd_loc ='&&loc' And grd_oru = '&&oru' and grd_code ='&&emp_grade'))
thanks
rincyHi,
One thing I understood my your issue is you want to perform, execution of query once or fetch the results sets my minimizing the number of times executions of queries. It would be hard for us to check in this way, atleast provide some temporary data and some business rules. Only I can IN, >, < (queries logical conditons on inner query)
- Pavan Kumar N
- ORACLE OCP - 9i/10g
https://www.oracleinternals.blogspot.com -
How to count the number of wins?
I have a tic tac toe simulator that simulates a game of tic tac toe (obviously). I press the 'play' button, and 1 random X and O is placed in 9 of the labels. Then the application says if X or O wins, or if the game was a tie/no winner. So,
what I want to do is when I click the 'exit' button, I want a message box telling the user how many times X won, O won, and how many ties there were. I am not too sure how to count the number of wins.
-ThanksThanks for the reply. I could be wrong, but I do not think that is exactly what I am looking for. Here is the code that I have that determines the winner:
switch (checkWinner())
case 'T':
winnerLabel.Text = "It was a tie!";
break;
case 'O':
winnerLabel.Text = "O Wins!";
break;
case 'X':
winnerLabel.Text = "X Wins!";
break;
private char checkWinner()
char WinnerChar = ' ';
int winning_line = 0;
if (GameBoardCellChar[0].Equals(GameBoardCellChar[1]) && GameBoardCellChar[0].Equals(GameBoardCellChar[2]))
WinnerChar = GameBoardCellChar[0];
winning_line++;
if (GameBoardCellChar[3].Equals(GameBoardCellChar[4]) && GameBoardCellChar[3].Equals(GameBoardCellChar[5]))
WinnerChar = GameBoardCellChar[3];
winning_line++;
if (GameBoardCellChar[6].Equals(GameBoardCellChar[7]) && GameBoardCellChar[6].Equals(GameBoardCellChar[8]))
WinnerChar = GameBoardCellChar[6];
winning_line++;
if (GameBoardCellChar[0].Equals(GameBoardCellChar[3]) && GameBoardCellChar[0].Equals(GameBoardCellChar[6]))
WinnerChar = GameBoardCellChar[0];
winning_line++;
if (GameBoardCellChar[1].Equals(GameBoardCellChar[4]) && GameBoardCellChar[1].Equals(GameBoardCellChar[7]))
WinnerChar = GameBoardCellChar[1];
winning_line++;
if (GameBoardCellChar[2].Equals(GameBoardCellChar[5]) && GameBoardCellChar[2].Equals(GameBoardCellChar[8]))
WinnerChar = GameBoardCellChar[2];
winning_line++;
if (GameBoardCellChar[0].Equals(GameBoardCellChar[4]) && GameBoardCellChar[0].Equals(GameBoardCellChar[8]))
WinnerChar = GameBoardCellChar[0];
winning_line++;
if (GameBoardCellChar[2].Equals(GameBoardCellChar[4]) && GameBoardCellChar[2].Equals(GameBoardCellChar[6]))
WinnerChar = GameBoardCellChar[2];
winning_line++;
if (winning_line == 0 || winning_line > 1)
WinnerChar = 'T';
return WinnerChar;
Do I have to include something extra in here to get the count or no?
The code I posted is the coding in my play button. -
How to count the number of text boxes that are data entered
How to count the number of text boxes that are data entered in visual basic form.
Here is an Iterator that expands on my previous response:
''' <summary>
''' Iterator for form controls
''' </summary>
''' <param name="onlyControlsOfType">specify type if a certain type of controls needed</param>
''' <param name="onlyTopLevel">if true don't search containers within the form</param>
''' <returns></returns>
''' <remarks></remarks>
Private Iterator Function AllControls(Optional onlyControlsOfType As Type = Nothing, _
Optional onlyTopLevel As Boolean = False) As IEnumerable(Of Control)
Dim ctrl As Control = Me.GetNextControl(Me, True)
Do Until ctrl Is Nothing
If onlyControlsOfType Is Nothing OrElse ctrl.GetType = onlyControlsOfType Then
If TypeOf ctrl.Parent Is Form OrElse Not onlyTopLevel Then
Yield ctrl
End If
End If
ctrl = Me.GetNextControl(ctrl, True)
Loop
End Function
Some sample uses:
For Each
For Each c As Control In AllControls()
Debug.WriteLine(c.Name)
Next
List of all controls, including controls in containers i.e. Groupbox
Dim l As List(Of Control) = AllControls().ToList
List of all Textbox controls, including Textboxes in containers i.e. Groupbox
l = AllControls(GetType(TextBox)).ToList
List of all Textbox controls, don't include Textboxes in containers i.e. Groupbox
l = AllControls(GetType(TextBox), True).ToList
'Those who use Application.DoEvents() have no idea what it does and those who know what it does never use it.' JohnWein
Multics
My Serial Port Answer -
How to count the number of AAA clients
Hi,
As we know, ACS5.2 is required with a base license-- supporting 500 network devices.
Sometimes there are lots of AAA clients or network devices that are authenticating simultanious. So my question is, how to count the network devices allowed to auth on ACS5.2? Does that only include network devices, or including both any network devices or AAA clients?
Rgds,
Laowu5017Hi,
ACS 5.x counts the number of AAA clients that are configured on the ACS.
Please note that AAA clients and networks devices is the same and they comply switches, routers, WLCs, or whatever other device configured under
Network Resources >
... >
Network Devices and AAA Clients
AAA Clients are NOT the AAA suplicants.
The end user clients PCs are the AAA suplicants, and for this there is no limit number.
HTH,
Tiago
If this helps you and/or answers your question please mark the question as "answered" and/or rate it, so other users can easily find it. -
How to count the no of record in grid.
Hi Experts,
I have one database block & this is bolck has contain 4 non database item is there. In database block has contain the id and description is non database block item. While i m querying the data description is shown depends up on ID. It is in grid. How to count the no of record in grid. My code is
LV_CUR_ITM :=:SYSTEM.CURSOR_RECORD;
FOR I IN 1.. LV_CUR_ITM LOOP
LAST_RECORD;
SELECT NSN_NO INTO :ORD_DIS_NSN_ITEM_DET.NSN_NO
FROM NSN_MST WHERE NSN_ID= :ORD_DIS_NSN_ITEM_DET.NSN_ID;
SELECT FOB_PRICE INTO :ORD_DIS_NSN_ITEM_DET.FOB_PRICE
FROM PRODUCT_SUPPLIER WHERE PRD_ID_NUMBER= :ORD_DIS_NSN_ITEM_DET.PRD_ID_NUMBER
AND BAS_ORG_ID_NUMBER=:ORD_DIS_NSN_ITEM_DET.ORG_ID_NUMBER;
SELECT DESCRIPTION INTO :ORD_DIS_NSN_ITEM_DET.PRD_DESC
FROM PRODUCT WHERE ID_NUMBER= :ORD_DIS_NSN_ITEM_DET.PRD_ID_NUMBER;
SELECT FULL_NAME INTO :ORD_DIS_NSN_ITEM_DET.SUPP_NAME
FROM ORGANISATION WHERE ID_NUMBER=:ORD_DIS_NSN_ITEM_DET.ORG_ID_NUMBER;
NEXT_record;
END LOOP;
Thx in advance.Hai,
Add a Non database item to that block, and set the Calculation Mode as Summary, and Summary Function to Count.
Then u will get the total no of records from this text. ( You can hide this, so that the use won't see it. )
OR
go to the Last Record, then
LV_CUR_ITM :=:SYSTEM.CURSOR_RECORD; This will also work.
Regards,
Manu.
If this answer is helpful or correct, please mark it. Thanks. -
How to count the number or rows in file
Hi Experts,
I am file as source and Oracle as target. My file containing the some data which is going to load to the target.
My requirement is that I want to count the number of rows which my file contains. Please help me how to count the total number of rows in file.
Thx,
Sahadeva.Hi,
You won't give a name DEST_USER_NAME:ODI will get these information.
it is important Command on source and Command on Source side .
-Pls write jython code on Command on Source side
-And Command On Target side Choose technology as Oracle and set logical schema to HR_logical
Sorry my mistake.İt is related jython syntax.Here is code:
import java.lang as lang
import java.sql as sql
import java.lang.String
import os
lang.Class.forName("<%=snpRef.getInfo("DEST_JAVA_DRIVER")%>")
cons=sql.DriverManager.getConnection("<%=snpRef.getInfo("DEST_JAVA_URL")%>", "<%=snpRef.getInfo("DEST_USER_NAME")%>", "<%=snpRef.getInfo("DEST_PASS")%>")
dblinks= cons.createStatement()
file1=open('EMP.txt','r')
count=0
line=file1.readline()
while line !='':
count+=1
line=file1.readline()
file1.close()
sqlQuery = "insert into HR.ETL_FILE_LOG (FILE_COUNT) values (count)"
rqQuery= dblinks.execute(sqlDBLink)
cons.close()
Regards -
How to determine the connection string to a SQLite database, in C# code
Hello. I'm trying to figure out how to specify the connection string to a SQLite database, I would like to access using the following code:
string connectionString = null;
SqlConnection connection;
SqlCommand command;
SqlDataAdapter adapter = new SqlDataAdapter();
DataSet ds1 = new DataSet();
string sql = "SELECT DataName, Data, Id, UserId, DateLastUpdated FROM MainTable";
connectionString = "Data Source=C:\\SQLITEDATABASES\\SQLITEDB1.sqlite;Version=3;";
connection = new SqlConnection(connectionString);
try
connection.Open();
command = new SqlCommand(sql, connection);
catch
The value I assigned to the variable connectionString, in the code above, I obtained somewhere from the Internet. It does not work. I'm using Visual Studio 2013, against the file sqlite-netFx451-setup-bundle-x86-2013-1.0.96.0.exe, which
I installed, and got from
here.
My application's App.config file looks as follows:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="DC_Password_Saver.Properties.Settings.DC_Password_SaverConnectionString" connectionString="data source="C:\Users\patmo_000\Documents\Visual Studio 2013\Projects\DC Password Saver\DC Password Saver\DC Password Saver.db"" providerName="System.Data.SQLite.EF6"/>
</connectionStrings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1"/>
</startup>
</configuration>
I tried to use the value assigned to connectionString in the XML settings above, replacing single backslash characters with double backslash characters, because the Visual Studio editor flagged them as unrecognizable, and wound up with the
following.
SqlDataAdapter adapter = new SqlDataAdapter();
DataSet ds1 = new DataSet();
string sql = "SELECT DataName, Data, Id, UserId, DateLastUpdated FROM MainTable";
connectionString = "data source="C:\\Users\\patmo_000\\Documents\\Visual Studio 2013\\Projects\\DC Password Saver\\DC Password Saver\\DC Password Saver.db"";
connection = new SqlConnection(connectionString);
The above code however does not work either. So again, does anyone know how I can specify in C# code, a connection string to access my SQLite database? Thanks in advance for your reply.What does SQLite connection strings has to do with WPF?
You will find some valid connection strings here:
https://www.connectionstrings.com/sqlite/
But you cannot use the SqlConnection class to connect to a SQLite database. You will need to download and add a reference to the System.Data.SQLite library and then use the SQLiteConnection class:
connection = new System.Data.SQLite.SQLiteConnection(connectionString);
try
connection.Open();
command = new System.Data.SQLite.SQLiteCommand(sql, connection);
catch
Please refer to the following article for more information and an example of how to connect and read and write data from an SQLite database using C#:
http://blog.tigrangasparian.com/2012/02/09/getting-started-with-sqlite-in-c-part-one/.
There is contains a link where you can download the required assemblies.
Hope that helps.
Please remember to mark helpful posts as answer to close your threads and then start a new thread in an approproate forum if you have a new question. -
Code to Check for Special Characters \/:*?" | in the given String
Hi All,
I need a java code to verify if the given string contains the Special Characters like \/:*?"<>|
thanks
krishnavenihttp://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html
bye
TPD -
How to fetch the query string in BW?
Hi Gurus,
How can fetch the query string from BW Server to implement Bex web application Iview.
*Now to get the information "BEx Web Application Query String". open the SAP Log on and open the BW Browser, double click any of the queries available, this will open a window and select the Query String ( it should be between & to end &).*
Explain the above point with more detail like how will open the bw browser what is the step for that?where the query string will available in BW browser.
Higher points will be rewarded for valuable inputs.
Thanks in Advance,
Dharanihi ,
What krishna suggested is right ... Another method can be like :
&CMD=LDOC&infocube=0D_DECU&query=SALES_DEMO_2
Get this information from your BI consultant.
Please close thread if you got ur answer!!!
Regards
Parth -
How to find the CONNECTION STRING
how to find the connection string through SQL Statement?
salahuddin/salahuddin@CONNECTION_STRING
Below is all about my sql version:
DEFINE SQLPLUSRELEASE = "800060000" (CHAR)
DEFINE _EDITOR = "Notepad" (CHAR)
DEFINE OVERSION = "Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options" (CHAR)
DEFINE ORELEASE = "1002000100" (CHAR)In windows XP plateform your can find from the ServicesHow can you do that using SQL statement? Plus connect strings are not available in Services. In post 9i SQL*Plus we can do it in SQL statement like this
SELECT '&&_CONNECT_IDENTIFIER'
FROM dual;
Note: This will work only in SQL*Plus. -
How to search for perticular substring in given string.
Hi, Can any one tell me how to search for perticular substring in given string.
example:
I have to search for CA in given Order type it may be CA10 or CA15. Please Do the needful.Hi Aniruddha,
check this...
Data var string,
var = 'India'.
search var for 'Ind'.
if sy-subrc = 0. " var having ind
Message 'Ind found' type 'I'.
else . "var not having ind
Message 'Ind not Found' type 'I'.
endif.
thanx
bgan.
Maybe you are looking for
-
Input Text in Table, autosizing height to fit content
I've a table with a variety of multi-row inputText components, most of them with the @row attribute set to 2. However, one of these fields sometimes has verbose content. Is there a way to configure the InputText component to autosize itself (and the
-
is there any other way to unlock an I phone?
-
SRM7.0-PPS-ClassicScenario-PO Control
Hi SAPions, We are using SRM7.0 with PPS component, ECC-EhP4. - Classic I want to control the PO document type when it is posted to ECC. I want to code that in an enhancement. I searched SDN and used couple of BADIs for the same, but its not breaking
-
What command do I type into open firmware to make it install from firewire
Hi All I am trying too get Leopard onto my G4 cube using the open firmware to fake the clock speed using the below: For single CPUs, use the following three lines: dev /cpus/PowerPC,G4@0 d# 867000000 encode-int " clock-frequency" property boot cd:,\\
-
No network adapter found on install
I have just purchased a Linksys WRT160N router and the first task of loading the program on my main computer has already hit a snag. It says it cannot find a network adapter on my computer and that I need to enable it. My adapter is functioning as I'