Sponsored Content
Full Discussion: Sql select replace
Top Forums Programming Sql select replace Post 302803915 by Yoda on Tuesday 7th of May 2013 04:39:56 PM
Old 05-07-2013
You are doing it wrong!

To update string: sample to data, use below SQL:
Code:
update clusters set name = replace(name, 'sample', 'data');

Before committing select & verify the output:
Code:
select name, characteristics from clusters;

Note: Also the wildcards used in SQL are % and _ not * and ?
This User Gave Thanks to Yoda For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Pipe SQL select statement results to script

Hello I would like to perform a select from a oracle table and return those values to my shell script For example: site=head -1 $infile | cut -c1-15 | awk '{printf "s%", $0} sqlplus -s /nolog |& #Open pipe to sql select col1, col2, col3, col4 from oracle_table where col5 =... (6 Replies)
Discussion started by: houtakker
6 Replies

2. Shell Programming and Scripting

formatting the sql select result

Hi, I have about 12 columns and 15 rows to be retrived from sybase isql command through unix. But when i output the sql into a file and see it, the formatting is going for a toss. can someone please suggest how can i get the result correctly in the output file ? Thanks, Sateesh (2 Replies)
Discussion started by: kotasateesh
2 Replies

3. Web Development

SQL Select inside Insert

I have following. . . . $userid = 2 . $query = "select username from users where userid = ".$userid.";"; . $username = $line; $data="Some Data Here"; . $query = "insert into logger (username, data) valuse ($username, $data);"; . I would like to not have 2 database calls. (3 Replies)
Discussion started by: Ikon
3 Replies

4. Shell Programming and Scripting

SQL Select and awk

Dear All , I have file1.txt contain values like the following: ---------- 23 24 25 and I have shell script which has the following : more file1.txt | awk '{print "select 'DUMP',CODE1||'|'||CODE2||'|'||CODE3 from CODE where CODE1='" $1 "';"}' > file2.sql all I need is to have the... (6 Replies)
Discussion started by: habuzahra
6 Replies

5. Shell Programming and Scripting

Select SQL Queries Option

count.sh#!/bin/ksh SQL1=`sqlplus -s usr/pwd @count.sql $1 $2 $3` SQL2=`sqlplus -s usr/pwd @selectall.sql $1 $2 $3` LIST="Count Select_All" select i in $LIST do if then echo $SQL1 elif then echo $SQL2 fi done (2 Replies)
Discussion started by: killboy
2 Replies

6. Shell Programming and Scripting

using SELECT sql statement in shell script

Hi there I have a database on a remote box and i have been using shell script to insert data into it for example, i could have a script that did this SN=123456 n=server1 m=x4140 sql="UPDATE main SET hostname='$n',model='$m' WHERE serial='$SN';" echo $sql |/usr/sfw/bin/mysql -h... (4 Replies)
Discussion started by: hcclnoodles
4 Replies

7. Shell Programming and Scripting

SQL select all but not if it is already in an other column

I know I know.. for sure one of the easier mysql statements. But somehow I can not figure out this. I expect to see all distinct items of 'data_12' where 'kwroot' has 'straxx' in, and in the same row 'data_12' ist (not = 'kwsearched' in any existing row) data_12 ... (6 Replies)
Discussion started by: lowmaster
6 Replies

8. Programming

I'm going crazy with SQL select. Please help!

Hello people, as wrote in title I'm going crazy with a "complex" SQL select. This is the seelct: select T_ADDRESS, T_MCC,T_MNC,T_MSIN,T_IM_MNC, COUNT(*) FROM TABLETEST WHERE T_MCC=123 AND (T_MNC=11 OR T_MNC=01) GROUP BY T_ADDRESS,T_MCC,T_MNC,T_MSIN,T_IM_MNC HAVING count(*) > 5;This select... (7 Replies)
Discussion started by: Lord Spectre
7 Replies

9. Programming

[Solved] SQL SELECT REPLACE

Hi All, I had a query related to sql select update replace command. i have a table named clusters and it looks like this name model characteristics sample1.1 +123 parent sample1.2 -456 clone sample1.3 +122 ... (5 Replies)
Discussion started by: sonia102
5 Replies

10. Shell Programming and Scripting

Parse SQL text and only format first SELECT statement.

Hi Forum. Need your expertise on the following question. I have the following file which I would like to parse, find first block of SELECT statment and concatenate all input fields as 1 field (~ delimited): Old File: SELECT /*+ USE_HASH(CCOMM ICAR IMAP IAS IP IMAS IMPS IAP SPCA) */ ... (5 Replies)
Discussion started by: pchang
5 Replies
RDF::Query::Compiler::SQL(3pm)				User Contributed Perl Documentation			    RDF::Query::Compiler::SQL(3pm)

NAME
RDF::Query::Compiler::SQL - Compile a SPARQL query directly to SQL. VERSION
This document describes RDF::Query::Compiler::SQL version 2.908. METHODS
"new ( $parse_tree )" Returns a new compiler object. "compile ()" Returns a SQL query string for the specified parse tree. "emit_select" Returns a SQL query string representing the query. "limit_clause" Returns a SQL LIMIT clause, or an empty string if the query does not need limiting. "order_by_clause" Returns a SQL ORDER BY clause, or an empty string if the query does not use ordering. "variable_columns ( $var )" Given a variable name, returns the set of column aliases that store the values for the column (values for Literals, URIs, and Blank Nodes). "add_variable_values_joins" Modifies the query by adding LEFT JOINs to the tables in the database that contain the node values (for literals, resources, and blank nodes). "patterns2sql ( @triples, $level, %args )" Builds the SQL query in instance data from the supplied @triples. $level is used as a unique identifier for recursive calls. %args may contain callback closures for the following keys: 'where_hook' 'from_hook' When present, these closures are used to add SQL FROM and WHERE clauses to the query instead of adding them directly to the object's instance data. "expr2sql ( $expression, $level, %args )" Returns a SQL expression for the supplied query $expression. $level is used as a unique identifier for recursive calls. %args may contain callback closures for the following keys: 'where_hook' 'from_hook' When present, these closures are used to add necessary SQL FROM and WHERE clauses to the query. "_mysql_hash ( $data )" Returns a hash value for the supplied $data string. This value is computed using the same algorithm that Redland's mysql storage backend uses. "_mysql_node_hash ( $node )" Returns a hash value (computed by "_mysql_hash" for the supplied $node. The hash value is based on the string value of the node and the node type. "qualify_uri ( $uri )" Returns a fully qualified URI from the supplied $uri. $uri may already be a qualified URI, or a parse tree for a qualified URI or QName. If $uri is a QName, the namespaces defined in the query parse tree are used to fully qualify. "add_function ( $uri, $function )" Associates the custom function $function (a CODE reference) with the specified URI, allowing the function to be called by query FILTERs. "get_function ( $uri )" If $uri is associated with a query function, returns a CODE reference to the function. Otherwise returns "undef". AUTHOR
Gregory Williams <gwilliams@cpan.org> perl v5.14.2 2012-01-31 RDF::Query::Compiler::SQL(3pm)
All times are GMT -4. The time now is 11:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy