Sponsored Content
Top Forums Programming I'm going crazy with SQL select. Please help! Post 302546126 by DGPickett on Wednesday 10th of August 2011 12:04:33 PM
Old 08-10-2011
It decodes cases of T_IM_MNC, so when T_IM_MNC is this value then return that value. When T_IM_MNC is 1 return 5 from CASE.

The logical form of case (more wordy but more versatile, is "CASE WHEN ( T_IM_MNC = 1 ) THEN 5 . . . ."

Case makes it both less wordy, prettier to format, and run faster. What's not to like? Smilie
 

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

How to redirect value from sql select statment to unix variable

Hi, I need to get the value from the table using the sql command and store this value into the unix variable so that i can use this value for furthure use.. Please can any body help me in this regards Thanks & Regards Abdul Hafeez Shaik (17 Replies)
Discussion started by: abdulhafeez
17 Replies

5. 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

6. 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

7. 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

8. 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

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. Programming

Sql select replace

Hi All, I had a query related to sql select replace command. i have a table named clusters and it looks like this Code: name characteristics sample 1.1 parent sample 1.2 ... (2 Replies)
Discussion started by: siya@
2 Replies
MOKA(1) 						     CAO-VLSI Reference Manual							   MOKA(1)

NAME
MOKA - Model checker ancestor ORIGIN
This software belongs to the ALLIANCE CAD SYSTEM developed by the ASIM team at LIP6 laboratory of Universite Pierre et Marie CURIE, in Paris, France. Web : http://asim.lip6.fr/recherche/alliance/ E-mail : alliance-users@asim.lip6.fr SYNOPSIS
moka [-VDB] fsm_filename ctl_filename DESCRIPTION
moka is a CTL model checker. Made to run on FSM or RTL descriptions, moka supports the same VHDL subset as syf or boom (for further informations about this subset see SYF(1), BOOM(1), FSM(5), VBE(5) ). Nevertheless moka imposes that each register of the behavioral description have the same clock condi- tion and that there are no tristate or multiplexed buses. In particular VHDL type MUX_BIT and WOR_BIT aren't not supported. First of all moka build the fonction transition of the FSM using a Reduced Ordered Binary Decision Diagrams representation. It then applies the initial conditions to find the first state (keyword INITIAL and/or RESET_COND in the CTL(5) file format). After it computes a symbolic simulation of the FSM in order to find all reachable states. This computation takes into account the assump- tions conditions (ASSUME keyword in the CTL(5) file format). moka finally verifies one by one each CTL formulae. (see CTL(5) for CTL file format details). CTL OPERATORS
For each CTL sub-expression moka will return the set of states that verifies the formula. For example EX(p) will return the set of reach- able states that verifies EX(p). CTL operators : EX(p) : returns all states which have almost one primary state successor that verifies p. EU(p,q) : returns all states that are the root of almost one path, such that p is true until q is always true. EG(p) : returns all states that are the root of almost one path, such that p is always true. AX(p) : returns all states which have all their primary state successor that verifies p. AU(p,q) : returns all states that are the root of only pathes from which p is true until q is always true. AG(p) : returns all states that are the root of only pathes, such that p is always true. ENVIRONMENT VARIABLES
MBK_WORK_LIB gives the path for the description and the CTL file. The default value is the current directory. MBK_CATA_LIB gives some auxiliary pathes for the descriptions and the CTL file. The default value is the current directory. OPTIONS
-V Sets verbose mode on. Each step of the model checking is displayed on the standard output. -D Sets debug mode on. Each step of the model checking is detailed on the standard output. In particular all states set are displayed for each CTL sub-expression. -B The input file is a VHDL description using the Alliance VHDL subset (see VBE(5) file format). FSM EXAMPLE
-- A multi fsm example ENTITY example is PORT ( ck : in BIT; data_in : in BIT; reset : in BIT; data_out : out BIT ); END example; ARCHITECTURE FSM OF example is TYPE A_ETAT_TYPE IS (A_E0, A_E1); SIGNAL A_NS, A_CS : A_ETAT_TYPE; TYPE B_ETAT_TYPE IS (B_E0, B_E1); SIGNAL B_NS, B_CS : B_ETAT_TYPE; --PRAGMA CURRENT_STATE A_CS FSM_A --PRAGMA NEXT_STATE A_NS FSM_A --PRAGMA CLOCK ck FSM_A --PRAGMA FIRST_STATE A_E0 FSM_A --PRAGMA CURRENT_STATE B_CS FSM_B --PRAGMA NEXT_STATE B_NS FSM_B --PRAGMA CLOCK ck FSM_B --PRAGMA FIRST_STATE B_E0 FSM_B SIGNAL ACK, REQ, DATA_INT : BIT; BEGIN A_1 : PROCESS ( A_CS, ACK ) BEGIN IF ( reset = '1' ) THEN A_NS <= A_E0; DATA_OUT <= '0'; REQ <= '0'; ELSE CASE A_CS is WHEN A_E0 => IF ( ACK ='1') THEN A_NS <= A_E1; ELSE A_NS <= A_E0; END IF; DATA_OUT <= '0'; REQ <= '1'; WHEN A_E1 => IF ( ACK ='1') THEN A_NS <= A_E1; ELSE A_NS <= A_E0; END IF; DATA_OUT <= DATA_INT; REQ <= '0'; END CASE; END IF; END PROCESS A_1; A_2 : PROCESS( ck ) BEGIN IF ( ck = '1' AND NOT ck'STABLE ) THEN A_CS <= A_NS; END IF; END PROCESS A_2; ------- B_1 : PROCESS ( B_CS, ACK ) BEGIN IF ( reset = '1' ) THEN B_NS <= B_E0; DATA_INT <= '0'; ACK <= '0'; ELSE CASE B_CS is WHEN B_E0 => IF ( REQ ='1') THEN B_NS <= B_E1; ELSE B_NS <= B_E0; END IF; DATA_INT <= '0'; ACK <= '0'; WHEN B_E1 => IF ( REQ ='1') THEN B_NS <= B_E1; ELSE B_NS <= B_E0; END IF; DATA_INT <= DATA_IN; ACK <= '1'; END CASE; END IF; END PROCESS B_1; B_2 : PROCESS( ck ) BEGIN IF ( ck = '1' AND NOT ck'STABLE ) THEN B_CS <= B_NS; END IF; END PROCESS B_2; END FSM; CTL EXAMPLE
-- A CTL file example TYPE A_ETAT_TYPE IS (A_E0, A_E1); TYPE B_ETAT_TYPE IS (B_E0, B_E1); VARIABLE A_NS, A_CS : A_ETAT_TYPE; VARIABLE B_NS, B_CS : B_ETAT_TYPE; VARIABLE ck : BIT; VARIABLE data_in : BIT; VARIABLE data_out : BIT; VARIABLE reset : BIT; VARIABLE ack : BIT; VARIABLE req : BIT; RESET_COND init1 := (reset='1'); ASSUME ass1 := (reset='0'); begin prop1 : EX( ack='1' ); prop2 : AG( req -> AF( ack ) ); prop4 : AU( req='1', ack='1'); end; MOKA EXAMPLE
moka -V example example SEE ALSO
syf (1), fsp (1), fsm (5), ctl (5), vbe(5). BUG REPORT
This tool is under development at the ASIM department of the LIP6 laboratory. We need your feedback to improve documentation and tools. ASIM
/LIP6 August 5, 2002 MOKA(1)
All times are GMT -4. The time now is 11:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy