Posts by Reginaldo Rigo • 3,638 points
193 posts
-
0
votes1
answer80
viewsA: Oracle REGEXP_REPLACE equivalent in SQLSERVER
I created this function to solve the above problem. O REGEX_REPLACE oracle has been spun into 3 Places to achieve the same goal. SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO --…
sql-server-2012answered Reginaldo Rigo 3,638 -
-1
votes1
answer80
viewsQ: Oracle REGEXP_REPLACE equivalent in SQLSERVER
In my application I need to remove common string words of the database, such as: FROM TO WITH Which are connecting words and have no great importance in characterization of the item itself. Say the…
sql-server-2012asked Reginaldo Rigo 3,638 -
2
votes1
answer42
viewsA: Help in this query in SQL Server
How you are grouping by Companyname is normal that it breaks line. To group only by Countryregion you need to delete that column of select. SELECT MAX(SOH.TotalDue) AS Total, A.CountryRegion FROM…
-
2
votes2
answers519
viewsA: SQL Query average time DO NOT take into account Weekends and holidays
Create the function fn_DiasUteis CREATE FUNCTION [dbo].fn_DiasUteis ( @fromdate Datetime, @todate Datetime ) RETURNS TABLE AS RETURN ( SELECT (DATEDIFF(dd, @fromdate, @todate) + 1) -(DATEDIFF(wk,…
-
1
votes2
answers893
viewsA: Validate data in sql server
It could be done like this: declare @dia varchar(2) declare @mes varchar(2) declare @ano varchar(4) declare @data date set @dia = 40; set @mes = 80; set @ano = 2019 begin if ( @dia > 31 ) set…
-
2
votes2
answers7751
viewsA: ORA-06502 - string buffer too small numerical or value - Long Field
Replace the line select pm.ds_evolucao into temporary_varchar in the role to: select substr( pm.ds_evolucao, 1, 32000 ) into temporary_varchar you will see that it works. It turns out that the…
-
1
votes2
answers75
viewsA: Looking for a group of duplicate records
It is possible so, maybe it is faster and more practical: SELECT idOrder, altcode from @ORDER where altcode in ( SELECT ALTCODE FROM ( SELECT COUNT(*) AS QT, ALTCODE FROM @ORDER GROUP BY ALTCODE ) a…
-
0
votes0
answers28
viewsQ: Deleting records from a very large table
We have a table on Sqlserver with over 154 million records and we need delete all records whose DTANO is less than 2017. But the bank is accessed via WEB and, of course, can not get stuck. Trying to…
-
-1
votes1
answer756
viewsQ: java.net.Socketexception: Connection reset
I have a web service that validates the users of the application that runs on Android. In positive case the system returns a JSON with the information that is ok and to which database that user has…
-
0
votes1
answer294
viewsA: Error inserting BLOB type into Oracle Bank
You will need to change your logic in order to pass the long text to a variable and insert the variable. Behold: CREATE TABLE TESTE_LONG ( nr_linh NUMBER(5,0) NOT NULL, ds_linh LONG NULL ); Table…
-
0
votes1
answer97
viewsA: error when receiving JSON from url
Add the line in the dependencies group to the build.Radle. dependencies { ... implementation files('libs/android-async-http-1.4.4.jar') } Add to your Activity Imports: import…
-
0
votes1
answer66
viewsA: Image upload rotates vertical image
The camera saves information in the Orientation column as the image should be rotated for better viewing, some programs read this information and process accordingly. Below the view of a part of…
-
2
votes2
answers537
viewsA: Procedure of Insert in three tables
You could create a variable, assign the @@IDENTITY value to the variable, and use it in the Inserts. Thus: ALTER PROCEDURE adicionarNovoLivro( @nome_livro varchar(255), @nome_autor varchar(255),…
-
-1
votes4
answers314
viewsA: How do I know if I am programing procedurally in object orientation?
When you call a process directly without sending a message to a specific object so that it takes care of it you are being procedural. When you touch properties of an object outside the class of the…
-
3
votes1
answer54
viewsA: Mysql Error 1064
You should not use quotation marks to enter column names, only to enter non-numeric values. Your Insert should look like this: INSERT INTO dump1090 (hex,squawk,flight,lat,lon,validposition,altitude,…
-
1
votes2
answers56
viewsA: Android change the color of a button for 1second
I found it interesting and decided to write the way how it would solve this question. UNTESTED and needs some adjustments, because some methods that seemed more obvious to me were not written, but…
-
0
votes2
answers2179
viewsA: How to submit information to a json api in Delphi 7, Please help me
Here’s an example of how to send Json to a Webservice Add the Indy tIDHTTP component to your form and send it to your event from as follows: var Json: string; sResponse: string; JsonToSend:…
delphianswered Reginaldo Rigo 3,638 -
0
votes4
answers131
viewsA: MAX with LIMIT does not give the correct result
Do so: SELECT nome, idade from pessoas WHERE idade = ( select max( idade ) from pessoas )
-
0
votes2
answers580
viewsA: Extract Metadata from Firebird via Delphi
You can use isql this way: isql -extract -o metadata.sql banco.fdb
delphianswered Reginaldo Rigo 3,638 -
3
votes2
answers4377
viewsA: Regex for monetary values
You can use that expression: ^(([1-9]\d{0,2}(\.\d{3})*)|(([1-9]\.\d*)?\d))(\,\d\d)?
-
3
votes1
answer1181
viewsA: How to set . exe compatibility mode by prompt?
Adjust the environment with the command set __COMPAT_LAYER=WIN98 And run the show. The options are as follows::…
-
4
votes1
answer582
viewsA: How to find the class that called a method another class?
There is no easy way to do this. Since the method does not care who called, but you could do something like this: public class A { public void metodoA() { B.metodoB(); } } public static B { public…
javaanswered Reginaldo Rigo 3,638 -
5
votes2
answers172
viewsA: SQL SERVER - Convert String in Days
Using Ricardo’s answer and solving the case of more than 99 hours in the input string would look like this: declare @h int, @m int, @s int, @time varchar(8), @pos int set @time = '155:00:00' set…
-
0
votes1
answer83
viewsQ: mkdir on android does not work
I’m trying to create a folder on Android to save the photos of the vouchers, but I’m not succeeding. I’ve given permission in Manifest <manifest…
androidasked Reginaldo Rigo 3,638 -
0
votes2
answers1354
viewsA: Select from cursor
Cursor example. DELIMITER $$ CREATE PROCEDURE build_email_list (INOUT email_list varchar(4000)) BEGIN DECLARE v_finished INTEGER DEFAULT 0; DECLARE v_email varchar(100) DEFAULT ""; -- declare cursor…
-
1
votes3
answers63
viewsA: Business rule in a personal system
In your personal system you may not allow, for example, that the registered email is from GMAIL or that the user is over 18 years old or requires verification of the phone number, anyway; these are…
business-ruleanswered Reginaldo Rigo 3,638 -
0
votes1
answer59
viewsA: Select result feeding other 2 selects
Do so: You must ensure that the link fields in JOIN appear in tables. That the fields COD_PRODUTO and REVISAO are selected in SELECT A and SELECT B and that the column QER_LOTE is selected in both…
-
1
votes2
answers39
viewsA: How to insert for all users in PLSQL when there is no data?
Do so: merge into USUARIO a using (select '130' tipo, 'N' prioritario from dual) b on (a.tipo = b.tipo) when not matched then insert ( tipo, prioritario) values( b.tipo, b.prioritario ) It could be…
-
1
votes0
answers168
viewsQ: Procedure with EXECUTE IMMEDIATE
I created a script in Oracle that runs on an Owner, selects on several others and updates on another Owner on another server through a linkedserver. Due to the fact of making select in multiple…
oracleasked Reginaldo Rigo 3,638 -
0
votes2
answers75
viewsA: Filter data table
For this particular case, you could do so: SELECT substring( nome_coluna, 5, 5 ) FROM tabela But if the positions are different from record to record, you need to apply a smart rule. If so, post…
sql-serveranswered Reginaldo Rigo 3,638 -
0
votes1
answer192
viewsA: How to properly configure & character in SQL Developer 17.3
Run this command before: SET DEFINE OFF And perform normally. Or rewrite your command like this: SELECT * FROM CLIENTE WHERE NOME_CLIENTE IN ('SALES ' || chr(38) || ' CIA AGUIAR', 'SAO JOAO')…
-
1
votes2
answers1238
viewsA: read only first and last line file
Look at it this way: linha = lerArquivo.readLine(); // lê a primeira linha String primeiralinha = new.String( linha.getBytes()); String ultimalinha = new.String(""); // se o arquivo tiver uma unica…
javaanswered Reginaldo Rigo 3,638 -
1
votes0
answers69
viewsQ: Working layout on Android
Only I am having difficulties to format the layout screens in Android Studio after version 3.0.0 or I am no longer knowing how to do? My screens are mostly a Scrollview. To access the objects at the…
-
0
votes2
answers174
viewsA: Call the Textwatcher method
In the Activity where reporting is initialized you can add the textWatcher to Edit to receive message when editText is changed, thus: reportar=(TextView)findViewById(R.id.txtReport);…
-
1
votes3
answers4262
viewsA: How do I get the difference between dates on business days in Mysql?
It could be something like this: SELECT * FROM minhatabela WHERE date BETWEEN @inicio AND @fim AND WEEKDAY(date) < 5 This, of course, does not solve the issue of holidays.…
mysqlanswered Reginaldo Rigo 3,638 -
2
votes2
answers8186
viewsA: Mysql using variables in select
You’re mixing it all up. To make select do so: SELECT idPedido, idCombo FROM Pedidos WHERE idPedido = @idPedido AND idCombo = @idCombo and to do update do so: UPDATE Pedidos set idPedido =…
-
3
votes1
answer96
viewsA: Oracle , parameters of procedures of an Owner
You could do it like this: SELECT OBJECT_NAME FROM ALL_OBJECTS A LEFT JOIN ALL_ARGUMENTS B ON A.OBJECT_ID = B.OBJECT_ID WHERE OBJECT_TYPE IN ('PROCEDURE') AND B.ARGUMENT_NAME = 'XPTO'…
-
1
votes3
answers8269
viewsA: How to add character after last word written on line
Check which is the longest name length you have in your table and replace the number 50 of that formula with. A1 is the cell where the names are written, in my example: =CONCATENAR(A1;REPT("…
-
3
votes1
answer479
viewsQ: Select Like in Oracle
I’m developing a routine to standardize the descriptions in an Oracle database. So I’m scanning the entire database where I select the description, extract it word for word and compare it to a…
-
2
votes1
answer822
viewsA: Update in more than one line
It does this for security, to prevent you from doing a wrong update across the bank, for example. Add the key information he is requesting. For example: UPDATE cad_vendas SET canal ='9', parceiro…
-
2
votes1
answer1793
viewsA: How to find out how long an application has been running?
The program Process Explorer you can download here will show you this After running it, press the right mouse button on a process and choose "Properties" which it will show you the time when the…
-
5
votes1
answer539
viewsA: What’s the difference when you use Inary in the Where clause?
First, select should be like this: SELECT email, senha from login WHERE usuario = ? and senha = ? and not like this: SELECT email, senha from login WHERE usuario = ? && senha = ? BINARY does…
-
3
votes3
answers13782
viewsA: Changing the data type of an sql column
alter table Clientes alter column CliTelCel char(11)
-
1
votes1
answer37
viewsA: Character Explosion in Oracle
Create a function in Oracle: create or replace function GetToken( tokenstring in varchar, tokenpos in number, delim in varchar ) return varchar is x number; i number; j number; begin x := 1; i := 0;…
-
2
votes3
answers312
viewsA: Check for file on the web
import java.net.*; import java.io.*; public static boolean exists(String URLName){ try { HttpURLConnection.setFollowRedirects(false); HttpURLConnection con = (HttpURLConnection) new…
-
0
votes3
answers2752
viewsA: Comparison of Strings in sqlServer
I don’t know exactly what your need is. So it would be an option for this case. DECLARE @STR1 VARCHAR(20) DECLARE @STR2 VARCHAR(20) SET @STR1 = '2.9.15' SET @STR2 = '2.9.16' IF CAST( REPLACE(…
-
1
votes1
answer40
viewsA: Base64.Decode specific
I finally got the answer. That function solved the question: public static byte[] hexStringToByteArray(String s) { int len = s.length(); byte[] data = new byte[len / 2]; for (int i = 0; i < len;…
androidanswered Reginaldo Rigo 3,638 -
1
votes1
answer40
viewsQ: Base64.Decode specific
I’m trying to load a string I get from Webservice in an Imageview from Android. I made some comparisons and found that the string I receive is correct, however it is a string and as such I can not…
androidasked Reginaldo Rigo 3,638 -
1
votes2
answers753
viewsA: UNION with 2 DATABASES, SQL
As long as the user has permission in both banks. Assuming it is SQL-Server and the tables are equal in both databases: SELECT * FROM OUTRO_BANCO..TABELA WHERE ..... UNION SELECT * FROM…
-
1
votes2
answers950
viewsA: If an int variable does not receive anything from select it is zero or not
declare @teste int set @teste = 0; select @teste = campo1 from tabela where campo2 = condicao2 -- considerando que volte nulo if ( @teste is null ) print 'nula' else print 'não nula'…