>>> Carmen Parrish7/August/1996 03:36am >>> I am a relatively new user to Ingres in the UNIX environment although I have used it for 10 years in VMS. I am currently working in Open Ingres Sparc Solaris Version OPIng 1.1/04 (su4.us5/00) under SunOS 5.5. I am converting embedded code from the VMS to UNIX environment. My problem is the passing of parameters to a report from the command line. I can't seem to get the syntax right and the manual I have (6.4) doesn't really help. I'm hoping someone out there with more experience can point out my mistake. Here's what I'm trying to do: I have a .QUERY in a report writer report with a $whereclause parameter. When run interactively (ie, the parameter value is prompted for), the report works fine. However, I want to pass the $whereclause on the command line and since the whereclause contains a value with a string in it, that's where the problem arises. The string is not recognized as such (ingres thinks its a function) and so the query cannot run. Although I don't think it matters, the .QUERY is written in QUEL. I have tried variations of the following with no luck: $ report dbname repname ("whereclause='mytab.field1="string1"') The errors I get using single, double quotes or even doubling and tripling the single, double quotes run the range from invalid report command syntax to .QUERY errors. I have even escaped "\" the parenthesis and the quotes in an attempt to work and it still fails. BTW, this works in VMS using the correct number of single and double quotes, so I know this isn't impossible. Running interactively is not an option since this command line will eventually run in batch (background) but I need it to work first at the prompt before adding it in the embedded code. Thanks in advance. Carmen Parrish parrish2@llnl.gov Close Carmen, but as you've noted no cigar. The format you need is; report dbname repname parameter_string UNIX needs to interpret parameter string as a single entity so it MUST be in single quotes. Inside parameter string for simplicity literal values should be in double quotes. Any use of a double quote as part of a literal value MUST be escaped. Now here comes the fun part any embedding of a single quote in a literal UNIX will interpret as the end of the string. So long as there is no white space between 2 strings on a command line UNIX interprets the 2 strings as 1. So to get a single quote what you have to do is put in the first part of the string, add a single quote and then put in the second part of the string. So your command should be; report dbname repname '(whereclause="mytab.field1='"'"'string1'"'"')' ie add string '(whereclause="mytab.field1=' to string "'" to string 'string1' to string "'" to string ')' to make up your parameter string. Once in report writer this parameter string literally replaces $whereclause with: mytab.field1='string1' PS: I've tried this it works. ------------------------------------------------------------------------------ Steve Clements If you can find an opinion here its About Time Software Solutions yours to keep. Brisbane, Queensland, Australia President of Vice, Queensland IUA Email: clemens@pcux.citec.qld.gov.au ph & fax: 61-7-3217-2118 or sclement@interconnect.com.au ------------------------------------------------------------------------------
© William Yuan 2000
Email William