On 9 Aug 96 at 15:02, Ramki Natesan wrote:
} DATABASE vendor
} Hi All,
} I am getting error on "OPEN and FETCH" stmnt. Could someone help
} on this?
}
} Engine Version: 5.x, 4GL version 4.10UE2.
} h/w is SunOS 4.1.3.
}
} code starts here---------
} MAIN
} CALL validate_ids()
} END MAIN
}
} FUNCTION validate_ids()
} DEFINE
} p_pid char (10) ,
} pccd char (10),
} p_parent_desc char(30)
}
} LET p_pid = "41893"
}
} CALL prep_statements()
}
} OPEN c_sel USING p_pid
} |
} | The cursor "c_sel" has not yet been declared in this program
} | module. It must be declared before it can be used.
} | See error number -4372.
}
} FETCH c_sel into pccd, p_parent_desc
} |
} | The cursor "c_sel" has not yet been declared in this program
} | module. It must be declared before it can be used.
} | See error number -4372.
}
} END FUNCTION
}
} FUNCTION prep_statements()
} DEFINE sel_str char(500)
}
} LET sel_str = " SELECT comp_cd, comp.comp_ident FROM comp ",
} " WHERE comp.comp_id = ? "
}
} PREPARE prep_stmt FROM sel_str
} DECLARE c_sel CURSOR FOR prep_stmt
}
} end function
}
Ramki,
The physical location of the declared cursore should always be
physically located before the Cursor is used. Just move your function
before the Call to it, and it should work fine.
Gopi.